aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-01-23 01:06:19 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:11:05 -0500
commitb40afd0e5c568aba79a4ae2a963cd2af1f09490d (patch)
tree581ff80976c89de63419ce79e2c8a66ee4cde8db
parent1ab352768fc73838b062776ca5d1add3876a019f (diff)
[NETNS]: Add namespace parameter to ip_route_output_slow.
This function needs a net namespace to lookup devices, fib tables, etc. in, so pass it there. Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv4/route.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 674575b622ad..0576ff79c550 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2248,7 +2248,8 @@ static inline int ip_mkroute_output(struct rtable **rp,
2248 * Major route resolver routine. 2248 * Major route resolver routine.
2249 */ 2249 */
2250 2250
2251static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp) 2251static int ip_route_output_slow(struct net *net, struct rtable **rp,
2252 const struct flowi *oldflp)
2252{ 2253{
2253 u32 tos = RT_FL_TOS(oldflp); 2254 u32 tos = RT_FL_TOS(oldflp);
2254 struct flowi fl = { .nl_u = { .ip4_u = 2255 struct flowi fl = { .nl_u = { .ip4_u =
@@ -2260,7 +2261,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
2260 RT_SCOPE_UNIVERSE), 2261 RT_SCOPE_UNIVERSE),
2261 } }, 2262 } },
2262 .mark = oldflp->mark, 2263 .mark = oldflp->mark,
2263 .iif = init_net.loopback_dev->ifindex, 2264 .iif = net->loopback_dev->ifindex,
2264 .oif = oldflp->oif }; 2265 .oif = oldflp->oif };
2265 struct fib_result res; 2266 struct fib_result res;
2266 unsigned flags = 0; 2267 unsigned flags = 0;
@@ -2282,7 +2283,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
2282 goto out; 2283 goto out;
2283 2284
2284 /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */ 2285 /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */
2285 dev_out = ip_dev_find(&init_net, oldflp->fl4_src); 2286 dev_out = ip_dev_find(net, oldflp->fl4_src);
2286 if (dev_out == NULL) 2287 if (dev_out == NULL)
2287 goto out; 2288 goto out;
2288 2289
@@ -2322,7 +2323,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
2322 2323
2323 2324
2324 if (oldflp->oif) { 2325 if (oldflp->oif) {
2325 dev_out = dev_get_by_index(&init_net, oldflp->oif); 2326 dev_out = dev_get_by_index(net, oldflp->oif);
2326 err = -ENODEV; 2327 err = -ENODEV;
2327 if (dev_out == NULL) 2328 if (dev_out == NULL)
2328 goto out; 2329 goto out;
@@ -2356,15 +2357,15 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
2356 fl.fl4_dst = fl.fl4_src = htonl(INADDR_LOOPBACK); 2357 fl.fl4_dst = fl.fl4_src = htonl(INADDR_LOOPBACK);
2357 if (dev_out) 2358 if (dev_out)
2358 dev_put(dev_out); 2359 dev_put(dev_out);
2359 dev_out = init_net.loopback_dev; 2360 dev_out = net->loopback_dev;
2360 dev_hold(dev_out); 2361 dev_hold(dev_out);
2361 fl.oif = init_net.loopback_dev->ifindex; 2362 fl.oif = net->loopback_dev->ifindex;
2362 res.type = RTN_LOCAL; 2363 res.type = RTN_LOCAL;
2363 flags |= RTCF_LOCAL; 2364 flags |= RTCF_LOCAL;
2364 goto make_route; 2365 goto make_route;
2365 } 2366 }
2366 2367
2367 if (fib_lookup(&init_net, &fl, &res)) { 2368 if (fib_lookup(net, &fl, &res)) {
2368 res.fi = NULL; 2369 res.fi = NULL;
2369 if (oldflp->oif) { 2370 if (oldflp->oif) {
2370 /* Apparently, routing tables are wrong. Assume, 2371 /* Apparently, routing tables are wrong. Assume,
@@ -2403,7 +2404,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
2403 fl.fl4_src = fl.fl4_dst; 2404 fl.fl4_src = fl.fl4_dst;
2404 if (dev_out) 2405 if (dev_out)
2405 dev_put(dev_out); 2406 dev_put(dev_out);
2406 dev_out = init_net.loopback_dev; 2407 dev_out = net->loopback_dev;
2407 dev_hold(dev_out); 2408 dev_hold(dev_out);
2408 fl.oif = dev_out->ifindex; 2409 fl.oif = dev_out->ifindex;
2409 if (res.fi) 2410 if (res.fi)
@@ -2419,7 +2420,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
2419 else 2420 else
2420#endif 2421#endif
2421 if (!res.prefixlen && res.type == RTN_UNICAST && !fl.oif) 2422 if (!res.prefixlen && res.type == RTN_UNICAST && !fl.oif)
2422 fib_select_default(&init_net, &fl, &res); 2423 fib_select_default(net, &fl, &res);
2423 2424
2424 if (!fl.fl4_src) 2425 if (!fl.fl4_src)
2425 fl.fl4_src = FIB_RES_PREFSRC(res); 2426 fl.fl4_src = FIB_RES_PREFSRC(res);
@@ -2469,7 +2470,7 @@ int __ip_route_output_key(struct rtable **rp, const struct flowi *flp)
2469 } 2470 }
2470 rcu_read_unlock_bh(); 2471 rcu_read_unlock_bh();
2471 2472
2472 return ip_route_output_slow(rp, flp); 2473 return ip_route_output_slow(&init_net, rp, flp);
2473} 2474}
2474 2475
2475EXPORT_SYMBOL_GPL(__ip_route_output_key); 2476EXPORT_SYMBOL_GPL(__ip_route_output_key);