aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
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/ipv4
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/ipv4')
-rw-r--r--net/ipv4/arp.c4
-rw-r--r--net/ipv4/devinet.c18
-rw-r--r--net/ipv4/fib_frontend.c2
-rw-r--r--net/ipv4/fib_semantics.c4
-rw-r--r--net/ipv4/icmp.c2
-rw-r--r--net/ipv4/igmp.c4
-rw-r--r--net/ipv4/ip_fragment.c2
-rw-r--r--net/ipv4/ip_gre.c4
-rw-r--r--net/ipv4/ip_sockglue.c2
-rw-r--r--net/ipv4/ipconfig.c2
-rw-r--r--net/ipv4/ipip.c4
-rw-r--r--net/ipv4/ipmr.c4
-rw-r--r--net/ipv4/ipvs/ip_vs_sync.c10
-rw-r--r--net/ipv4/netfilter/ipt_CLUSTERIP.c2
-rw-r--r--net/ipv4/route.c4
15 files changed, 34 insertions, 34 deletions
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index a11e7a5c1da4..3a683006d761 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -981,7 +981,7 @@ static int arp_req_set(struct arpreq *r, struct net_device * dev)
981 if (mask && mask != htonl(0xFFFFFFFF)) 981 if (mask && mask != htonl(0xFFFFFFFF))
982 return -EINVAL; 982 return -EINVAL;
983 if (!dev && (r->arp_flags & ATF_COM)) { 983 if (!dev && (r->arp_flags & ATF_COM)) {
984 dev = dev_getbyhwaddr(r->arp_ha.sa_family, r->arp_ha.sa_data); 984 dev = dev_getbyhwaddr(&init_net, r->arp_ha.sa_family, r->arp_ha.sa_data);
985 if (!dev) 985 if (!dev)
986 return -ENODEV; 986 return -ENODEV;
987 } 987 }
@@ -1169,7 +1169,7 @@ int arp_ioctl(unsigned int cmd, void __user *arg)
1169 rtnl_lock(); 1169 rtnl_lock();
1170 if (r.arp_dev[0]) { 1170 if (r.arp_dev[0]) {
1171 err = -ENODEV; 1171 err = -ENODEV;
1172 if ((dev = __dev_get_by_name(r.arp_dev)) == NULL) 1172 if ((dev = __dev_get_by_name(&init_net, r.arp_dev)) == NULL)
1173 goto out; 1173 goto out;
1174 1174
1175 /* Mmmm... It is wrong... ARPHRD_NETROM==0 */ 1175 /* Mmmm... It is wrong... ARPHRD_NETROM==0 */
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index c5eb1a29a5cf..721b89b60963 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -420,7 +420,7 @@ struct in_device *inetdev_by_index(int ifindex)
420 struct net_device *dev; 420 struct net_device *dev;
421 struct in_device *in_dev = NULL; 421 struct in_device *in_dev = NULL;
422 read_lock(&dev_base_lock); 422 read_lock(&dev_base_lock);
423 dev = __dev_get_by_index(ifindex); 423 dev = __dev_get_by_index(&init_net, ifindex);
424 if (dev) 424 if (dev)
425 in_dev = in_dev_get(dev); 425 in_dev = in_dev_get(dev);
426 read_unlock(&dev_base_lock); 426 read_unlock(&dev_base_lock);
@@ -506,7 +506,7 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh)
506 goto errout; 506 goto errout;
507 } 507 }
508 508
509 dev = __dev_get_by_index(ifm->ifa_index); 509 dev = __dev_get_by_index(&init_net, ifm->ifa_index);
510 if (dev == NULL) { 510 if (dev == NULL) {
511 err = -ENODEV; 511 err = -ENODEV;
512 goto errout; 512 goto errout;
@@ -628,7 +628,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg)
628 *colon = 0; 628 *colon = 0;
629 629
630#ifdef CONFIG_KMOD 630#ifdef CONFIG_KMOD
631 dev_load(ifr.ifr_name); 631 dev_load(&init_net, ifr.ifr_name);
632#endif 632#endif
633 633
634 switch (cmd) { 634 switch (cmd) {
@@ -669,7 +669,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg)
669 rtnl_lock(); 669 rtnl_lock();
670 670
671 ret = -ENODEV; 671 ret = -ENODEV;
672 if ((dev = __dev_get_by_name(ifr.ifr_name)) == NULL) 672 if ((dev = __dev_get_by_name(&init_net, ifr.ifr_name)) == NULL)
673 goto done; 673 goto done;
674 674
675 if (colon) 675 if (colon)
@@ -909,7 +909,7 @@ no_in_dev:
909 */ 909 */
910 read_lock(&dev_base_lock); 910 read_lock(&dev_base_lock);
911 rcu_read_lock(); 911 rcu_read_lock();
912 for_each_netdev(dev) { 912 for_each_netdev(&init_net, dev) {
913 if ((in_dev = __in_dev_get_rcu(dev)) == NULL) 913 if ((in_dev = __in_dev_get_rcu(dev)) == NULL)
914 continue; 914 continue;
915 915
@@ -988,7 +988,7 @@ __be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local,
988 988
989 read_lock(&dev_base_lock); 989 read_lock(&dev_base_lock);
990 rcu_read_lock(); 990 rcu_read_lock();
991 for_each_netdev(dev) { 991 for_each_netdev(&init_net, dev) {
992 if ((in_dev = __in_dev_get_rcu(dev))) { 992 if ((in_dev = __in_dev_get_rcu(dev))) {
993 addr = confirm_addr_indev(in_dev, dst, local, scope); 993 addr = confirm_addr_indev(in_dev, dst, local, scope);
994 if (addr) 994 if (addr)
@@ -1185,7 +1185,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
1185 1185
1186 s_ip_idx = ip_idx = cb->args[1]; 1186 s_ip_idx = ip_idx = cb->args[1];
1187 idx = 0; 1187 idx = 0;
1188 for_each_netdev(dev) { 1188 for_each_netdev(&init_net, dev) {
1189 if (idx < s_idx) 1189 if (idx < s_idx)
1190 goto cont; 1190 goto cont;
1191 if (idx > s_idx) 1191 if (idx > s_idx)
@@ -1244,7 +1244,7 @@ static void devinet_copy_dflt_conf(int i)
1244 struct net_device *dev; 1244 struct net_device *dev;
1245 1245
1246 read_lock(&dev_base_lock); 1246 read_lock(&dev_base_lock);
1247 for_each_netdev(dev) { 1247 for_each_netdev(&init_net, dev) {
1248 struct in_device *in_dev; 1248 struct in_device *in_dev;
1249 rcu_read_lock(); 1249 rcu_read_lock();
1250 in_dev = __in_dev_get_rcu(dev); 1250 in_dev = __in_dev_get_rcu(dev);
@@ -1333,7 +1333,7 @@ void inet_forward_change(void)
1333 IPV4_DEVCONF_DFLT(FORWARDING) = on; 1333 IPV4_DEVCONF_DFLT(FORWARDING) = on;
1334 1334
1335 read_lock(&dev_base_lock); 1335 read_lock(&dev_base_lock);
1336 for_each_netdev(dev) { 1336 for_each_netdev(&init_net, dev) {
1337 struct in_device *in_dev; 1337 struct in_device *in_dev;
1338 rcu_read_lock(); 1338 rcu_read_lock();
1339 in_dev = __in_dev_get_rcu(dev); 1339 in_dev = __in_dev_get_rcu(dev);
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 140bf7a8d877..df17aab193b4 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -334,7 +334,7 @@ static int rtentry_to_fib_config(int cmd, struct rtentry *rt,
334 colon = strchr(devname, ':'); 334 colon = strchr(devname, ':');
335 if (colon) 335 if (colon)
336 *colon = 0; 336 *colon = 0;
337 dev = __dev_get_by_name(devname); 337 dev = __dev_get_by_name(&init_net, devname);
338 if (!dev) 338 if (!dev)
339 return -ENODEV; 339 return -ENODEV;
340 cfg->fc_oif = dev->ifindex; 340 cfg->fc_oif = dev->ifindex;
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index c434119deb52..d30fb68d5f4e 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -533,7 +533,7 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi,
533 return -EINVAL; 533 return -EINVAL;
534 if (inet_addr_type(nh->nh_gw) != RTN_UNICAST) 534 if (inet_addr_type(nh->nh_gw) != RTN_UNICAST)
535 return -EINVAL; 535 return -EINVAL;
536 if ((dev = __dev_get_by_index(nh->nh_oif)) == NULL) 536 if ((dev = __dev_get_by_index(&init_net, nh->nh_oif)) == NULL)
537 return -ENODEV; 537 return -ENODEV;
538 if (!(dev->flags&IFF_UP)) 538 if (!(dev->flags&IFF_UP))
539 return -ENETDOWN; 539 return -ENETDOWN;
@@ -799,7 +799,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
799 if (nhs != 1 || nh->nh_gw) 799 if (nhs != 1 || nh->nh_gw)
800 goto err_inval; 800 goto err_inval;
801 nh->nh_scope = RT_SCOPE_NOWHERE; 801 nh->nh_scope = RT_SCOPE_NOWHERE;
802 nh->nh_dev = dev_get_by_index(fi->fib_nh->nh_oif); 802 nh->nh_dev = dev_get_by_index(&init_net, fi->fib_nh->nh_oif);
803 err = -ENODEV; 803 err = -ENODEV;
804 if (nh->nh_dev == NULL) 804 if (nh->nh_dev == NULL)
805 goto failure; 805 goto failure;
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 02a899bec196..68a22670f597 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -517,7 +517,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
517 struct net_device *dev = NULL; 517 struct net_device *dev = NULL;
518 518
519 if (rt->fl.iif && sysctl_icmp_errors_use_inbound_ifaddr) 519 if (rt->fl.iif && sysctl_icmp_errors_use_inbound_ifaddr)
520 dev = dev_get_by_index(rt->fl.iif); 520 dev = dev_get_by_index(&init_net, rt->fl.iif);
521 521
522 if (dev) { 522 if (dev) {
523 saddr = inet_select_addr(dev, 0, RT_SCOPE_LINK); 523 saddr = inet_select_addr(dev, 0, RT_SCOPE_LINK);
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index d78599a9dbd5..ad500a43b359 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -2292,7 +2292,7 @@ static inline struct ip_mc_list *igmp_mc_get_first(struct seq_file *seq)
2292 struct igmp_mc_iter_state *state = igmp_mc_seq_private(seq); 2292 struct igmp_mc_iter_state *state = igmp_mc_seq_private(seq);
2293 2293
2294 state->in_dev = NULL; 2294 state->in_dev = NULL;
2295 for_each_netdev(state->dev) { 2295 for_each_netdev(&init_net, state->dev) {
2296 struct in_device *in_dev; 2296 struct in_device *in_dev;
2297 in_dev = in_dev_get(state->dev); 2297 in_dev = in_dev_get(state->dev);
2298 if (!in_dev) 2298 if (!in_dev)
@@ -2454,7 +2454,7 @@ static inline struct ip_sf_list *igmp_mcf_get_first(struct seq_file *seq)
2454 2454
2455 state->idev = NULL; 2455 state->idev = NULL;
2456 state->im = NULL; 2456 state->im = NULL;
2457 for_each_netdev(state->dev) { 2457 for_each_netdev(&init_net, state->dev) {
2458 struct in_device *idev; 2458 struct in_device *idev;
2459 idev = in_dev_get(state->dev); 2459 idev = in_dev_get(state->dev);
2460 if (unlikely(idev == NULL)) 2460 if (unlikely(idev == NULL))
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 0231bdcb2ab7..fabb86db763b 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -292,7 +292,7 @@ static void ip_expire(unsigned long arg)
292 if ((qp->last_in&FIRST_IN) && qp->fragments != NULL) { 292 if ((qp->last_in&FIRST_IN) && qp->fragments != NULL) {
293 struct sk_buff *head = qp->fragments; 293 struct sk_buff *head = qp->fragments;
294 /* Send an ICMP "Fragment Reassembly Timeout" message. */ 294 /* Send an ICMP "Fragment Reassembly Timeout" message. */
295 if ((head->dev = dev_get_by_index(qp->iif)) != NULL) { 295 if ((head->dev = dev_get_by_index(&init_net, qp->iif)) != NULL) {
296 icmp_send(head, ICMP_TIME_EXCEEDED, ICMP_EXC_FRAGTIME, 0); 296 icmp_send(head, ICMP_TIME_EXCEEDED, ICMP_EXC_FRAGTIME, 0);
297 dev_put(head->dev); 297 dev_put(head->dev);
298 } 298 }
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 5c14ed63e56c..3106225c5e50 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -262,7 +262,7 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int
262 int i; 262 int i;
263 for (i=1; i<100; i++) { 263 for (i=1; i<100; i++) {
264 sprintf(name, "gre%d", i); 264 sprintf(name, "gre%d", i);
265 if (__dev_get_by_name(name) == NULL) 265 if (__dev_get_by_name(&init_net, name) == NULL)
266 break; 266 break;
267 } 267 }
268 if (i==100) 268 if (i==100)
@@ -1196,7 +1196,7 @@ static int ipgre_tunnel_init(struct net_device *dev)
1196 } 1196 }
1197 1197
1198 if (!tdev && tunnel->parms.link) 1198 if (!tdev && tunnel->parms.link)
1199 tdev = __dev_get_by_index(tunnel->parms.link); 1199 tdev = __dev_get_by_index(&init_net, tunnel->parms.link);
1200 1200
1201 if (tdev) { 1201 if (tdev) {
1202 hlen = tdev->hard_header_len; 1202 hlen = tdev->hard_header_len;
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 6b420aedcdcf..b2b3053dfef7 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -602,7 +602,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
602 dev_put(dev); 602 dev_put(dev);
603 } 603 }
604 } else 604 } else
605 dev = __dev_get_by_index(mreq.imr_ifindex); 605 dev = __dev_get_by_index(&init_net, mreq.imr_ifindex);
606 606
607 607
608 err = -EADDRNOTAVAIL; 608 err = -EADDRNOTAVAIL;
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 08ff623371f0..4303851749f6 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -193,7 +193,7 @@ static int __init ic_open_devs(void)
193 if (dev_change_flags(&loopback_dev, loopback_dev.flags | IFF_UP) < 0) 193 if (dev_change_flags(&loopback_dev, loopback_dev.flags | IFF_UP) < 0)
194 printk(KERN_ERR "IP-Config: Failed to open %s\n", loopback_dev.name); 194 printk(KERN_ERR "IP-Config: Failed to open %s\n", loopback_dev.name);
195 195
196 for_each_netdev(dev) { 196 for_each_netdev(&init_net, dev) {
197 if (dev == &loopback_dev) 197 if (dev == &loopback_dev)
198 continue; 198 continue;
199 if (user_dev_name[0] ? !strcmp(dev->name, user_dev_name) : 199 if (user_dev_name[0] ? !strcmp(dev->name, user_dev_name) :
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 396437242a1b..652bd86e33a3 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -225,7 +225,7 @@ static struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int c
225 int i; 225 int i;
226 for (i=1; i<100; i++) { 226 for (i=1; i<100; i++) {
227 sprintf(name, "tunl%d", i); 227 sprintf(name, "tunl%d", i);
228 if (__dev_get_by_name(name) == NULL) 228 if (__dev_get_by_name(&init_net, name) == NULL)
229 break; 229 break;
230 } 230 }
231 if (i==100) 231 if (i==100)
@@ -822,7 +822,7 @@ static int ipip_tunnel_init(struct net_device *dev)
822 } 822 }
823 823
824 if (!tdev && tunnel->parms.link) 824 if (!tdev && tunnel->parms.link)
825 tdev = __dev_get_by_index(tunnel->parms.link); 825 tdev = __dev_get_by_index(&init_net, tunnel->parms.link);
826 826
827 if (tdev) { 827 if (tdev) {
828 dev->hard_header_len = tdev->hard_header_len + sizeof(struct iphdr); 828 dev->hard_header_len = tdev->hard_header_len + sizeof(struct iphdr);
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 036598835c63..b8b4b497fb57 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -125,7 +125,7 @@ struct net_device *ipmr_new_tunnel(struct vifctl *v)
125{ 125{
126 struct net_device *dev; 126 struct net_device *dev;
127 127
128 dev = __dev_get_by_name("tunl0"); 128 dev = __dev_get_by_name(&init_net, "tunl0");
129 129
130 if (dev) { 130 if (dev) {
131 int err; 131 int err;
@@ -149,7 +149,7 @@ struct net_device *ipmr_new_tunnel(struct vifctl *v)
149 149
150 dev = NULL; 150 dev = NULL;
151 151
152 if (err == 0 && (dev = __dev_get_by_name(p.name)) != NULL) { 152 if (err == 0 && (dev = __dev_get_by_name(&init_net, p.name)) != NULL) {
153 dev->flags |= IFF_MULTICAST; 153 dev->flags |= IFF_MULTICAST;
154 154
155 in_dev = __in_dev_get_rtnl(dev); 155 in_dev = __in_dev_get_rtnl(dev);
diff --git a/net/ipv4/ipvs/ip_vs_sync.c b/net/ipv4/ipvs/ip_vs_sync.c
index 356f067484e3..1960747f354c 100644
--- a/net/ipv4/ipvs/ip_vs_sync.c
+++ b/net/ipv4/ipvs/ip_vs_sync.c
@@ -387,7 +387,7 @@ static int set_mcast_if(struct sock *sk, char *ifname)
387 struct net_device *dev; 387 struct net_device *dev;
388 struct inet_sock *inet = inet_sk(sk); 388 struct inet_sock *inet = inet_sk(sk);
389 389
390 if ((dev = __dev_get_by_name(ifname)) == NULL) 390 if ((dev = __dev_get_by_name(&init_net, ifname)) == NULL)
391 return -ENODEV; 391 return -ENODEV;
392 392
393 if (sk->sk_bound_dev_if && dev->ifindex != sk->sk_bound_dev_if) 393 if (sk->sk_bound_dev_if && dev->ifindex != sk->sk_bound_dev_if)
@@ -412,7 +412,7 @@ static int set_sync_mesg_maxlen(int sync_state)
412 int num; 412 int num;
413 413
414 if (sync_state == IP_VS_STATE_MASTER) { 414 if (sync_state == IP_VS_STATE_MASTER) {
415 if ((dev = __dev_get_by_name(ip_vs_master_mcast_ifn)) == NULL) 415 if ((dev = __dev_get_by_name(&init_net, ip_vs_master_mcast_ifn)) == NULL)
416 return -ENODEV; 416 return -ENODEV;
417 417
418 num = (dev->mtu - sizeof(struct iphdr) - 418 num = (dev->mtu - sizeof(struct iphdr) -
@@ -423,7 +423,7 @@ static int set_sync_mesg_maxlen(int sync_state)
423 IP_VS_DBG(7, "setting the maximum length of sync sending " 423 IP_VS_DBG(7, "setting the maximum length of sync sending "
424 "message %d.\n", sync_send_mesg_maxlen); 424 "message %d.\n", sync_send_mesg_maxlen);
425 } else if (sync_state == IP_VS_STATE_BACKUP) { 425 } else if (sync_state == IP_VS_STATE_BACKUP) {
426 if ((dev = __dev_get_by_name(ip_vs_backup_mcast_ifn)) == NULL) 426 if ((dev = __dev_get_by_name(&init_net, ip_vs_backup_mcast_ifn)) == NULL)
427 return -ENODEV; 427 return -ENODEV;
428 428
429 sync_recv_mesg_maxlen = dev->mtu - 429 sync_recv_mesg_maxlen = dev->mtu -
@@ -451,7 +451,7 @@ join_mcast_group(struct sock *sk, struct in_addr *addr, char *ifname)
451 memset(&mreq, 0, sizeof(mreq)); 451 memset(&mreq, 0, sizeof(mreq));
452 memcpy(&mreq.imr_multiaddr, addr, sizeof(struct in_addr)); 452 memcpy(&mreq.imr_multiaddr, addr, sizeof(struct in_addr));
453 453
454 if ((dev = __dev_get_by_name(ifname)) == NULL) 454 if ((dev = __dev_get_by_name(&init_net, ifname)) == NULL)
455 return -ENODEV; 455 return -ENODEV;
456 if (sk->sk_bound_dev_if && dev->ifindex != sk->sk_bound_dev_if) 456 if (sk->sk_bound_dev_if && dev->ifindex != sk->sk_bound_dev_if)
457 return -EINVAL; 457 return -EINVAL;
@@ -472,7 +472,7 @@ static int bind_mcastif_addr(struct socket *sock, char *ifname)
472 __be32 addr; 472 __be32 addr;
473 struct sockaddr_in sin; 473 struct sockaddr_in sin;
474 474
475 if ((dev = __dev_get_by_name(ifname)) == NULL) 475 if ((dev = __dev_get_by_name(&init_net, ifname)) == NULL)
476 return -ENODEV; 476 return -ENODEV;
477 477
478 addr = inet_select_addr(dev, 0, RT_SCOPE_UNIVERSE); 478 addr = inet_select_addr(dev, 0, RT_SCOPE_UNIVERSE);
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index 50fc9e009fe4..27f14e1ebd8b 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -401,7 +401,7 @@ checkentry(const char *tablename,
401 return false; 401 return false;
402 } 402 }
403 403
404 dev = dev_get_by_name(e->ip.iniface); 404 dev = dev_get_by_name(&init_net, e->ip.iniface);
405 if (!dev) { 405 if (!dev) {
406 printk(KERN_WARNING "CLUSTERIP: no such interface %s\n", e->ip.iniface); 406 printk(KERN_WARNING "CLUSTERIP: no such interface %s\n", e->ip.iniface);
407 return false; 407 return false;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index efd2a9202d68..396c631166a4 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2213,7 +2213,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
2213 2213
2214 2214
2215 if (oldflp->oif) { 2215 if (oldflp->oif) {
2216 dev_out = dev_get_by_index(oldflp->oif); 2216 dev_out = dev_get_by_index(&init_net, oldflp->oif);
2217 err = -ENODEV; 2217 err = -ENODEV;
2218 if (dev_out == NULL) 2218 if (dev_out == NULL)
2219 goto out; 2219 goto out;
@@ -2592,7 +2592,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2592 if (iif) { 2592 if (iif) {
2593 struct net_device *dev; 2593 struct net_device *dev;
2594 2594
2595 dev = __dev_get_by_index(iif); 2595 dev = __dev_get_by_index(&init_net, iif);
2596 if (dev == NULL) { 2596 if (dev == NULL) {
2597 err = -ENODEV; 2597 err = -ENODEV;
2598 goto errout_free; 2598 goto errout_free;