Commit c375d517 authored by Hideaki Yoshifuji's avatar Hideaki Yoshifuji

[IPV6] take rt6i_idev into account when looking up routes.

This is required because we will add "same" routes 
(except for rt6i_idev) on loopback for routes for local address.
Signed-off-by: default avatarHideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
parent f3200f7e
...@@ -449,9 +449,10 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, ...@@ -449,9 +449,10 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
* Same priority level * Same priority level
*/ */
if ((iter->rt6i_dev == rt->rt6i_dev) && if (iter->rt6i_dev == rt->rt6i_dev &&
(ipv6_addr_cmp(&iter->rt6i_gateway, iter->rt6i_idev == rt->rt6i_idev &&
&rt->rt6i_gateway) == 0)) { ipv6_addr_cmp(&iter->rt6i_gateway,
&rt->rt6i_gateway) == 0) {
if (!(iter->rt6i_flags&RTF_EXPIRES)) if (!(iter->rt6i_flags&RTF_EXPIRES))
return -EEXIST; return -EEXIST;
iter->rt6i_expires = rt->rt6i_expires; iter->rt6i_expires = rt->rt6i_expires;
......
...@@ -183,8 +183,16 @@ static __inline__ struct rt6_info *rt6_device_match(struct rt6_info *rt, ...@@ -183,8 +183,16 @@ static __inline__ struct rt6_info *rt6_device_match(struct rt6_info *rt,
struct net_device *dev = sprt->rt6i_dev; struct net_device *dev = sprt->rt6i_dev;
if (dev->ifindex == oif) if (dev->ifindex == oif)
return sprt; return sprt;
if (dev->flags&IFF_LOOPBACK) if (dev->flags & IFF_LOOPBACK) {
if (sprt->rt6i_idev->dev->ifindex != oif) {
if (strict && oif)
continue;
if (local && (!oif ||
local->rt6i_idev->dev->ifindex == oif))
continue;
}
local = sprt; local = sprt;
}
} }
if (local) if (local)
......
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