Commit 84a885f4 authored by Denis V. Lunev's avatar Denis V. Lunev Committed by David S. Miller

[NETNS]: Pass correct namespace in ip_route_input_slow.

The packet on the input path always has a referrence to an input
network device it is passed from. Extract network namespace from it.
Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 86167a37
...@@ -1881,6 +1881,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, ...@@ -1881,6 +1881,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
__be32 spec_dst; __be32 spec_dst;
int err = -EINVAL; int err = -EINVAL;
int free_res = 0; int free_res = 0;
struct net * net = dev->nd_net;
/* IP on this device is disabled. */ /* IP on this device is disabled. */
...@@ -1911,7 +1912,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, ...@@ -1911,7 +1912,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
/* /*
* Now we are ready to route packet. * Now we are ready to route packet.
*/ */
if ((err = fib_lookup(&init_net, &fl, &res)) != 0) { if ((err = fib_lookup(net, &fl, &res)) != 0) {
if (!IN_DEV_FORWARD(in_dev)) if (!IN_DEV_FORWARD(in_dev))
goto e_hostunreach; goto e_hostunreach;
goto no_route; goto no_route;
...@@ -1926,7 +1927,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, ...@@ -1926,7 +1927,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
if (res.type == RTN_LOCAL) { if (res.type == RTN_LOCAL) {
int result; int result;
result = fib_validate_source(saddr, daddr, tos, result = fib_validate_source(saddr, daddr, tos,
init_net.loopback_dev->ifindex, net->loopback_dev->ifindex,
dev, &spec_dst, &itag); dev, &spec_dst, &itag);
if (result < 0) if (result < 0)
goto martian_source; goto martian_source;
...@@ -1988,7 +1989,7 @@ out: return err; ...@@ -1988,7 +1989,7 @@ out: return err;
#endif #endif
rth->rt_iif = rth->rt_iif =
rth->fl.iif = dev->ifindex; rth->fl.iif = dev->ifindex;
rth->u.dst.dev = init_net.loopback_dev; rth->u.dst.dev = net->loopback_dev;
dev_hold(rth->u.dst.dev); dev_hold(rth->u.dst.dev);
rth->idev = in_dev_get(rth->u.dst.dev); rth->idev = in_dev_get(rth->u.dst.dev);
rth->rt_gateway = daddr; rth->rt_gateway = daddr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment