netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH] ipv6: replace RTF_ROUTEINFO with RTF_ADDRCONF in  rt6_get_route_info()
Date: Wed, 06 Nov 2013 15:26:41 +0800	[thread overview]
Message-ID: <5279EF31.4040705@cn.fujitsu.com> (raw)


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 <duanj.fnst@cn.fujitsu.com>
---
 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

             reply	other threads:[~2013-11-06  7:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-06  7:26 Duan Jiong [this message]
2013-11-07  1:51 ` [PATCH] ipv6: replace RTF_ROUTEINFO with RTF_ADDRCONF in rt6_get_route_info() Hannes Frederic Sowa
2013-11-07  2:01   ` Duan Jiong
2013-11-07  2:42     ` Hannes Frederic Sowa
2013-11-07  4:19       ` Duan Jiong
2013-11-07 12:19         ` Hannes Frederic Sowa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5279EF31.4040705@cn.fujitsu.com \
    --to=duanj.fnst@cn.fujitsu.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).