[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1272034539-19899-4-git-send-email-danms@us.ibm.com>
Date: Fri, 23 Apr 2010 07:55:38 -0700
From: Dan Smith <danms@...ibm.com>
To: containers@...ts.osdl.org
Cc: netdev@...r.kernel.org
Subject: [PATCH 3/4] C/R: Make rtnl_open() and rtnl_do() take and pass a netns pointer
(also make rtnl_do() return negative or 0, not the message length)
Signed-off-by: Dan Smith <danms@...ibm.com>
---
net/checkpoint_dev.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/net/checkpoint_dev.c b/net/checkpoint_dev.c
index 2787892..df8b16a 100644
--- a/net/checkpoint_dev.c
+++ b/net/checkpoint_dev.c
@@ -107,12 +107,13 @@ static int __kern_dev_ioctl(struct net *net, unsigned int cmd, void *arg)
return ret;
}
-static struct socket *rtnl_open(void)
+static struct socket *rtnl_open(struct net *net)
{
struct socket *sock;
int ret;
- ret = sock_create(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE, &sock);
+ ret = sock_create_kern_net(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE,
+ net, &sock);
if (ret < 0)
return ERR_PTR(ret);
@@ -538,7 +539,7 @@ static struct sk_buff *del_link_msg(char *name)
return skb;
}
-static int rtnl_do(struct sk_buff *skb)
+static int rtnl_do(struct net *net, struct sk_buff *skb)
{
int ret = -ENOMEM;
struct socket *rtnl = NULL;
@@ -551,7 +552,7 @@ static int rtnl_do(struct sk_buff *skb)
kvec.iov_len = skb->len;
kvec.iov_base = skb->head;
- rtnl = rtnl_open();
+ rtnl = rtnl_open(net);
if (IS_ERR(rtnl)) {
ret = PTR_ERR(rtnl);
ckpt_debug("Unable to open rtnetlink socket: %i\n", ret);
@@ -570,7 +571,8 @@ static int rtnl_do(struct sk_buff *skb)
if (IS_ERR(nlh)) {
ret = PTR_ERR(nlh);
ckpt_debug("RTNETLINK said: %i\n", ret);
- }
+ } else
+ ret = 0;
out:
rtnl_close(rtnl);
kfree_skb(rskb);
@@ -590,7 +592,7 @@ static struct net_device *rtnl_newlink(new_link_fn fn, void *data, char *name)
return ERR_PTR(PTR_ERR(skb));
}
- ret = rtnl_do(skb);
+ ret = rtnl_do(current->nsproxy->net_ns, skb);
kfree_skb(skb);
if (ret < 0)
return ERR_PTR(ret);
@@ -610,7 +612,7 @@ static int rtnl_dellink(char *name)
return PTR_ERR(skb);
}
- ret = rtnl_do(skb);
+ ret = rtnl_do(current->nsproxy->net_ns, skb);
kfree_skb(skb);
return ret;
--
1.6.2.5
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists