aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
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
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')
-rw-r--r--net/ipv6/addrconf.c28
-rw-r--r--net/ipv6/af_inet6.c2
-rw-r--r--net/ipv6/anycast.c12
-rw-r--r--net/ipv6/datagram.c2
-rw-r--r--net/ipv6/ip6_tunnel.c6
-rw-r--r--net/ipv6/ipv6_sockglue.c2
-rw-r--r--net/ipv6/mcast.c12
-rw-r--r--net/ipv6/raw.c2
-rw-r--r--net/ipv6/reassembly.c2
-rw-r--r--net/ipv6/route.c4
-rw-r--r--net/ipv6/sit.c4
11 files changed, 38 insertions, 38 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 1a6783646520..ee55be975407 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -450,7 +450,7 @@ static void addrconf_forward_change(void)
450 struct inet6_dev *idev; 450 struct inet6_dev *idev;
451 451
452 read_lock(&dev_base_lock); 452 read_lock(&dev_base_lock);
453 for_each_netdev(dev) { 453 for_each_netdev(&init_net, dev) {
454 rcu_read_lock(); 454 rcu_read_lock();
455 idev = __in6_dev_get(dev); 455 idev = __in6_dev_get(dev);
456 if (idev) { 456 if (idev) {
@@ -912,7 +912,7 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev,
912 read_lock(&dev_base_lock); 912 read_lock(&dev_base_lock);
913 rcu_read_lock(); 913 rcu_read_lock();
914 914
915 for_each_netdev(dev) { 915 for_each_netdev(&init_net, dev) {
916 struct inet6_dev *idev; 916 struct inet6_dev *idev;
917 struct inet6_ifaddr *ifa; 917 struct inet6_ifaddr *ifa;
918 918
@@ -1858,7 +1858,7 @@ int addrconf_set_dstaddr(void __user *arg)
1858 if (copy_from_user(&ireq, arg, sizeof(struct in6_ifreq))) 1858 if (copy_from_user(&ireq, arg, sizeof(struct in6_ifreq)))
1859 goto err_exit; 1859 goto err_exit;
1860 1860
1861 dev = __dev_get_by_index(ireq.ifr6_ifindex); 1861 dev = __dev_get_by_index(&init_net, ireq.ifr6_ifindex);
1862 1862
1863 err = -ENODEV; 1863 err = -ENODEV;
1864 if (dev == NULL) 1864 if (dev == NULL)
@@ -1889,7 +1889,7 @@ int addrconf_set_dstaddr(void __user *arg)
1889 1889
1890 if (err == 0) { 1890 if (err == 0) {
1891 err = -ENOBUFS; 1891 err = -ENOBUFS;
1892 if ((dev = __dev_get_by_name(p.name)) == NULL) 1892 if ((dev = __dev_get_by_name(&init_net, p.name)) == NULL)
1893 goto err_exit; 1893 goto err_exit;
1894 err = dev_open(dev); 1894 err = dev_open(dev);
1895 } 1895 }
@@ -1919,7 +1919,7 @@ static int inet6_addr_add(int ifindex, struct in6_addr *pfx, int plen,
1919 if (!valid_lft || prefered_lft > valid_lft) 1919 if (!valid_lft || prefered_lft > valid_lft)
1920 return -EINVAL; 1920 return -EINVAL;
1921 1921
1922 if ((dev = __dev_get_by_index(ifindex)) == NULL) 1922 if ((dev = __dev_get_by_index(&init_net, ifindex)) == NULL)
1923 return -ENODEV; 1923 return -ENODEV;
1924 1924
1925 if ((idev = addrconf_add_dev(dev)) == NULL) 1925 if ((idev = addrconf_add_dev(dev)) == NULL)
@@ -1970,7 +1970,7 @@ static int inet6_addr_del(int ifindex, struct in6_addr *pfx, int plen)
1970 struct inet6_dev *idev; 1970 struct inet6_dev *idev;
1971 struct net_device *dev; 1971 struct net_device *dev;
1972 1972
1973 if ((dev = __dev_get_by_index(ifindex)) == NULL) 1973 if ((dev = __dev_get_by_index(&init_net, ifindex)) == NULL)
1974 return -ENODEV; 1974 return -ENODEV;
1975 1975
1976 if ((idev = __in6_dev_get(dev)) == NULL) 1976 if ((idev = __in6_dev_get(dev)) == NULL)
@@ -2065,7 +2065,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
2065 return; 2065 return;
2066 } 2066 }
2067 2067
2068 for_each_netdev(dev) { 2068 for_each_netdev(&init_net, dev) {
2069 struct in_device * in_dev = __in_dev_get_rtnl(dev); 2069 struct in_device * in_dev = __in_dev_get_rtnl(dev);
2070 if (in_dev && (dev->flags & IFF_UP)) { 2070 if (in_dev && (dev->flags & IFF_UP)) {
2071 struct in_ifaddr * ifa; 2071 struct in_ifaddr * ifa;
@@ -2221,12 +2221,12 @@ static void ip6_tnl_add_linklocal(struct inet6_dev *idev)
2221 2221
2222 /* first try to inherit the link-local address from the link device */ 2222 /* first try to inherit the link-local address from the link device */
2223 if (idev->dev->iflink && 2223 if (idev->dev->iflink &&
2224 (link_dev = __dev_get_by_index(idev->dev->iflink))) { 2224 (link_dev = __dev_get_by_index(&init_net, idev->dev->iflink))) {
2225 if (!ipv6_inherit_linklocal(idev, link_dev)) 2225 if (!ipv6_inherit_linklocal(idev, link_dev))
2226 return; 2226 return;
2227 } 2227 }
2228 /* then try to inherit it from any device */ 2228 /* then try to inherit it from any device */
2229 for_each_netdev(link_dev) { 2229 for_each_netdev(&init_net, link_dev) {
2230 if (!ipv6_inherit_linklocal(idev, link_dev)) 2230 if (!ipv6_inherit_linklocal(idev, link_dev))
2231 return; 2231 return;
2232 } 2232 }
@@ -3084,7 +3084,7 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
3084 valid_lft = INFINITY_LIFE_TIME; 3084 valid_lft = INFINITY_LIFE_TIME;
3085 } 3085 }
3086 3086
3087 dev = __dev_get_by_index(ifm->ifa_index); 3087 dev = __dev_get_by_index(&init_net, ifm->ifa_index);
3088 if (dev == NULL) 3088 if (dev == NULL)
3089 return -ENODEV; 3089 return -ENODEV;
3090 3090
@@ -3268,7 +3268,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
3268 s_ip_idx = ip_idx = cb->args[1]; 3268 s_ip_idx = ip_idx = cb->args[1];
3269 3269
3270 idx = 0; 3270 idx = 0;
3271 for_each_netdev(dev) { 3271 for_each_netdev(&init_net, dev) {
3272 if (idx < s_idx) 3272 if (idx < s_idx)
3273 goto cont; 3273 goto cont;
3274 if (idx > s_idx) 3274 if (idx > s_idx)
@@ -3377,7 +3377,7 @@ static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr* nlh,
3377 3377
3378 ifm = nlmsg_data(nlh); 3378 ifm = nlmsg_data(nlh);
3379 if (ifm->ifa_index) 3379 if (ifm->ifa_index)
3380 dev = __dev_get_by_index(ifm->ifa_index); 3380 dev = __dev_get_by_index(&init_net, ifm->ifa_index);
3381 3381
3382 if ((ifa = ipv6_get_ifaddr(addr, dev, 1)) == NULL) { 3382 if ((ifa = ipv6_get_ifaddr(addr, dev, 1)) == NULL) {
3383 err = -EADDRNOTAVAIL; 3383 err = -EADDRNOTAVAIL;
@@ -3589,7 +3589,7 @@ static int inet6_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
3589 3589
3590 read_lock(&dev_base_lock); 3590 read_lock(&dev_base_lock);
3591 idx = 0; 3591 idx = 0;
3592 for_each_netdev(dev) { 3592 for_each_netdev(&init_net, dev) {
3593 if (idx < s_idx) 3593 if (idx < s_idx)
3594 goto cont; 3594 goto cont;
3595 if ((idev = in6_dev_get(dev)) == NULL) 3595 if ((idev = in6_dev_get(dev)) == NULL)
@@ -4266,7 +4266,7 @@ void __exit addrconf_cleanup(void)
4266 * clean dev list. 4266 * clean dev list.
4267 */ 4267 */
4268 4268
4269 for_each_netdev(dev) { 4269 for_each_netdev(&init_net, dev) {
4270 if (__in6_dev_get(dev) == NULL) 4270 if (__in6_dev_get(dev) == NULL)
4271 continue; 4271 continue;
4272 addrconf_ifdown(dev, 1); 4272 addrconf_ifdown(dev, 1);
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 21931c86e95b..e5c5aad44bb1 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -302,7 +302,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
302 err = -EINVAL; 302 err = -EINVAL;
303 goto out; 303 goto out;
304 } 304 }
305 dev = dev_get_by_index(sk->sk_bound_dev_if); 305 dev = dev_get_by_index(&init_net, sk->sk_bound_dev_if);
306 if (!dev) { 306 if (!dev) {
307 err = -ENODEV; 307 err = -ENODEV;
308 goto out; 308 goto out;
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)
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index fe0f49024a0a..2ed689ac449e 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -544,7 +544,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
544 if (!src_info->ipi6_ifindex) 544 if (!src_info->ipi6_ifindex)
545 return -EINVAL; 545 return -EINVAL;
546 else { 546 else {
547 dev = dev_get_by_index(src_info->ipi6_ifindex); 547 dev = dev_get_by_index(&init_net, src_info->ipi6_ifindex);
548 if (!dev) 548 if (!dev)
549 return -ENODEV; 549 return -ENODEV;
550 } 550 }
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index ca774d8e3be3..937625e577c1 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -235,7 +235,7 @@ static struct ip6_tnl *ip6_tnl_create(struct ip6_tnl_parm *p)
235 int i; 235 int i;
236 for (i = 1; i < IP6_TNL_MAX; i++) { 236 for (i = 1; i < IP6_TNL_MAX; i++) {
237 sprintf(name, "ip6tnl%d", i); 237 sprintf(name, "ip6tnl%d", i);
238 if (__dev_get_by_name(name) == NULL) 238 if (__dev_get_by_name(&init_net, name) == NULL)
239 break; 239 break;
240 } 240 }
241 if (i == IP6_TNL_MAX) 241 if (i == IP6_TNL_MAX)
@@ -650,7 +650,7 @@ static inline int ip6_tnl_rcv_ctl(struct ip6_tnl *t)
650 struct net_device *ldev = NULL; 650 struct net_device *ldev = NULL;
651 651
652 if (p->link) 652 if (p->link)
653 ldev = dev_get_by_index(p->link); 653 ldev = dev_get_by_index(&init_net, p->link);
654 654
655 if ((ipv6_addr_is_multicast(&p->laddr) || 655 if ((ipv6_addr_is_multicast(&p->laddr) ||
656 likely(ipv6_chk_addr(&p->laddr, ldev, 0))) && 656 likely(ipv6_chk_addr(&p->laddr, ldev, 0))) &&
@@ -786,7 +786,7 @@ static inline int ip6_tnl_xmit_ctl(struct ip6_tnl *t)
786 struct net_device *ldev = NULL; 786 struct net_device *ldev = NULL;
787 787
788 if (p->link) 788 if (p->link)
789 ldev = dev_get_by_index(p->link); 789 ldev = dev_get_by_index(&init_net, p->link);
790 790
791 if (unlikely(!ipv6_chk_addr(&p->laddr, ldev, 0))) 791 if (unlikely(!ipv6_chk_addr(&p->laddr, ldev, 0)))
792 printk(KERN_WARNING 792 printk(KERN_WARNING
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 74254fccbcc8..eb330a44bacd 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -542,7 +542,7 @@ done:
542 if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != val) 542 if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != val)
543 goto e_inval; 543 goto e_inval;
544 544
545 if (__dev_get_by_index(val) == NULL) { 545 if (__dev_get_by_index(&init_net, val) == NULL) {
546 retv = -ENODEV; 546 retv = -ENODEV;
547 break; 547 break;
548 } 548 }
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index a41d5a0b50cc..e2ab43c989d4 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -215,7 +215,7 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, struct in6_addr *addr)
215 dst_release(&rt->u.dst); 215 dst_release(&rt->u.dst);
216 } 216 }
217 } else 217 } else
218 dev = dev_get_by_index(ifindex); 218 dev = dev_get_by_index(&init_net, ifindex);
219 219
220 if (dev == NULL) { 220 if (dev == NULL) {
221 sock_kfree_s(sk, mc_lst, sizeof(*mc_lst)); 221 sock_kfree_s(sk, mc_lst, sizeof(*mc_lst));
@@ -266,7 +266,7 @@ int ipv6_sock_mc_drop(struct sock *sk, int ifindex, struct in6_addr *addr)
266 *lnk = mc_lst->next; 266 *lnk = mc_lst->next;
267 write_unlock_bh(&ipv6_sk_mc_lock); 267 write_unlock_bh(&ipv6_sk_mc_lock);
268 268
269 if ((dev = dev_get_by_index(mc_lst->ifindex)) != NULL) { 269 if ((dev = dev_get_by_index(&init_net, mc_lst->ifindex)) != NULL) {
270 struct inet6_dev *idev = in6_dev_get(dev); 270 struct inet6_dev *idev = in6_dev_get(dev);
271 271
272 (void) ip6_mc_leave_src(sk, mc_lst, idev); 272 (void) ip6_mc_leave_src(sk, mc_lst, idev);
@@ -301,7 +301,7 @@ static struct inet6_dev *ip6_mc_find_dev(struct in6_addr *group, int ifindex)
301 dst_release(&rt->u.dst); 301 dst_release(&rt->u.dst);
302 } 302 }
303 } else 303 } else
304 dev = dev_get_by_index(ifindex); 304 dev = dev_get_by_index(&init_net, ifindex);
305 305
306 if (!dev) 306 if (!dev)
307 return NULL; 307 return NULL;
@@ -332,7 +332,7 @@ void ipv6_sock_mc_close(struct sock *sk)
332 np->ipv6_mc_list = mc_lst->next; 332 np->ipv6_mc_list = mc_lst->next;
333 write_unlock_bh(&ipv6_sk_mc_lock); 333 write_unlock_bh(&ipv6_sk_mc_lock);
334 334
335 dev = dev_get_by_index(mc_lst->ifindex); 335 dev = dev_get_by_index(&init_net, mc_lst->ifindex);
336 if (dev) { 336 if (dev) {
337 struct inet6_dev *idev = in6_dev_get(dev); 337 struct inet6_dev *idev = in6_dev_get(dev);
338 338
@@ -2333,7 +2333,7 @@ static inline struct ifmcaddr6 *igmp6_mc_get_first(struct seq_file *seq)
2333 struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq); 2333 struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq);
2334 2334
2335 state->idev = NULL; 2335 state->idev = NULL;
2336 for_each_netdev(state->dev) { 2336 for_each_netdev(&init_net, state->dev) {
2337 struct inet6_dev *idev; 2337 struct inet6_dev *idev;
2338 idev = in6_dev_get(state->dev); 2338 idev = in6_dev_get(state->dev);
2339 if (!idev) 2339 if (!idev)
@@ -2477,7 +2477,7 @@ static inline struct ip6_sf_list *igmp6_mcf_get_first(struct seq_file *seq)
2477 2477
2478 state->idev = NULL; 2478 state->idev = NULL;
2479 state->im = NULL; 2479 state->im = NULL;
2480 for_each_netdev(state->dev) { 2480 for_each_netdev(&init_net, state->dev) {
2481 struct inet6_dev *idev; 2481 struct inet6_dev *idev;
2482 idev = in6_dev_get(state->dev); 2482 idev = in6_dev_get(state->dev);
2483 if (unlikely(idev == NULL)) 2483 if (unlikely(idev == NULL))
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 38a3d21c2585..bdd0974e6775 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -283,7 +283,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
283 if (!sk->sk_bound_dev_if) 283 if (!sk->sk_bound_dev_if)
284 goto out; 284 goto out;
285 285
286 dev = dev_get_by_index(sk->sk_bound_dev_if); 286 dev = dev_get_by_index(&init_net, sk->sk_bound_dev_if);
287 if (!dev) { 287 if (!dev) {
288 err = -ENODEV; 288 err = -ENODEV;
289 goto out; 289 goto out;
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index de795c04e34c..31601c993541 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -301,7 +301,7 @@ static void ip6_frag_expire(unsigned long data)
301 301
302 fq_kill(fq); 302 fq_kill(fq);
303 303
304 dev = dev_get_by_index(fq->iif); 304 dev = dev_get_by_index(&init_net, fq->iif);
305 if (!dev) 305 if (!dev)
306 goto out; 306 goto out;
307 307
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index f4f0c341e5c8..5bdd9d4010fe 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1130,7 +1130,7 @@ int ip6_route_add(struct fib6_config *cfg)
1130#endif 1130#endif
1131 if (cfg->fc_ifindex) { 1131 if (cfg->fc_ifindex) {
1132 err = -ENODEV; 1132 err = -ENODEV;
1133 dev = dev_get_by_index(cfg->fc_ifindex); 1133 dev = dev_get_by_index(&init_net, cfg->fc_ifindex);
1134 if (!dev) 1134 if (!dev)
1135 goto out; 1135 goto out;
1136 idev = in6_dev_get(dev); 1136 idev = in6_dev_get(dev);
@@ -2265,7 +2265,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2265 2265
2266 if (iif) { 2266 if (iif) {
2267 struct net_device *dev; 2267 struct net_device *dev;
2268 dev = __dev_get_by_index(iif); 2268 dev = __dev_get_by_index(&init_net, iif);
2269 if (!dev) { 2269 if (!dev) {
2270 err = -ENODEV; 2270 err = -ENODEV;
2271 goto errout; 2271 goto errout;
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index eb20bb690abd..e79f419b1731 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -167,7 +167,7 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int
167 int i; 167 int i;
168 for (i=1; i<100; i++) { 168 for (i=1; i<100; i++) {
169 sprintf(name, "sit%d", i); 169 sprintf(name, "sit%d", i);
170 if (__dev_get_by_name(name) == NULL) 170 if (__dev_get_by_name(&init_net, name) == NULL)
171 break; 171 break;
172 } 172 }
173 if (i==100) 173 if (i==100)
@@ -761,7 +761,7 @@ static int ipip6_tunnel_init(struct net_device *dev)
761 } 761 }
762 762
763 if (!tdev && tunnel->parms.link) 763 if (!tdev && tunnel->parms.link)
764 tdev = __dev_get_by_index(tunnel->parms.link); 764 tdev = __dev_get_by_index(&init_net, tunnel->parms.link);
765 765
766 if (tdev) { 766 if (tdev) {
767 dev->hard_header_len = tdev->hard_header_len + sizeof(struct iphdr); 767 dev->hard_header_len = tdev->hard_header_len + sizeof(struct iphdr);