]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[IPV6] ROUTE: Do not route packets to link-local address on other device.
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Mon, 5 Feb 2007 04:15:04 +0000 (20:15 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 8 Feb 2007 20:38:42 +0000 (12:38 -0800)
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>
net/ipv6/route.c

index f4fda80a41a2f759daf2f404d3bb5fc72450cffb..19c906f6efa14215bd509c5cbea621deb99dd26c 100644 (file)
@@ -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)