Commit 3065f1e2 authored by Stanislav Kinsbursky's avatar Stanislav Kinsbursky Committed by Trond Myklebust

SUNRPC: parametrize rpc_parse_scope_id() by network context

Parametrize rpc_parse_scope_id() by network context and thus force it's caller
to pass in network context instead of using hard-coded "init_net".
Signed-off-by: default avatarStanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent f7a30c18
...@@ -156,8 +156,9 @@ static size_t rpc_pton4(const char *buf, const size_t buflen, ...@@ -156,8 +156,9 @@ static size_t rpc_pton4(const char *buf, const size_t buflen,
} }
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
static int rpc_parse_scope_id(const char *buf, const size_t buflen, static int rpc_parse_scope_id(struct net *net, const char *buf,
const char *delim, struct sockaddr_in6 *sin6) const size_t buflen, const char *delim,
struct sockaddr_in6 *sin6)
{ {
char *p; char *p;
size_t len; size_t len;
...@@ -177,7 +178,7 @@ static int rpc_parse_scope_id(const char *buf, const size_t buflen, ...@@ -177,7 +178,7 @@ static int rpc_parse_scope_id(const char *buf, const size_t buflen,
unsigned long scope_id = 0; unsigned long scope_id = 0;
struct net_device *dev; struct net_device *dev;
dev = dev_get_by_name(&init_net, p); dev = dev_get_by_name(net, p);
if (dev != NULL) { if (dev != NULL) {
scope_id = dev->ifindex; scope_id = dev->ifindex;
dev_put(dev); dev_put(dev);
...@@ -213,7 +214,7 @@ static size_t rpc_pton6(const char *buf, const size_t buflen, ...@@ -213,7 +214,7 @@ static size_t rpc_pton6(const char *buf, const size_t buflen,
if (in6_pton(buf, buflen, addr, IPV6_SCOPE_DELIMITER, &delim) == 0) if (in6_pton(buf, buflen, addr, IPV6_SCOPE_DELIMITER, &delim) == 0)
return 0; return 0;
if (!rpc_parse_scope_id(buf, buflen, delim, sin6)) if (!rpc_parse_scope_id(&init_net, buf, buflen, delim, sin6))
return 0; return 0;
sin6->sin6_family = AF_INET6; sin6->sin6_family = AF_INET6;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment