提交 352114f3 编写于 作者: P Pavel Emelyanov 提交者: J. Bruce Fields

sunrpc: Add net to pure API calls

There are two calls that operate on ip_map_cache and are
directly called from the nfsd code. Other places will be
handled in a different way.
Signed-off-by: NPavel Emelyanov <xemul@openvz.org>
Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
上级 3be4479f
...@@ -1593,7 +1593,7 @@ exp_addclient(struct nfsctl_client *ncp) ...@@ -1593,7 +1593,7 @@ exp_addclient(struct nfsctl_client *ncp)
/* Insert client into hashtable. */ /* Insert client into hashtable. */
for (i = 0; i < ncp->cl_naddr; i++) { for (i = 0; i < ncp->cl_naddr; i++) {
ipv6_addr_set_v4mapped(ncp->cl_addrlist[i].s_addr, &addr6); ipv6_addr_set_v4mapped(ncp->cl_addrlist[i].s_addr, &addr6);
auth_unix_add_addr(&addr6, dom); auth_unix_add_addr(&init_net, &addr6, dom);
} }
auth_unix_forget_old(dom); auth_unix_forget_old(dom);
auth_domain_put(dom); auth_domain_put(dom);
......
...@@ -416,7 +416,7 @@ static ssize_t write_getfs(struct file *file, char *buf, size_t size) ...@@ -416,7 +416,7 @@ static ssize_t write_getfs(struct file *file, char *buf, size_t size)
ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6); ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6);
clp = auth_unix_lookup(&in6); clp = auth_unix_lookup(&init_net, &in6);
if (!clp) if (!clp)
err = -EPERM; err = -EPERM;
else { else {
...@@ -479,7 +479,7 @@ static ssize_t write_getfd(struct file *file, char *buf, size_t size) ...@@ -479,7 +479,7 @@ static ssize_t write_getfd(struct file *file, char *buf, size_t size)
ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6); ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6);
clp = auth_unix_lookup(&in6); clp = auth_unix_lookup(&init_net, &in6);
if (!clp) if (!clp)
err = -EPERM; err = -EPERM;
else { else {
......
...@@ -126,10 +126,10 @@ extern void svc_auth_unregister(rpc_authflavor_t flavor); ...@@ -126,10 +126,10 @@ extern void svc_auth_unregister(rpc_authflavor_t flavor);
extern struct auth_domain *unix_domain_find(char *name); extern struct auth_domain *unix_domain_find(char *name);
extern void auth_domain_put(struct auth_domain *item); extern void auth_domain_put(struct auth_domain *item);
extern int auth_unix_add_addr(struct in6_addr *addr, struct auth_domain *dom); extern int auth_unix_add_addr(struct net *net, struct in6_addr *addr, struct auth_domain *dom);
extern struct auth_domain *auth_domain_lookup(char *name, struct auth_domain *new); extern struct auth_domain *auth_domain_lookup(char *name, struct auth_domain *new);
extern struct auth_domain *auth_domain_find(char *name); extern struct auth_domain *auth_domain_find(char *name);
extern struct auth_domain *auth_unix_lookup(struct in6_addr *addr); extern struct auth_domain *auth_unix_lookup(struct net *net, struct in6_addr *addr);
extern int auth_unix_forget_old(struct auth_domain *dom); extern int auth_unix_forget_old(struct auth_domain *dom);
extern void svcauth_unix_purge(void); extern void svcauth_unix_purge(void);
extern void svcauth_unix_info_release(struct svc_xprt *xpt); extern void svcauth_unix_info_release(struct svc_xprt *xpt);
......
...@@ -327,7 +327,8 @@ static struct ip_map *__ip_map_lookup(struct cache_detail *cd, char *class, ...@@ -327,7 +327,8 @@ static struct ip_map *__ip_map_lookup(struct cache_detail *cd, char *class,
return NULL; return NULL;
} }
static inline struct ip_map *ip_map_lookup(char *class, struct in6_addr *addr) static inline struct ip_map *ip_map_lookup(struct net *net, char *class,
struct in6_addr *addr)
{ {
return __ip_map_lookup(&ip_map_cache, class, addr); return __ip_map_lookup(&ip_map_cache, class, addr);
} }
...@@ -360,12 +361,13 @@ static int __ip_map_update(struct cache_detail *cd, struct ip_map *ipm, ...@@ -360,12 +361,13 @@ static int __ip_map_update(struct cache_detail *cd, struct ip_map *ipm,
return 0; return 0;
} }
static inline int ip_map_update(struct ip_map *ipm, struct unix_domain *udom, time_t expiry) static inline int ip_map_update(struct net *net, struct ip_map *ipm,
struct unix_domain *udom, time_t expiry)
{ {
return __ip_map_update(&ip_map_cache, ipm, udom, expiry); return __ip_map_update(&ip_map_cache, ipm, udom, expiry);
} }
int auth_unix_add_addr(struct in6_addr *addr, struct auth_domain *dom) int auth_unix_add_addr(struct net *net, struct in6_addr *addr, struct auth_domain *dom)
{ {
struct unix_domain *udom; struct unix_domain *udom;
struct ip_map *ipmp; struct ip_map *ipmp;
...@@ -373,10 +375,10 @@ int auth_unix_add_addr(struct in6_addr *addr, struct auth_domain *dom) ...@@ -373,10 +375,10 @@ int auth_unix_add_addr(struct in6_addr *addr, struct auth_domain *dom)
if (dom->flavour != &svcauth_unix) if (dom->flavour != &svcauth_unix)
return -EINVAL; return -EINVAL;
udom = container_of(dom, struct unix_domain, h); udom = container_of(dom, struct unix_domain, h);
ipmp = ip_map_lookup("nfsd", addr); ipmp = ip_map_lookup(net, "nfsd", addr);
if (ipmp) if (ipmp)
return ip_map_update(ipmp, udom, NEVER); return ip_map_update(net, ipmp, udom, NEVER);
else else
return -ENOMEM; return -ENOMEM;
} }
...@@ -394,12 +396,12 @@ int auth_unix_forget_old(struct auth_domain *dom) ...@@ -394,12 +396,12 @@ int auth_unix_forget_old(struct auth_domain *dom)
} }
EXPORT_SYMBOL_GPL(auth_unix_forget_old); EXPORT_SYMBOL_GPL(auth_unix_forget_old);
struct auth_domain *auth_unix_lookup(struct in6_addr *addr) struct auth_domain *auth_unix_lookup(struct net *net, struct in6_addr *addr)
{ {
struct ip_map *ipm; struct ip_map *ipm;
struct auth_domain *rv; struct auth_domain *rv;
ipm = ip_map_lookup("nfsd", addr); ipm = ip_map_lookup(net, "nfsd", addr);
if (!ipm) if (!ipm)
return NULL; return NULL;
...@@ -725,7 +727,7 @@ svcauth_unix_set_client(struct svc_rqst *rqstp) ...@@ -725,7 +727,7 @@ svcauth_unix_set_client(struct svc_rqst *rqstp)
ipm = ip_map_cached_get(xprt); ipm = ip_map_cached_get(xprt);
if (ipm == NULL) if (ipm == NULL)
ipm = ip_map_lookup(rqstp->rq_server->sv_program->pg_class, ipm = ip_map_lookup(&init_net, rqstp->rq_server->sv_program->pg_class,
&sin6->sin6_addr); &sin6->sin6_addr);
if (ipm == NULL) if (ipm == NULL)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册