Subject: [PATCH] ipv6: replace RTF_ROUTEINFO with RTF_ADDRCONF in rt6_get_route_info()

From: Duan Jiong <[email-masked]>
Date: Wed, 06 Nov 2013 15:26:41 +0800

As the rfc 4191 said, the Router Preference and Lifetime values in a
::/0 Route Information Option should override the preference and lifetime
values in the Router Advertisement header. But when the kernel deals with
a ::/0 Route Information Option, the rt6_get_route_info() always return
NULL, that means that overriding will not happen, because those default
routers were added without flag RTF_ROUTEINFO in rt6_add_dflt_router().

In order to match those default routers, we can replace RTF_ROUTEINFO 
with RTF_ADDRCONF in rt6_get_route_info().

Signed-off-by: Duan Jiong <[email-masked]>
---
 net/ipv6/route.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 04e17b3..549aa3b 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1940,7 +1940,8 @@ static struct rt6_info *rt6_get_route_info(struct net *net,
 	for (rt = fn->leaf; rt; rt = rt->dst.rt6_next) {
 		if (rt->dst.dev->ifindex != ifindex)
 			continue;
-		if ((rt->rt6i_flags & (RTF_ROUTEINFO|RTF_GATEWAY)) != (RTF_ROUTEINFO|RTF_GATEWAY))
+		if ((rt->rt6i_flags & (RTF_ADDRCONF|RTF_GATEWAY)) !=
+		    (RTF_ADDRCONF|RTF_GATEWAY))
 			continue;
 		if (!ipv6_addr_equal(&rt->rt6i_gateway, gwaddr))
 			continue;
-- 
1.8.3.1