aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-01-23 01:04:30 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:11:04 -0500
commit1ab352768fc73838b062776ca5d1add3876a019f (patch)
treeb30bd7744e30e90b6db01b71a5c8b86140538255 /net
parent010278ec4cdf404aefc0bbd5e7406674fec95286 (diff)
[NETNS]: Add namespace parameter to ip_dev_find.
in_dev_find() need a namespace to pass it to fib_get_table(), so add an argument. Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/fib_frontend.c4
-rw-r--r--net/ipv4/igmp.c2
-rw-r--r--net/ipv4/ip_sockglue.c2
-rw-r--r--net/ipv4/ipmr.c2
-rw-r--r--net/ipv4/route.c6
5 files changed, 8 insertions, 8 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 7e3e7329dacf..d28261826bc2 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -153,7 +153,7 @@ static void fib_flush(struct net *net)
153 * Find the first device with a given source address. 153 * Find the first device with a given source address.
154 */ 154 */
155 155
156struct net_device * ip_dev_find(__be32 addr) 156struct net_device * ip_dev_find(struct net *net, __be32 addr)
157{ 157{
158 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } }; 158 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } };
159 struct fib_result res; 159 struct fib_result res;
@@ -164,7 +164,7 @@ struct net_device * ip_dev_find(__be32 addr)
164 res.r = NULL; 164 res.r = NULL;
165#endif 165#endif
166 166
167 local_table = fib_get_table(&init_net, RT_TABLE_LOCAL); 167 local_table = fib_get_table(net, RT_TABLE_LOCAL);
168 if (!local_table || local_table->tb_lookup(local_table, &fl, &res)) 168 if (!local_table || local_table->tb_lookup(local_table, &fl, &res))
169 return NULL; 169 return NULL;
170 if (res.type != RTN_LOCAL) 170 if (res.type != RTN_LOCAL)
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 928bc3284554..1f5314ca109c 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1395,7 +1395,7 @@ static struct in_device * ip_mc_find_dev(struct ip_mreqn *imr)
1395 return idev; 1395 return idev;
1396 } 1396 }
1397 if (imr->imr_address.s_addr) { 1397 if (imr->imr_address.s_addr) {
1398 dev = ip_dev_find(imr->imr_address.s_addr); 1398 dev = ip_dev_find(&init_net, imr->imr_address.s_addr);
1399 if (!dev) 1399 if (!dev)
1400 return NULL; 1400 return NULL;
1401 dev_put(dev); 1401 dev_put(dev);
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 82817e554363..754b0a5bbfe9 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -594,7 +594,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
594 err = 0; 594 err = 0;
595 break; 595 break;
596 } 596 }
597 dev = ip_dev_find(mreq.imr_address.s_addr); 597 dev = ip_dev_find(&init_net, mreq.imr_address.s_addr);
598 if (dev) { 598 if (dev) {
599 mreq.imr_ifindex = dev->ifindex; 599 mreq.imr_ifindex = dev->ifindex;
600 dev_put(dev); 600 dev_put(dev);
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 4198615ca678..221271758b93 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -423,7 +423,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock)
423 return -ENOBUFS; 423 return -ENOBUFS;
424 break; 424 break;
425 case 0: 425 case 0:
426 dev = ip_dev_find(vifc->vifc_lcl_addr.s_addr); 426 dev = ip_dev_find(&init_net, vifc->vifc_lcl_addr.s_addr);
427 if (!dev) 427 if (!dev)
428 return -EADDRNOTAVAIL; 428 return -EADDRNOTAVAIL;
429 dev_put(dev); 429 dev_put(dev);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 4313255e5a14..674575b622ad 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2282,14 +2282,14 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
2282 goto out; 2282 goto out;
2283 2283
2284 /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */ 2284 /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */
2285 dev_out = ip_dev_find(oldflp->fl4_src); 2285 dev_out = ip_dev_find(&init_net, oldflp->fl4_src);
2286 if (dev_out == NULL) 2286 if (dev_out == NULL)
2287 goto out; 2287 goto out;
2288 2288
2289 /* I removed check for oif == dev_out->oif here. 2289 /* I removed check for oif == dev_out->oif here.
2290 It was wrong for two reasons: 2290 It was wrong for two reasons:
2291 1. ip_dev_find(saddr) can return wrong iface, if saddr is 2291 1. ip_dev_find(net, saddr) can return wrong iface, if saddr
2292 assigned to multiple interfaces. 2292 is assigned to multiple interfaces.
2293 2. Moreover, we are allowed to send packets with saddr 2293 2. Moreover, we are allowed to send packets with saddr
2294 of another iface. --ANK 2294 of another iface. --ANK
2295 */ 2295 */