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