diff options
author | Duan Jiong <duanj.fnst@cn.fujitsu.com> | 2013-11-08 09:56:53 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-11-08 15:16:04 -0500 |
commit | f104a567e673f382b09542a8dc3500aa689957b4 (patch) | |
tree | 6c85b2cfd65fb0e0e5a506eac73ba70c04a0427a /net | |
parent | cdbe7c2d6d485459801838c244c409b938e32df5 (diff) | |
download | op-kernel-dev-f104a567e673f382b09542a8dc3500aa689957b4.zip op-kernel-dev-f104a567e673f382b09542a8dc3500aa689957b4.tar.gz |
ipv6: use rt6_get_dflt_router to get default router in rt6_route_rcv
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/route.c | 7 |
1 files 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); |