mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-03 09:41:54 +09:00
ipv6: use rt6_get_dflt_router to get default router in rt6_route_rcv
[ Upstream commit f104a567e6 ]
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
d9160deb04
commit
ea136c0d81
@@ -728,8 +728,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);
|
||||
|
||||
Reference in New Issue
Block a user