diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2007-02-04 23:15:04 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-02-08 15:38:42 -0500 |
commit | a0d78ebf3a0e33a1aeacf2fc518ad9273d6a1c2f (patch) | |
tree | 0cbbccb38b542073c19fb5e9922b436231e4d1fd | |
parent | 26932566a42d46aee7e5d526cb34fba9380cad10 (diff) |
[IPV6] ROUTE: Do not route packets to link-local address on other device.
With help from Wei Dong <weid@np.css.fujitsu.com>.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv6/route.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index f4fda80a41a2..19c906f6efa1 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -311,12 +311,21 @@ static inline void rt6_probe(struct rt6_info *rt) | |||
311 | static int inline rt6_check_dev(struct rt6_info *rt, int oif) | 311 | static int inline rt6_check_dev(struct rt6_info *rt, int oif) |
312 | { | 312 | { |
313 | struct net_device *dev = rt->rt6i_dev; | 313 | struct net_device *dev = rt->rt6i_dev; |
314 | if (!oif || dev->ifindex == oif) | 314 | int ret = 0; |
315 | |||
316 | if (!oif) | ||
315 | return 2; | 317 | return 2; |
316 | if ((dev->flags & IFF_LOOPBACK) && | 318 | if (dev->flags & IFF_LOOPBACK) { |
317 | rt->rt6i_idev && rt->rt6i_idev->dev->ifindex == oif) | 319 | if (!WARN_ON(rt->rt6i_idev == NULL) && |
318 | return 1; | 320 | rt->rt6i_idev->dev->ifindex == oif) |
319 | return 0; | 321 | ret = 1; |
322 | else | ||
323 | return 0; | ||
324 | } | ||
325 | if (dev->ifindex == oif) | ||
326 | return 2; | ||
327 | |||
328 | return ret; | ||
320 | } | 329 | } |
321 | 330 | ||
322 | static int inline rt6_check_neigh(struct rt6_info *rt) | 331 | static int inline rt6_check_neigh(struct rt6_info *rt) |