aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-01-21 20:32:38 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:10:20 -0500
commit7fee0ca23711ce1a6b13d3ab78915809a72a59ec (patch)
treee2df8e3997d996749b5169df59a56f3df67158c5 /net/ipv4
parentda0e28cb68a7e22b47c6ae1a5b12cb538c13c69f (diff)
[NETNS]: Add netns parameter to inetdev_by_index.
Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/devinet.c6
-rw-r--r--net/ipv4/fib_semantics.c2
-rw-r--r--net/ipv4/igmp.c4
-rw-r--r--net/ipv4/ip_gre.c3
4 files changed, 8 insertions, 7 deletions
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
412struct in_device *inetdev_by_index(int ifindex) 412struct 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);