ipv6: replace RTF_ROUTEINFO with RTF_ADDRCONF in rt6_get_route_info()
Subsystems (3)
PATCH 1/1 ipv6: replace RTF_ROUTEINFO with RTF_ADDRCONF in rt6_get_route_info()
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().
--- net/ipv6/route.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv6/route.c +2 -1
@@ -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 ;
Signature · 1 line
1.8.3.1
Quoted 8 lines · Duan Jiong
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 flagRTF_ROUTEINFOinrt6_add_dflt_router().
Quoted 4 lines
In order to match those default routers, we can replace
RTF_ROUTEINFOwithRTF_ADDRCONFinrt6_get_route_info().Signed-off-by Duan Jiong <[email protected]>
Hmm, that looks like a bug. Nice catch!
Couldn't we just replace the rt6_get_route_info in rt6_route_rcv with a call to rt6_get_dflt_router? Seems easier, already handles the ::/0 case and also does preserve the check for the RTF_ROUTEINFO flag in rt6_add_route_info.
Greetings,
Hannes
Quoted 12 lines · Hannes Frederic Sowa
Quoted 11 lines · Duan Jiong
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 flagRTF_ROUTEINFOinrt6_add_dflt_router().In order to match those default routers, we can replace
RTF_ROUTEINFOwithRTF_ADDRCONFinrt6_get_route_info().
Quoted 7 lines
Quoted 1 line
Signed-off-by Duan Jiong <[email protected]>Hmm, that looks like a bug. Nice catch!
Couldn't we just replace the
rt6_get_route_infoinrt6_route_rcvwith a call tort6_get_dflt_router? Seems easier, already handles the ::/0 case and also does preserve the check for theRTF_ROUTEINFOflag inrt6_add_route_info.
Yeah, your idea is better. I will modify my patch.
Thanks,
Duan
Quoted 10 lines
Greetings,
Hannes
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 15 lines · Duan Jiong
Quoted 14 lines · Hannes Frederic Sowa
Quoted 12 lines · Duan Jiong
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 flagRTF_ROUTEINFOinrt6_add_dflt_router().In order to match those default routers, we can replace
RTF_ROUTEINFOwithRTF_ADDRCONFinrt6_get_route_info().Signed-off-by Duan Jiong <[email protected]>
Quoted 7 lines
Quoted 5 lines
Hmm, that looks like a bug. Nice catch!
Couldn't we just replace the
rt6_get_route_infoinrt6_route_rcvwith a call tort6_get_dflt_router? Seems easier, already handles the ::/0 case and also does preserve the check for theRTF_ROUTEINFOflag inrt6_add_route_info.Yeah, your idea is better. I will modify my patch.
Stop, stop, stop, sorry that suggestion is plain wrong and stupid.
But I still would like to see the check for RTF_ROUTEINFO happening in rt6_add_route_info. We should also rename the function if you only query for RTF_ADDRCONF and not RTF_ROUTEINFO.
Sorry,
Hannes
Quoted 18 lines · Hannes Frederic Sowa
Quoted 17 lines · Duan Jiong
Quoted 16 lines · Hannes Frederic Sowa
Quoted 8 lines · Duan Jiong
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 flagRTF_ROUTEINFOinrt6_add_dflt_router().Quoted 4 lines
In order to match those default routers, we can replace
RTF_ROUTEINFOwithRTF_ADDRCONFinrt6_get_route_info().Signed-off-by Duan Jiong <[email protected]>Hmm, that looks like a bug. Nice catch!
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Couldn't we just replace the
rt6_get_route_infoinrt6_route_rcvwith a call tort6_get_dflt_router? Seems easier, already handles the ::/0 case and also does preserve the check for theRTF_ROUTEINFOflag inrt6_add_route_info.Yeah, your idea is better. I will modify my patch.
Stop, stop, stop, sorry that suggestion is plain wrong and stupid.
In my opinion, i think that is well. According to your suggestion, we can call the rt6_get_dflt_router or rt6_get_route_info in different situation.
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);
How do you think of the change above?
Thanks,
Duan
Quoted 9 lines
But I still would like to see the check for
RTF_ROUTEINFOhappening inrt6_add_route_info. We should also rename the function if you only query forRTF_ADDRCONFand notRTF_ROUTEINFO.Sorry,
Hannes
Quoted 28 lines · Duan Jiong
Quoted 18 lines · Hannes Frederic Sowa
Quoted 17 lines · Duan Jiong
Quoted 16 lines · Hannes Frederic Sowa
Quoted 8 lines · Duan Jiong
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 flagRTF_ROUTEINFOinrt6_add_dflt_router().Quoted 4 lines
In order to match those default routers, we can replace
RTF_ROUTEINFOwithRTF_ADDRCONFinrt6_get_route_info().Signed-off-by Duan Jiong <[email protected]>Hmm, that looks like a bug. Nice catch!
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Couldn't we just replace the
rt6_get_route_infoinrt6_route_rcvwith a call tort6_get_dflt_router? Seems easier, already handles the ::/0 case and also does preserve the check for theRTF_ROUTEINFOflag inrt6_add_route_info.Yeah, your idea is better. I will modify my patch.
Stop, stop, stop, sorry that suggestion is plain wrong and stupid.
Quoted 8 lines
In my opinion, i think that is well. According to your suggestion, we can call the
rt6_get_dflt_routerorrt6_get_route_infoin different situation.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);
That's perfect.
Greetings,
Hannes