netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv6: replace RTF_ROUTEINFO with RTF_ADDRCONF in  rt6_get_route_info()
@ 2013-11-06  7:26 Duan Jiong
  2013-11-07  1:51 ` Hannes Frederic Sowa
  0 siblings, 1 reply; 6+ messages in thread
From: Duan Jiong @ 2013-11-06  7:26 UTC (permalink / raw)
  To: David Miller; +Cc: 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 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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ipv6: replace RTF_ROUTEINFO with RTF_ADDRCONF in  rt6_get_route_info()
  2013-11-06  7:26 [PATCH] ipv6: replace RTF_ROUTEINFO with RTF_ADDRCONF in rt6_get_route_info() Duan Jiong
@ 2013-11-07  1:51 ` Hannes Frederic Sowa
  2013-11-07  2:01   ` Duan Jiong
  0 siblings, 1 reply; 6+ messages in thread
From: Hannes Frederic Sowa @ 2013-11-07  1:51 UTC (permalink / raw)
  To: Duan Jiong; +Cc: David Miller, netdev

On Wed, Nov 06, 2013 at 03:26:41PM +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 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>

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ipv6: replace RTF_ROUTEINFO with RTF_ADDRCONF in  rt6_get_route_info()
  2013-11-07  1:51 ` Hannes Frederic Sowa
@ 2013-11-07  2:01   ` Duan Jiong
  2013-11-07  2:42     ` Hannes Frederic Sowa
  0 siblings, 1 reply; 6+ messages in thread
From: Duan Jiong @ 2013-11-07  2:01 UTC (permalink / raw)
  To: hannes; +Cc: David Miller, netdev

于 2013年11月07日 09:51, Hannes Frederic Sowa 写道:
> On Wed, Nov 06, 2013 at 03:26:41PM +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 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>
> 
> 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.

Yeah, your idea is better. I will modify my patch.

Thanks,
  Duan

> 
> Greetings,
> 
>   Hannes
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ipv6: replace RTF_ROUTEINFO with RTF_ADDRCONF in  rt6_get_route_info()
  2013-11-07  2:01   ` Duan Jiong
@ 2013-11-07  2:42     ` Hannes Frederic Sowa
  2013-11-07  4:19       ` Duan Jiong
  0 siblings, 1 reply; 6+ messages in thread
From: Hannes Frederic Sowa @ 2013-11-07  2:42 UTC (permalink / raw)
  To: Duan Jiong; +Cc: David Miller, netdev

On Thu, Nov 07, 2013 at 10:01:27AM +0800, Duan Jiong wrote:
> 于 2013年11月07日 09:51, Hannes Frederic Sowa 写道:
> > On Wed, Nov 06, 2013 at 03:26:41PM +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 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>
> > 
> > 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.
> 
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ipv6: replace RTF_ROUTEINFO with RTF_ADDRCONF in  rt6_get_route_info()
  2013-11-07  2:42     ` Hannes Frederic Sowa
@ 2013-11-07  4:19       ` Duan Jiong
  2013-11-07 12:19         ` Hannes Frederic Sowa
  0 siblings, 1 reply; 6+ messages in thread
From: Duan Jiong @ 2013-11-07  4:19 UTC (permalink / raw)
  To: hannes; +Cc: David Miller, netdev

于 2013年11月07日 10:42, Hannes Frederic Sowa 写道:
> On Thu, Nov 07, 2013 at 10:01:27AM +0800, Duan Jiong wrote:
>> 于 2013年11月07日 09:51, Hannes Frederic Sowa 写道:
>>> On Wed, Nov 06, 2013 at 03:26:41PM +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 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>
>>>
>>> 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.
>>
>> 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

> 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
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ipv6: replace RTF_ROUTEINFO with RTF_ADDRCONF in  rt6_get_route_info()
  2013-11-07  4:19       ` Duan Jiong
@ 2013-11-07 12:19         ` Hannes Frederic Sowa
  0 siblings, 0 replies; 6+ messages in thread
From: Hannes Frederic Sowa @ 2013-11-07 12:19 UTC (permalink / raw)
  To: Duan Jiong; +Cc: David Miller, netdev

On Thu, Nov 07, 2013 at 12:19:05PM +0800, Duan Jiong wrote:
> 于 2013年11月07日 10:42, Hannes Frederic Sowa 写道:
> > On Thu, Nov 07, 2013 at 10:01:27AM +0800, Duan Jiong wrote:
> >> 于 2013年11月07日 09:51, Hannes Frederic Sowa 写道:
> >>> On Wed, Nov 06, 2013 at 03:26:41PM +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 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>
> >>>
> >>> 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.
> >>
> >> 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);

That's perfect.

Greetings,

  Hannes

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-11-07 12:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-06  7:26 [PATCH] ipv6: replace RTF_ROUTEINFO with RTF_ADDRCONF in rt6_get_route_info() Duan Jiong
2013-11-07  1:51 ` 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

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).