aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/anycast.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2007-09-17 14:56:21 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:49:10 -0400
commit881d966b48b035ab3f3aeaae0f3d3f9b584f45b2 (patch)
treec579d59a4107cbbe9e2b85939bc0d496b815c887 /net/ipv6/anycast.c
parentb4b510290b056b86611757ce1175a230f1080f53 (diff)
[NET]: Make the device list and device lookups per namespace.
This patch makes most of the generic device layer network namespace safe. This patch makes dev_base_head a network namespace variable, and then it picks up a few associated variables. The functions: dev_getbyhwaddr dev_getfirsthwbytype dev_get_by_flags dev_get_by_name __dev_get_by_name dev_get_by_index __dev_get_by_index dev_ioctl dev_ethtool dev_load wireless_process_ioctl were modified to take a network namespace argument, and deal with it. vlan_ioctl_set and brioctl_set were modified so their hooks will receive a network namespace argument. So basically anthing in the core of the network stack that was affected to by the change of dev_base was modified to handle multiple network namespaces. The rest of the network stack was simply modified to explicitly use &init_net the initial network namespace. This can be fixed when those components of the network stack are modified to handle multiple network namespaces. For now the ifindex generator is left global. Fundametally ifindex numbers are per namespace, or else we will have corner case problems with migration when we get that far. At the same time there are assumptions in the network stack that the ifindex of a network device won't change. Making the ifindex number global seems a good compromise until the network stack can cope with ifindex changes when you change namespaces, and the like. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/anycast.c')
-rw-r--r--net/ipv6/anycast.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index 0bd665498d06..d407992c1481 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -112,10 +112,10 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, struct in6_addr *addr)
112 } else { 112 } else {
113 /* router, no matching interface: just pick one */ 113 /* router, no matching interface: just pick one */
114 114
115 dev = dev_get_by_flags(IFF_UP, IFF_UP|IFF_LOOPBACK); 115 dev = dev_get_by_flags(&init_net, IFF_UP, IFF_UP|IFF_LOOPBACK);
116 } 116 }
117 } else 117 } else
118 dev = dev_get_by_index(ifindex); 118 dev = dev_get_by_index(&init_net, ifindex);
119 119
120 if (dev == NULL) { 120 if (dev == NULL) {
121 err = -ENODEV; 121 err = -ENODEV;
@@ -196,7 +196,7 @@ int ipv6_sock_ac_drop(struct sock *sk, int ifindex, struct in6_addr *addr)
196 196
197 write_unlock_bh(&ipv6_sk_ac_lock); 197 write_unlock_bh(&ipv6_sk_ac_lock);
198 198
199 dev = dev_get_by_index(pac->acl_ifindex); 199 dev = dev_get_by_index(&init_net, pac->acl_ifindex);
200 if (dev) { 200 if (dev) {
201 ipv6_dev_ac_dec(dev, &pac->acl_addr); 201 ipv6_dev_ac_dec(dev, &pac->acl_addr);
202 dev_put(dev); 202 dev_put(dev);
@@ -224,7 +224,7 @@ void ipv6_sock_ac_close(struct sock *sk)
224 if (pac->acl_ifindex != prev_index) { 224 if (pac->acl_ifindex != prev_index) {
225 if (dev) 225 if (dev)
226 dev_put(dev); 226 dev_put(dev);
227 dev = dev_get_by_index(pac->acl_ifindex); 227 dev = dev_get_by_index(&init_net, pac->acl_ifindex);
228 prev_index = pac->acl_ifindex; 228 prev_index = pac->acl_ifindex;
229 } 229 }
230 if (dev) 230 if (dev)
@@ -429,7 +429,7 @@ int ipv6_chk_acast_addr(struct net_device *dev, struct in6_addr *addr)
429 if (dev) 429 if (dev)
430 return ipv6_chk_acast_dev(dev, addr); 430 return ipv6_chk_acast_dev(dev, addr);
431 read_lock(&dev_base_lock); 431 read_lock(&dev_base_lock);
432 for_each_netdev(dev) 432 for_each_netdev(&init_net, dev)
433 if (ipv6_chk_acast_dev(dev, addr)) { 433 if (ipv6_chk_acast_dev(dev, addr)) {
434 found = 1; 434 found = 1;
435 break; 435 break;
@@ -453,7 +453,7 @@ static inline struct ifacaddr6 *ac6_get_first(struct seq_file *seq)
453 struct ac6_iter_state *state = ac6_seq_private(seq); 453 struct ac6_iter_state *state = ac6_seq_private(seq);
454 454
455 state->idev = NULL; 455 state->idev = NULL;
456 for_each_netdev(state->dev) { 456 for_each_netdev(&init_net, state->dev) {
457 struct inet6_dev *idev; 457 struct inet6_dev *idev;
458 idev = in6_dev_get(state->dev); 458 idev = in6_dev_get(state->dev);
459 if (!idev) 459 if (!idev)