diff options
Diffstat (limited to 'include/linux/sunrpc')
-rw-r--r-- | include/linux/sunrpc/svc.h | 45 | ||||
-rw-r--r-- | include/linux/sunrpc/svcsock.h | 14 |
2 files changed, 49 insertions, 10 deletions
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 64f3d60c72a..83b3c7b433a 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -11,6 +11,7 @@ #define SUNRPC_SVC_H #include <linux/in.h> +#include <linux/in6.h> #include <linux/sunrpc/types.h> #include <linux/sunrpc/xdr.h> #include <linux/sunrpc/auth.h> @@ -191,7 +192,13 @@ static inline void svc_putu32(struct kvec *iov, __be32 val) iov->iov_len += sizeof(__be32); } - +union svc_addr_u { + struct in_addr addr; +#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) + struct in6_addr addr6; +#endif +}; + /* * The context of a single thread, including the request currently being * processed. @@ -200,8 +207,8 @@ struct svc_rqst { struct list_head rq_list; /* idle list */ struct list_head rq_all; /* all threads list */ struct svc_sock * rq_sock; /* socket */ - struct sockaddr_in rq_addr; /* peer address */ - int rq_addrlen; + struct sockaddr_storage rq_addr; /* peer address */ + size_t rq_addrlen; struct svc_serv * rq_server; /* RPC service definition */ struct svc_pool * rq_pool; /* thread pool */ @@ -227,8 +234,8 @@ struct svc_rqst { unsigned short rq_secure : 1; /* secure port */ - - __be32 rq_daddr; /* dest addr of request - reply from here */ + union svc_addr_u rq_daddr; /* dest addr of request + * - reply from here */ void * rq_argp; /* decoded arguments */ void * rq_resp; /* xdr'd results */ @@ -256,6 +263,24 @@ struct svc_rqst { }; /* + * Rigorous type checking on sockaddr type conversions + */ +static inline struct sockaddr_in *svc_addr_in(struct svc_rqst *rqst) +{ + return (struct sockaddr_in *) &rqst->rq_addr; +} + +static inline struct sockaddr_in6 *svc_addr_in6(struct svc_rqst *rqst) +{ + return (struct sockaddr_in6 *) &rqst->rq_addr; +} + +static inline struct sockaddr *svc_addr(struct svc_rqst *rqst) +{ + return (struct sockaddr *) &rqst->rq_addr; +} + +/* * Check buffer bounds after decoding arguments */ static inline int @@ -292,9 +317,10 @@ static inline void svc_free_res_pages(struct svc_rqst *rqstp) struct svc_deferred_req { u32 prot; /* protocol (UDP or TCP) */ - struct sockaddr_in addr; - struct svc_sock *svsk; /* where reply must go */ - __be32 daddr; /* where reply must come from */ + struct svc_sock *svsk; + struct sockaddr_storage addr; /* where reply must go */ + size_t addrlen; + union svc_addr_u daddr; /* where reply must come from */ struct cache_deferred_req handle; int argslen; __be32 args[0]; @@ -368,5 +394,8 @@ int svc_register(struct svc_serv *, int, unsigned short); void svc_wake_up(struct svc_serv *); void svc_reserve(struct svc_rqst *rqstp, int space); struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu); +char * svc_print_addr(struct svc_rqst *, char *, size_t); + +#define RPC_MAX_ADDRBUFLEN (63U) #endif /* SUNRPC_SVC_H */ diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h index 98b21ad370f..cccea0a0feb 100644 --- a/include/linux/sunrpc/svcsock.h +++ b/include/linux/sunrpc/svcsock.h @@ -57,13 +57,16 @@ struct svc_sock { /* cache of various info for TCP sockets */ void *sk_info_authunix; + + struct sockaddr_storage sk_remote; /* remote peer's address */ + int sk_remotelen; /* length of address */ }; /* * Function prototypes. */ -int svc_makesock(struct svc_serv *, int, unsigned short); -void svc_delete_socket(struct svc_sock *); +int svc_makesock(struct svc_serv *, int, unsigned short, int flags); +void svc_close_socket(struct svc_sock *); int svc_recv(struct svc_rqst *, long); int svc_send(struct svc_rqst *); void svc_drop(struct svc_rqst *); @@ -74,4 +77,11 @@ int svc_addsock(struct svc_serv *serv, char *name_return, int *proto); +/* + * svc_makesock socket characteristics + */ +#define SVC_SOCK_DEFAULTS (0U) +#define SVC_SOCK_ANONYMOUS (1U << 0) /* don't register with pmap */ +#define SVC_SOCK_TEMPORARY (1U << 1) /* flag socket as temporary */ + #endif /* SUNRPC_SVCSOCK_H */ |