diff options
| author | Chuck Lever <chuck.lever@oracle.com> | 2007-02-12 03:53:34 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-12 12:48:36 -0500 |
| commit | 27459f0940e16c68e080f5fc7e85aa9eb3f74528 (patch) | |
| tree | f13cd1f2005dda2b6115e2afbc49e1271b0d374b /include/linux/sunrpc | |
| parent | 2442222283918c2d1c20ae651d95fe168757938b (diff) | |
[PATCH] knfsd: SUNRPC: Provide room in svc_rqst for larger addresses
Expand the rq_addr field to allow it to contain larger addresses.
Specifically, we replace a 'sockaddr_in' with a 'sockaddr_storage', then
everywhere the 'sockaddr_in' was referenced, we use instead an accessor
function (svc_addr_in) which safely casts the _storage to _in.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/sunrpc')
| -rw-r--r-- | include/linux/sunrpc/svc.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 52db9c8985c5..96c1b6ae7d96 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
| @@ -200,8 +200,8 @@ struct svc_rqst { | |||
| 200 | struct list_head rq_list; /* idle list */ | 200 | struct list_head rq_list; /* idle list */ |
| 201 | struct list_head rq_all; /* all threads list */ | 201 | struct list_head rq_all; /* all threads list */ |
| 202 | struct svc_sock * rq_sock; /* socket */ | 202 | struct svc_sock * rq_sock; /* socket */ |
| 203 | struct sockaddr_in rq_addr; /* peer address */ | 203 | struct sockaddr_storage rq_addr; /* peer address */ |
| 204 | int rq_addrlen; | 204 | size_t rq_addrlen; |
| 205 | 205 | ||
| 206 | struct svc_serv * rq_server; /* RPC service definition */ | 206 | struct svc_serv * rq_server; /* RPC service definition */ |
| 207 | struct svc_pool * rq_pool; /* thread pool */ | 207 | struct svc_pool * rq_pool; /* thread pool */ |
| @@ -256,6 +256,19 @@ struct svc_rqst { | |||
| 256 | }; | 256 | }; |
| 257 | 257 | ||
| 258 | /* | 258 | /* |
| 259 | * Rigorous type checking on sockaddr type conversions | ||
| 260 | */ | ||
| 261 | static inline struct sockaddr_in *svc_addr_in(struct svc_rqst *rqst) | ||
| 262 | { | ||
| 263 | return (struct sockaddr_in *) &rqst->rq_addr; | ||
| 264 | } | ||
| 265 | |||
| 266 | static inline struct sockaddr *svc_addr(struct svc_rqst *rqst) | ||
| 267 | { | ||
| 268 | return (struct sockaddr *) &rqst->rq_addr; | ||
| 269 | } | ||
| 270 | |||
| 271 | /* | ||
| 259 | * Check buffer bounds after decoding arguments | 272 | * Check buffer bounds after decoding arguments |
| 260 | */ | 273 | */ |
| 261 | static inline int | 274 | static inline int |
