* [PATCH] ipv6: use rt6_get_dflt_router to get default router in rt6_route_rcv
@ 2013-11-08 1:56 Duan Jiong
2013-11-08 12:43 ` Hannes Frederic Sowa
2013-11-08 20:18 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Duan Jiong @ 2013-11-08 1:56 UTC (permalink / raw)
To: David Miller; +Cc: hannes, netdev
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 deal with that condition, we should call rt6_get_dflt_router
when the prefix length is 0.
Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
net/ipv6/route.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index c28cdda..7faa9d5 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -731,8 +731,11 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
prefix = &prefix_buf;
}
- rt = rt6_get_route_info(net, prefix, rinfo->prefix_len, gwaddr,
- dev->ifindex);
+ if (rinfo->prefix_len == 0)
+ rt = rt6_get_dflt_router(gwaddr, dev);
+ else
+ rt = rt6_get_route_info(net, prefix, rinfo->prefix_len,
+ gwaddr, dev->ifindex);
if (rt && !lifetime) {
ip6_del_rt(rt);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ipv6: use rt6_get_dflt_router to get default router in rt6_route_rcv
2013-11-08 1:56 [PATCH] ipv6: use rt6_get_dflt_router to get default router in rt6_route_rcv Duan Jiong
@ 2013-11-08 12:43 ` Hannes Frederic Sowa
2013-11-08 20:18 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Hannes Frederic Sowa @ 2013-11-08 12:43 UTC (permalink / raw)
To: Duan Jiong; +Cc: David Miller, netdev
On Fri, Nov 08, 2013 at 09:56:53AM +0800, Duan Jiong wrote:
>
> 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 deal with that condition, we should call rt6_get_dflt_router
> when the prefix length is 0.
>
> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Thanks,
Hannes
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ipv6: use rt6_get_dflt_router to get default router in rt6_route_rcv
2013-11-08 1:56 [PATCH] ipv6: use rt6_get_dflt_router to get default router in rt6_route_rcv Duan Jiong
2013-11-08 12:43 ` Hannes Frederic Sowa
@ 2013-11-08 20:18 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2013-11-08 20:18 UTC (permalink / raw)
To: duanj.fnst; +Cc: hannes, netdev
From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Date: Fri, 08 Nov 2013 09:56:53 +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 deal with that condition, we should call rt6_get_dflt_router
> when the prefix length is 0.
>
> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Applied and queued up for -stable, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-08 20:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-08 1:56 [PATCH] ipv6: use rt6_get_dflt_router to get default router in rt6_route_rcv Duan Jiong
2013-11-08 12:43 ` Hannes Frederic Sowa
2013-11-08 20:18 ` David Miller
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).