diff options
Diffstat (limited to 'include/linux/sunrpc/svc.h')
-rw-r--r-- | include/linux/sunrpc/svc.h | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 64f3d60c72af..83b3c7b433aa 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #define SUNRPC_SVC_H | 11 | #define SUNRPC_SVC_H |
12 | 12 | ||
13 | #include <linux/in.h> | 13 | #include <linux/in.h> |
14 | #include <linux/in6.h> | ||
14 | #include <linux/sunrpc/types.h> | 15 | #include <linux/sunrpc/types.h> |
15 | #include <linux/sunrpc/xdr.h> | 16 | #include <linux/sunrpc/xdr.h> |
16 | #include <linux/sunrpc/auth.h> | 17 | #include <linux/sunrpc/auth.h> |
@@ -191,7 +192,13 @@ static inline void svc_putu32(struct kvec *iov, __be32 val) | |||
191 | iov->iov_len += sizeof(__be32); | 192 | iov->iov_len += sizeof(__be32); |
192 | } | 193 | } |
193 | 194 | ||
194 | 195 | union svc_addr_u { | |
196 | struct in_addr addr; | ||
197 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
198 | struct in6_addr addr6; | ||
199 | #endif | ||
200 | }; | ||
201 | |||
195 | /* | 202 | /* |
196 | * The context of a single thread, including the request currently being | 203 | * The context of a single thread, including the request currently being |
197 | * processed. | 204 | * processed. |
@@ -200,8 +207,8 @@ struct svc_rqst { | |||
200 | struct list_head rq_list; /* idle list */ | 207 | struct list_head rq_list; /* idle list */ |
201 | struct list_head rq_all; /* all threads list */ | 208 | struct list_head rq_all; /* all threads list */ |
202 | struct svc_sock * rq_sock; /* socket */ | 209 | struct svc_sock * rq_sock; /* socket */ |
203 | struct sockaddr_in rq_addr; /* peer address */ | 210 | struct sockaddr_storage rq_addr; /* peer address */ |
204 | int rq_addrlen; | 211 | size_t rq_addrlen; |
205 | 212 | ||
206 | struct svc_serv * rq_server; /* RPC service definition */ | 213 | struct svc_serv * rq_server; /* RPC service definition */ |
207 | struct svc_pool * rq_pool; /* thread pool */ | 214 | struct svc_pool * rq_pool; /* thread pool */ |
@@ -227,8 +234,8 @@ struct svc_rqst { | |||
227 | unsigned short | 234 | unsigned short |
228 | rq_secure : 1; /* secure port */ | 235 | rq_secure : 1; /* secure port */ |
229 | 236 | ||
230 | 237 | union svc_addr_u rq_daddr; /* dest addr of request | |
231 | __be32 rq_daddr; /* dest addr of request - reply from here */ | 238 | * - reply from here */ |
232 | 239 | ||
233 | void * rq_argp; /* decoded arguments */ | 240 | void * rq_argp; /* decoded arguments */ |
234 | void * rq_resp; /* xdr'd results */ | 241 | void * rq_resp; /* xdr'd results */ |
@@ -256,6 +263,24 @@ struct svc_rqst { | |||
256 | }; | 263 | }; |
257 | 264 | ||
258 | /* | 265 | /* |
266 | * Rigorous type checking on sockaddr type conversions | ||
267 | */ | ||
268 | static inline struct sockaddr_in *svc_addr_in(struct svc_rqst *rqst) | ||
269 | { | ||
270 | return (struct sockaddr_in *) &rqst->rq_addr; | ||
271 | } | ||
272 | |||
273 | static inline struct sockaddr_in6 *svc_addr_in6(struct svc_rqst *rqst) | ||
274 | { | ||
275 | return (struct sockaddr_in6 *) &rqst->rq_addr; | ||
276 | } | ||
277 | |||
278 | static inline struct sockaddr *svc_addr(struct svc_rqst *rqst) | ||
279 | { | ||
280 | return (struct sockaddr *) &rqst->rq_addr; | ||
281 | } | ||
282 | |||
283 | /* | ||
259 | * Check buffer bounds after decoding arguments | 284 | * Check buffer bounds after decoding arguments |
260 | */ | 285 | */ |
261 | static inline int | 286 | static inline int |
@@ -292,9 +317,10 @@ static inline void svc_free_res_pages(struct svc_rqst *rqstp) | |||
292 | 317 | ||
293 | struct svc_deferred_req { | 318 | struct svc_deferred_req { |
294 | u32 prot; /* protocol (UDP or TCP) */ | 319 | u32 prot; /* protocol (UDP or TCP) */ |
295 | struct sockaddr_in addr; | 320 | struct svc_sock *svsk; |
296 | struct svc_sock *svsk; /* where reply must go */ | 321 | struct sockaddr_storage addr; /* where reply must go */ |
297 | __be32 daddr; /* where reply must come from */ | 322 | size_t addrlen; |
323 | union svc_addr_u daddr; /* where reply must come from */ | ||
298 | struct cache_deferred_req handle; | 324 | struct cache_deferred_req handle; |
299 | int argslen; | 325 | int argslen; |
300 | __be32 args[0]; | 326 | __be32 args[0]; |
@@ -368,5 +394,8 @@ int svc_register(struct svc_serv *, int, unsigned short); | |||
368 | void svc_wake_up(struct svc_serv *); | 394 | void svc_wake_up(struct svc_serv *); |
369 | void svc_reserve(struct svc_rqst *rqstp, int space); | 395 | void svc_reserve(struct svc_rqst *rqstp, int space); |
370 | struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu); | 396 | struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu); |
397 | char * svc_print_addr(struct svc_rqst *, char *, size_t); | ||
398 | |||
399 | #define RPC_MAX_ADDRBUFLEN (63U) | ||
371 | 400 | ||
372 | #endif /* SUNRPC_SVC_H */ | 401 | #endif /* SUNRPC_SVC_H */ |