(usagi-users 03789) Re: [Patch][IPv6] Fix wrong routing mechanism for Link Local IPv6 packets
YOSHIFUJI Hideaki / 吉藤英明 <[email protected]> Wed, 31 Jan 2007 14:42:50 +0900 (JST)
| Newsgroups | gmane.linux.ipv6.usagi.users,gmane.linux.network |
|---|---|
| Organization | USAGI/WIDE Project |
| Message-ID | <[email protected]> |
In article <[email protected]> (at Wed, 31 Jan 2007 14:14:08 +0900 (JST)), YOSHIFUJI Hideaki / <[email protected]> says: > In article <[email protected]> (at Wed, 31 Jan 2007 14:09:14 +0900 (JST)), YOSHIFUJI Hideaki / <[email protected]> says: > > > In article <1172119906.2658.4.camel@LINE> (at Wed, 21 Feb 2007 23:51:45 -0500), weidong <[email protected]> says: > > > > > Thanks for your patch. I think maybe we checking oif first is better, > > > and WARN_ON in function rt6_score_route(). > > > > Please remove WARN_ON. Otherwise, I'm fine with it. > > Argh, no.... wrong. Here's updated patch, intented for net-2.6.21. Dave? ---- [IPV6] ROUTE: Do not route packets to link-local address on other device. With help from Wei Dong <[email protected]>. Signed-off-by: YOSHIFUJI Hideaki <[email protected]> --- diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 5f0043c..16111c4 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -311,12 +311,21 @@ static inline void rt6_probe(struct rt6_info *rt) static int inline rt6_check_dev(struct rt6_info *rt, int oif) { struct net_device *dev = rt->rt6i_dev; - if (!oif || dev->ifindex == oif) + int ret = 0; + + if (!oif) return 2; - if ((dev->flags & IFF_LOOPBACK) && - rt->rt6i_idev && rt->rt6i_idev->dev->ifindex == oif) - return 1; - return 0; + if (dev->flags & IFF_LOOPBACK) { + if (!WARN_ON(rt->rt6i_idev == NULL) && + rt->rt6i_idev->dev->ifindex == oif) + ret = 1; + else + return 0; + } + if (dev->ifindex == oif) + return 2; + + return ret; } static int inline rt6_check_neigh(struct rt6_info *rt) -- YOSHIFUJI Hideaki @ USAGI Project <[email protected]> GPG-FP : 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA