diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-01-13 04:09:19 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-01-31 19:28:12 -0500 |
commit | 90100b1766c914c820baa78b5be6845fae1159b8 (patch) | |
tree | 8bfc406c44d8238aff6be33773bccf2083d3f66e /net | |
parent | 8b147f74738d9ab7e76085e5535e0fe8dc8b29f4 (diff) |
SUNRPC: parametrize rpc_pton() by network context
Parametrize rpc_pton() by network context and thus force it's callers to pass
in network context instead of using hard-coded "init_net".
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/addr.c | 7 | ||||
-rw-r--r-- | net/sunrpc/svcauth_unix.c | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/net/sunrpc/addr.c b/net/sunrpc/addr.c index 18c40a2002fb..82b06b73c1e1 100644 --- a/net/sunrpc/addr.c +++ b/net/sunrpc/addr.c | |||
@@ -230,6 +230,7 @@ static size_t rpc_pton6(struct net *net, const char *buf, const size_t buflen, | |||
230 | 230 | ||
231 | /** | 231 | /** |
232 | * rpc_pton - Construct a sockaddr in @sap | 232 | * rpc_pton - Construct a sockaddr in @sap |
233 | * @net: applicable network namespace | ||
233 | * @buf: C string containing presentation format IP address | 234 | * @buf: C string containing presentation format IP address |
234 | * @buflen: length of presentation address in bytes | 235 | * @buflen: length of presentation address in bytes |
235 | * @sap: buffer into which to plant socket address | 236 | * @sap: buffer into which to plant socket address |
@@ -242,14 +243,14 @@ static size_t rpc_pton6(struct net *net, const char *buf, const size_t buflen, | |||
242 | * socket address, if successful. Returns zero if an error | 243 | * socket address, if successful. Returns zero if an error |
243 | * occurred. | 244 | * occurred. |
244 | */ | 245 | */ |
245 | size_t rpc_pton(const char *buf, const size_t buflen, | 246 | size_t rpc_pton(struct net *net, const char *buf, const size_t buflen, |
246 | struct sockaddr *sap, const size_t salen) | 247 | struct sockaddr *sap, const size_t salen) |
247 | { | 248 | { |
248 | unsigned int i; | 249 | unsigned int i; |
249 | 250 | ||
250 | for (i = 0; i < buflen; i++) | 251 | for (i = 0; i < buflen; i++) |
251 | if (buf[i] == ':') | 252 | if (buf[i] == ':') |
252 | return rpc_pton6(&init_net, buf, buflen, sap, salen); | 253 | return rpc_pton6(net, buf, buflen, sap, salen); |
253 | return rpc_pton4(buf, buflen, sap, salen); | 254 | return rpc_pton4(buf, buflen, sap, salen); |
254 | } | 255 | } |
255 | EXPORT_SYMBOL_GPL(rpc_pton); | 256 | EXPORT_SYMBOL_GPL(rpc_pton); |
@@ -340,7 +341,7 @@ size_t rpc_uaddr2sockaddr(const char *uaddr, const size_t uaddr_len, | |||
340 | port = (unsigned short)((porthi << 8) | portlo); | 341 | port = (unsigned short)((porthi << 8) | portlo); |
341 | 342 | ||
342 | *c = '\0'; | 343 | *c = '\0'; |
343 | if (rpc_pton(buf, strlen(buf), sap, salen) == 0) | 344 | if (rpc_pton(&init_net, buf, strlen(buf), sap, salen) == 0) |
344 | return 0; | 345 | return 0; |
345 | 346 | ||
346 | switch (sap->sa_family) { | 347 | switch (sap->sa_family) { |
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index 01153ead1dba..2f8c426c1384 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c | |||
@@ -211,7 +211,7 @@ static int ip_map_parse(struct cache_detail *cd, | |||
211 | len = qword_get(&mesg, buf, mlen); | 211 | len = qword_get(&mesg, buf, mlen); |
212 | if (len <= 0) return -EINVAL; | 212 | if (len <= 0) return -EINVAL; |
213 | 213 | ||
214 | if (rpc_pton(buf, len, &address.sa, sizeof(address)) == 0) | 214 | if (rpc_pton(&init_net, buf, len, &address.sa, sizeof(address)) == 0) |
215 | return -EINVAL; | 215 | return -EINVAL; |
216 | switch (address.sa.sa_family) { | 216 | switch (address.sa.sa_family) { |
217 | case AF_INET: | 217 | case AF_INET: |