diff options
-rw-r--r-- | include/linux/inetdevice.h | 2 | ||||
-rw-r--r-- | net/ipv4/devinet.c | 6 | ||||
-rw-r--r-- | net/ipv4/fib_semantics.c | 2 | ||||
-rw-r--r-- | net/ipv4/igmp.c | 4 | ||||
-rw-r--r-- | net/ipv4/ip_gre.c | 3 |
5 files changed, 9 insertions, 8 deletions
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index 45f373107530..e74a2ee8ee2a 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
@@ -133,7 +133,7 @@ extern struct net_device *ip_dev_find(__be32 addr); | |||
133 | extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); | 133 | extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); |
134 | extern int devinet_ioctl(unsigned int cmd, void __user *); | 134 | extern int devinet_ioctl(unsigned int cmd, void __user *); |
135 | extern void devinet_init(void); | 135 | extern void devinet_init(void); |
136 | extern struct in_device *inetdev_by_index(int); | 136 | extern struct in_device *inetdev_by_index(struct net *, int); |
137 | extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope); | 137 | extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope); |
138 | extern __be32 inet_confirm_addr(struct in_device *in_dev, __be32 dst, __be32 local, int scope); | 138 | extern __be32 inet_confirm_addr(struct in_device *in_dev, __be32 dst, __be32 local, int scope); |
139 | extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask); | 139 | extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask); |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index e381edb19b23..21f71bf912d5 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -409,12 +409,12 @@ static int inet_set_ifa(struct net_device *dev, struct in_ifaddr *ifa) | |||
409 | return inet_insert_ifa(ifa); | 409 | return inet_insert_ifa(ifa); |
410 | } | 410 | } |
411 | 411 | ||
412 | struct in_device *inetdev_by_index(int ifindex) | 412 | struct in_device *inetdev_by_index(struct net *net, int ifindex) |
413 | { | 413 | { |
414 | struct net_device *dev; | 414 | struct net_device *dev; |
415 | struct in_device *in_dev = NULL; | 415 | struct in_device *in_dev = NULL; |
416 | read_lock(&dev_base_lock); | 416 | read_lock(&dev_base_lock); |
417 | dev = __dev_get_by_index(&init_net, ifindex); | 417 | dev = __dev_get_by_index(net, ifindex); |
418 | if (dev) | 418 | if (dev) |
419 | in_dev = in_dev_get(dev); | 419 | in_dev = in_dev_get(dev); |
420 | read_unlock(&dev_base_lock); | 420 | read_unlock(&dev_base_lock); |
@@ -454,7 +454,7 @@ static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg | |||
454 | goto errout; | 454 | goto errout; |
455 | 455 | ||
456 | ifm = nlmsg_data(nlh); | 456 | ifm = nlmsg_data(nlh); |
457 | in_dev = inetdev_by_index(ifm->ifa_index); | 457 | in_dev = inetdev_by_index(net, ifm->ifa_index); |
458 | if (in_dev == NULL) { | 458 | if (in_dev == NULL) { |
459 | err = -ENODEV; | 459 | err = -ENODEV; |
460 | goto errout; | 460 | goto errout; |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index ecd91c60975f..8b47e112ae5c 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -583,7 +583,7 @@ out: | |||
583 | if (nh->nh_flags&(RTNH_F_PERVASIVE|RTNH_F_ONLINK)) | 583 | if (nh->nh_flags&(RTNH_F_PERVASIVE|RTNH_F_ONLINK)) |
584 | return -EINVAL; | 584 | return -EINVAL; |
585 | 585 | ||
586 | in_dev = inetdev_by_index(nh->nh_oif); | 586 | in_dev = inetdev_by_index(&init_net, nh->nh_oif); |
587 | if (in_dev == NULL) | 587 | if (in_dev == NULL) |
588 | return -ENODEV; | 588 | return -ENODEV; |
589 | if (!(in_dev->dev->flags&IFF_UP)) { | 589 | if (!(in_dev->dev->flags&IFF_UP)) { |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 016cfdb184f3..928bc3284554 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -1389,7 +1389,7 @@ static struct in_device * ip_mc_find_dev(struct ip_mreqn *imr) | |||
1389 | struct in_device *idev = NULL; | 1389 | struct in_device *idev = NULL; |
1390 | 1390 | ||
1391 | if (imr->imr_ifindex) { | 1391 | if (imr->imr_ifindex) { |
1392 | idev = inetdev_by_index(imr->imr_ifindex); | 1392 | idev = inetdev_by_index(&init_net, imr->imr_ifindex); |
1393 | if (idev) | 1393 | if (idev) |
1394 | __in_dev_put(idev); | 1394 | __in_dev_put(idev); |
1395 | return idev; | 1395 | return idev; |
@@ -2222,7 +2222,7 @@ void ip_mc_drop_socket(struct sock *sk) | |||
2222 | struct in_device *in_dev; | 2222 | struct in_device *in_dev; |
2223 | inet->mc_list = iml->next; | 2223 | inet->mc_list = iml->next; |
2224 | 2224 | ||
2225 | in_dev = inetdev_by_index(iml->multi.imr_ifindex); | 2225 | in_dev = inetdev_by_index(&init_net, iml->multi.imr_ifindex); |
2226 | (void) ip_mc_leave_src(sk, iml, in_dev); | 2226 | (void) ip_mc_leave_src(sk, iml, in_dev); |
2227 | if (in_dev != NULL) { | 2227 | if (in_dev != NULL) { |
2228 | ip_mc_dec_group(in_dev, iml->multi.imr_multiaddr.s_addr); | 2228 | ip_mc_dec_group(in_dev, iml->multi.imr_multiaddr.s_addr); |
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 8b81deb8ff1f..a74983d8c89c 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -1193,7 +1193,8 @@ static int ipgre_close(struct net_device *dev) | |||
1193 | { | 1193 | { |
1194 | struct ip_tunnel *t = netdev_priv(dev); | 1194 | struct ip_tunnel *t = netdev_priv(dev); |
1195 | if (ipv4_is_multicast(t->parms.iph.daddr) && t->mlink) { | 1195 | if (ipv4_is_multicast(t->parms.iph.daddr) && t->mlink) { |
1196 | struct in_device *in_dev = inetdev_by_index(t->mlink); | 1196 | struct in_device *in_dev; |
1197 | in_dev = inetdev_by_index(dev->nd_net, t->mlink); | ||
1197 | if (in_dev) { | 1198 | if (in_dev) { |
1198 | ip_mc_dec_group(in_dev, t->parms.iph.daddr); | 1199 | ip_mc_dec_group(in_dev, t->parms.iph.daddr); |
1199 | in_dev_put(in_dev); | 1200 | in_dev_put(in_dev); |