diff options
author | Denis V. Lunev <den@openvz.org> | 2008-02-28 23:50:06 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-02-28 23:50:06 -0500 |
commit | 317805b8f875ca1bd43d594c0a210e24fab7d177 (patch) | |
tree | c3ec5090088b2aa546546f0285ecc830fe64ce63 /net/ipv4/route.c | |
parent | 9de8f76d200342f1e9495861c2c9ce87a6bc26d0 (diff) |
[NETNS]: Process ip_rt_redirect in the correct namespace.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r-- | net/ipv4/route.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 7b5e8e1d94be..ad6eadd12b4a 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1131,10 +1131,12 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, | |||
1131 | __be32 skeys[2] = { saddr, 0 }; | 1131 | __be32 skeys[2] = { saddr, 0 }; |
1132 | int ikeys[2] = { dev->ifindex, 0 }; | 1132 | int ikeys[2] = { dev->ifindex, 0 }; |
1133 | struct netevent_redirect netevent; | 1133 | struct netevent_redirect netevent; |
1134 | struct net *net; | ||
1134 | 1135 | ||
1135 | if (!in_dev) | 1136 | if (!in_dev) |
1136 | return; | 1137 | return; |
1137 | 1138 | ||
1139 | net = dev->nd_net; | ||
1138 | if (new_gw == old_gw || !IN_DEV_RX_REDIRECTS(in_dev) | 1140 | if (new_gw == old_gw || !IN_DEV_RX_REDIRECTS(in_dev) |
1139 | || ipv4_is_multicast(new_gw) || ipv4_is_lbcast(new_gw) | 1141 | || ipv4_is_multicast(new_gw) || ipv4_is_lbcast(new_gw) |
1140 | || ipv4_is_zeronet(new_gw)) | 1142 | || ipv4_is_zeronet(new_gw)) |
@@ -1146,7 +1148,7 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, | |||
1146 | if (IN_DEV_SEC_REDIRECTS(in_dev) && ip_fib_check_default(new_gw, dev)) | 1148 | if (IN_DEV_SEC_REDIRECTS(in_dev) && ip_fib_check_default(new_gw, dev)) |
1147 | goto reject_redirect; | 1149 | goto reject_redirect; |
1148 | } else { | 1150 | } else { |
1149 | if (inet_addr_type(&init_net, new_gw) != RTN_UNICAST) | 1151 | if (inet_addr_type(net, new_gw) != RTN_UNICAST) |
1150 | goto reject_redirect; | 1152 | goto reject_redirect; |
1151 | } | 1153 | } |
1152 | 1154 | ||
@@ -1164,7 +1166,8 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, | |||
1164 | rth->fl.fl4_src != skeys[i] || | 1166 | rth->fl.fl4_src != skeys[i] || |
1165 | rth->fl.oif != ikeys[k] || | 1167 | rth->fl.oif != ikeys[k] || |
1166 | rth->fl.iif != 0 || | 1168 | rth->fl.iif != 0 || |
1167 | rth->rt_genid != atomic_read(&rt_genid)) { | 1169 | rth->rt_genid != atomic_read(&rt_genid) || |
1170 | rth->u.dst.dev->nd_net != net) { | ||
1168 | rthp = &rth->u.dst.rt_next; | 1171 | rthp = &rth->u.dst.rt_next; |
1169 | continue; | 1172 | continue; |
1170 | } | 1173 | } |