netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* IPv6 and rt6_lookup()
@ 2006-11-02 16:25 Nicolas DICHTEL
  2006-11-02 17:02 ` Vlad Yasevich
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas DICHTEL @ 2006-11-02 16:25 UTC (permalink / raw)
  To: netdev

[-- Attachment #1: Type: text/plain, Size: 1233 bytes --]

Hello,

Suppose that a host has autoconfiguration enabled. It will take RA to
autoconfigure an IPv6 address. For example, 
2001:0db8:3008:c1ca:2d0:b7ff:febb:4aee/64.
This host will create a route entry for this onlink prefix (dst: 
2001:0db8:3008:c1ca::/64)
in the MAIN table with the lifetime present in prefix option in RA.
Each time this host will receive a RA, it will update this lifetime. To 
do this,
it will call rt6_lookup() (in addrconf_prefix_rcv()) to find the entry.

Now, suppose that our host joins this anycast group: 
"2001:0db8:3008:c1ca::0". A route
entry will be added in the LOCAL table (see addrconf_join_anycast()).
Problem is that, next time our host will receive a RA and will perform a 
rt6_lookup(),
this function will return the local entry (LOCAL table), and not the 
"dynamic" entry
(MAIN table). Consequence is that the lifetime of the dynamic entry will 
never been updated,
and so will expire, whereas the host will keep the corresponding address.

Maybe, when strict is set to 1 in rt6_lookup(), kernel must not return 
an anycast route.
What about this patch ?


Regards,
Nicolas

[IPv6] Don't return anycast route when strict is enable

Signed-off-by: Nicolas DICHTEL <nicolas.dichtel@6wind.com>


[-- Attachment #2: ra.diff --]
[-- Type: text/x-patch, Size: 447 bytes --]

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index c953466..51a8c1d 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -248,6 +248,8 @@ static __inline__ struct rt6_info *rt6_d
 			if (dev->ifindex == oif)
 				return sprt;
 			if (dev->flags & IFF_LOOPBACK) {
+				if (strict && sprt->rt6i_flags & RTF_ANYCAST)
+					continue;
 				if (sprt->rt6i_idev == NULL ||
 				    sprt->rt6i_idev->dev->ifindex != oif) {
 					if (strict && oif)

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

* Re: IPv6 and rt6_lookup()
  2006-11-02 16:25 IPv6 and rt6_lookup() Nicolas DICHTEL
@ 2006-11-02 17:02 ` Vlad Yasevich
  2006-11-02 17:19   ` Nicolas DICHTEL
  0 siblings, 1 reply; 3+ messages in thread
From: Vlad Yasevich @ 2006-11-02 17:02 UTC (permalink / raw)
  To: nicolas.dichtel; +Cc: netdev

Nicolas DICHTEL wrote:
> Hello,
> 
> Suppose that a host has autoconfiguration enabled. It will take RA to
> autoconfigure an IPv6 address. For example,
> 2001:0db8:3008:c1ca:2d0:b7ff:febb:4aee/64.
> This host will create a route entry for this onlink prefix (dst:
> 2001:0db8:3008:c1ca::/64)
> in the MAIN table with the lifetime present in prefix option in RA.
> Each time this host will receive a RA, it will update this lifetime. To
> do this,
> it will call rt6_lookup() (in addrconf_prefix_rcv()) to find the entry.
> 
> Now, suppose that our host joins this anycast group:
> "2001:0db8:3008:c1ca::0". A route

Hmm... you are configuring a subnet router anycast address on host and 
the implementation lets you do it?  That's not good.  I don't think
you sould be permitted to configure a subnet router anycast address
on a host that autoconfigures it's interface.

-vlad

> entry will be added in the LOCAL table (see addrconf_join_anycast()).
> Problem is that, next time our host will receive a RA and will perform a
> rt6_lookup(),
> this function will return the local entry (LOCAL table), and not the
> "dynamic" entry
> (MAIN table). Consequence is that the lifetime of the dynamic entry will
> never been updated,
> and so will expire, whereas the host will keep the corresponding address.
> 
> Maybe, when strict is set to 1 in rt6_lookup(), kernel must not return
> an anycast route.
> What about this patch ?
> 
> 
> Regards,
> Nicolas
> 
> [IPv6] Don't return anycast route when strict is enable
> 
> Signed-off-by: Nicolas DICHTEL <nicolas.dichtel@6wind.com>
> 
> 
> ------------------------------------------------------------------------
> 
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index c953466..51a8c1d 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -248,6 +248,8 @@ static __inline__ struct rt6_info *rt6_d
>  			if (dev->ifindex == oif)
>  				return sprt;
>  			if (dev->flags & IFF_LOOPBACK) {
> +				if (strict && sprt->rt6i_flags & RTF_ANYCAST)
> +					continue;
>  				if (sprt->rt6i_idev == NULL ||
>  				    sprt->rt6i_idev->dev->ifindex != oif) {
>  					if (strict && oif)


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

* Re: IPv6 and rt6_lookup()
  2006-11-02 17:02 ` Vlad Yasevich
@ 2006-11-02 17:19   ` Nicolas DICHTEL
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas DICHTEL @ 2006-11-02 17:19 UTC (permalink / raw)
  To: Vlad Yasevich; +Cc: netdev

Le 02.11.2006 18:02, Vlad Yasevich a écrit :
> Nicolas DICHTEL wrote:
>> Hello,
>>
>> Suppose that a host has autoconfiguration enabled. It will take RA to
>> autoconfigure an IPv6 address. For example,
>> 2001:0db8:3008:c1ca:2d0:b7ff:febb:4aee/64.
>> This host will create a route entry for this onlink prefix (dst:
>> 2001:0db8:3008:c1ca::/64)
>> in the MAIN table with the lifetime present in prefix option in RA.
>> Each time this host will receive a RA, it will update this lifetime. To
>> do this,
>> it will call rt6_lookup() (in addrconf_prefix_rcv()) to find the entry.
>>
>> Now, suppose that our host joins this anycast group:
>> "2001:0db8:3008:c1ca::0". A route
>
> Hmm... you are configuring a subnet router anycast address on host and 
> the implementation lets you do it?  That's not good.  I don't think
> you sould be permitted to configure a subnet router anycast address
> on a host that autoconfigures it's interface.
The current implementation allow this and I don't know if we must 
prohibit this.
For example, in case of NEMO (RFC3963), router may autoconfigured its 
address.

Nicolas

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

end of thread, other threads:[~2006-11-02 17:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-02 16:25 IPv6 and rt6_lookup() Nicolas DICHTEL
2006-11-02 17:02 ` Vlad Yasevich
2006-11-02 17:19   ` Nicolas DICHTEL

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