diff options
author | Denis V. Lunev <den@openvz.org> | 2008-01-31 21:47:40 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-31 22:28:39 -0500 |
commit | 4b8aa9abee2e108b132dea7a7c4e81a167895354 (patch) | |
tree | 892d1380ae4a6566932903ddc6c167fc7ecefc7d /net | |
parent | 7b2185747c32260a3e43b94812e96d22a8725f09 (diff) |
[NETNS]: Process interface address manipulation routines in the namespace.
The namespace is available when required except rtm_to_ifaddr. Add
namespace argument to it.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/devinet.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 3376d635c847..f282b26f63eb 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -485,7 +485,7 @@ errout: | |||
485 | return err; | 485 | return err; |
486 | } | 486 | } |
487 | 487 | ||
488 | static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh) | 488 | static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh) |
489 | { | 489 | { |
490 | struct nlattr *tb[IFA_MAX+1]; | 490 | struct nlattr *tb[IFA_MAX+1]; |
491 | struct in_ifaddr *ifa; | 491 | struct in_ifaddr *ifa; |
@@ -503,7 +503,7 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh) | |||
503 | if (ifm->ifa_prefixlen > 32 || tb[IFA_LOCAL] == NULL) | 503 | if (ifm->ifa_prefixlen > 32 || tb[IFA_LOCAL] == NULL) |
504 | goto errout; | 504 | goto errout; |
505 | 505 | ||
506 | dev = __dev_get_by_index(&init_net, ifm->ifa_index); | 506 | dev = __dev_get_by_index(net, ifm->ifa_index); |
507 | err = -ENODEV; | 507 | err = -ENODEV; |
508 | if (dev == NULL) | 508 | if (dev == NULL) |
509 | goto errout; | 509 | goto errout; |
@@ -563,7 +563,7 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg | |||
563 | if (net != &init_net) | 563 | if (net != &init_net) |
564 | return -EINVAL; | 564 | return -EINVAL; |
565 | 565 | ||
566 | ifa = rtm_to_ifaddr(nlh); | 566 | ifa = rtm_to_ifaddr(net, nlh); |
567 | if (IS_ERR(ifa)) | 567 | if (IS_ERR(ifa)) |
568 | return PTR_ERR(ifa); | 568 | return PTR_ERR(ifa); |
569 | 569 | ||
@@ -1177,7 +1177,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) | |||
1177 | 1177 | ||
1178 | s_ip_idx = ip_idx = cb->args[1]; | 1178 | s_ip_idx = ip_idx = cb->args[1]; |
1179 | idx = 0; | 1179 | idx = 0; |
1180 | for_each_netdev(&init_net, dev) { | 1180 | for_each_netdev(net, dev) { |
1181 | if (idx < s_idx) | 1181 | if (idx < s_idx) |
1182 | goto cont; | 1182 | goto cont; |
1183 | if (idx > s_idx) | 1183 | if (idx > s_idx) |
@@ -1211,7 +1211,9 @@ static void rtmsg_ifa(int event, struct in_ifaddr* ifa, struct nlmsghdr *nlh, | |||
1211 | struct sk_buff *skb; | 1211 | struct sk_buff *skb; |
1212 | u32 seq = nlh ? nlh->nlmsg_seq : 0; | 1212 | u32 seq = nlh ? nlh->nlmsg_seq : 0; |
1213 | int err = -ENOBUFS; | 1213 | int err = -ENOBUFS; |
1214 | struct net *net; | ||
1214 | 1215 | ||
1216 | net = ifa->ifa_dev->dev->nd_net; | ||
1215 | skb = nlmsg_new(inet_nlmsg_size(), GFP_KERNEL); | 1217 | skb = nlmsg_new(inet_nlmsg_size(), GFP_KERNEL); |
1216 | if (skb == NULL) | 1218 | if (skb == NULL) |
1217 | goto errout; | 1219 | goto errout; |
@@ -1223,10 +1225,10 @@ static void rtmsg_ifa(int event, struct in_ifaddr* ifa, struct nlmsghdr *nlh, | |||
1223 | kfree_skb(skb); | 1225 | kfree_skb(skb); |
1224 | goto errout; | 1226 | goto errout; |
1225 | } | 1227 | } |
1226 | err = rtnl_notify(skb, &init_net, pid, RTNLGRP_IPV4_IFADDR, nlh, GFP_KERNEL); | 1228 | err = rtnl_notify(skb, net, pid, RTNLGRP_IPV4_IFADDR, nlh, GFP_KERNEL); |
1227 | errout: | 1229 | errout: |
1228 | if (err < 0) | 1230 | if (err < 0) |
1229 | rtnl_set_sk_err(&init_net, RTNLGRP_IPV4_IFADDR, err); | 1231 | rtnl_set_sk_err(net, RTNLGRP_IPV4_IFADDR, err); |
1230 | } | 1232 | } |
1231 | 1233 | ||
1232 | #ifdef CONFIG_SYSCTL | 1234 | #ifdef CONFIG_SYSCTL |