netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch]  ipv6 source address selection in addrconf.c (2.6.17)
  2006-06-20 21:38 Lukasz Stelmach
@ 2006-06-21 13:42 ` Lukasz Stelmach
  2006-06-21 15:12   ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 1 reply; 4+ messages in thread
From: Lukasz Stelmach @ 2006-06-21 13:42 UTC (permalink / raw)
  To: Lukasz Stelmach; +Cc: netdev


[-- Attachment #1.1: Type: text/plain, Size: 1060 bytes --]

Lukasz Stelmach wrote:

> I found it when I was trying to figure out why when trying to connect to
> 
> 2001:200:0:8002:203:47ff:fea5:3085 (www.kame.net)
> 
> with two global addresses assigned to the ethernet card
> 
> fd24:6f44:46bd:face::254
> 2002:531f:d667:face::254
> 
> rule 8 does not work and the first address is chosen.

The answer is that fc00::/7 matches 2001:: better because it gets the same
label (ipv6_saddr_label()). Although fc00::/7 addresses are defined as global
unicast IMHO they should be treated *slightly* different. This is the patch.
Since 6to4 has its own label I have decided to assign one to Teredo too.

However, I still haven't found any clue in referneces to unassigned value of
hiscore.addr_type.

-- 
Było mi bardzo miło.                    Czwarta pospolita klęska, [...]
>Łukasz<                      Już nie katolicka lecz złodziejska.  (c)PP


----------------------------------------------------------------------
Zobacz nowosci salonu moto w Madrycie >>> http://link.interia.pl/f1961

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: addrconf.diff --]
[-- Type: text/x-patch; name="addrconf.diff", Size: 575 bytes --]

--- /usr/src/linux/net/ipv6/addrconf.c~	2006-06-21 11:41:22.000000000 +0200
+++ /usr/src/linux/net/ipv6/addrconf.c	2006-06-21 15:33:26.000000000 +0200
@@ -862,6 +862,8 @@
   * 	2002::/16		2
   * 	::/96			3
   * 	::ffff:0:0/96		4
+  *	fc00::/7		5
+  * 	2001::/32		6
   */
 	if (type & IPV6_ADDR_LOOPBACK)
 		return 0;
@@ -871,6 +873,10 @@
 		return 4;
 	else if (addr->s6_addr16[0] == htons(0x2002))
 		return 2;
+	else if ((addr->s6_addr[0] & 0xfe) == 0xfc)
+		return 5;
+	else if (addr->s6_addr32[0] == htonl(0x20010000))
+		return 6;
 	return 1;
 }
 

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]

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

* Re: [patch] ipv6 source address selection in addrconf.c (2.6.17)
  2006-06-21 13:42 ` [patch] " Lukasz Stelmach
@ 2006-06-21 15:12   ` YOSHIFUJI Hideaki / 吉藤英明
  2006-06-21 16:05     ` Lukasz Stelmach
  0 siblings, 1 reply; 4+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2006-06-21 15:12 UTC (permalink / raw)
  To: stlman; +Cc: netdev

In article <44994CB3.6070302@poczta.fm> (at Wed, 21 Jun 2006 15:42:11 +0200), Lukasz Stelmach <stlman@poczta.fm> says:

> --- /usr/src/linux/net/ipv6/addrconf.c~	2006-06-21 11:41:22.000000000 +0200
> +++ /usr/src/linux/net/ipv6/addrconf.c	2006-06-21 15:33:26.000000000 +0200
> @@ -862,6 +862,8 @@
>    * 	2002::/16		2
>    * 	::/96			3
>    * 	::ffff:0:0/96		4
> +  *	fc00::/7		5
> +  * 	2001::/32		6
>    */
>  	if (type & IPV6_ADDR_LOOPBACK)
>  		return 0;
> @@ -871,6 +873,10 @@
>  		return 4;
>  	else if (addr->s6_addr16[0] == htons(0x2002))
>  		return 2;
> +	else if ((addr->s6_addr[0] & 0xfe) == 0xfc)
> +		return 5;
> +	else if (addr->s6_addr32[0] == htonl(0x20010000))
> +		return 6;
>  	return 1;
>  }
>  

Please put the comparison for 2001::/32 before 2002::/16.
Otherwise, I'm fine with it.

In addition, give us your sign-off, please.

Regards,

-- 
YOSHIFUJI Hideaki @ USAGI Project  <yoshfuji@linux-ipv6.org>
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA

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

* Re: [patch] ipv6 source address selection in addrconf.c (2.6.17)
  2006-06-21 15:12   ` YOSHIFUJI Hideaki / 吉藤英明
@ 2006-06-21 16:05     ` Lukasz Stelmach
  0 siblings, 0 replies; 4+ messages in thread
From: Lukasz Stelmach @ 2006-06-21 16:05 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki / 吉藤英明
  Cc: netdev, Łukasz Stelmach

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


- --- linux/net/ipv6/addrconf.c.orig	2006-06-21 11:41:22.000000000 +0200
+++ linux/net/ipv6/addrconf.c	2006-06-21 17:18:56.000000000 +0200
@@ -862,6 +862,8 @@ static int inline ipv6_saddr_label(const
   * 	2002::/16		2
   * 	::/96			3
   * 	::ffff:0:0/96		4
+  *	fc00::/7		5
+  * 	2001::/32		6
   */
 	if (type & IPV6_ADDR_LOOPBACK)
 		return 0;
@@ -869,8 +871,12 @@ static int inline ipv6_saddr_label(const
 		return 3;
 	else if (type & IPV6_ADDR_MAPPED)
 		return 4;
+	else if (addr->s6_addr32[0] == htonl(0x20010000))
+		return 6;
 	else if (addr->s6_addr16[0] == htons(0x2002))
 		return 2;
+	else if ((addr->s6_addr[0] & 0xfe) == 0xfc)
+		return 5;
 	return 1;
 }

Two additional labels (RFC 3484, sec. 10.3) for IPv6 addreses
are defined to make a distinction between global unicast
addresses and Unique Local Addresses (fc00::/7, RFC 4193) and
Teredo (2001::/32, RFC 4380). It is necessary to avoid attempts
of connection that would either fail (eg. fec0:: to 2001:feed::)
or be sub-optimal (2001:0:: to 2001:feed::).

	Signed-off-by: Łukasz Stelmach <stlman@poczta.fm>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD4DBQFEmW0LNdzY8sm9K9wRAjVGAKCOS1MVIro3bJ6szHzuAzaXXNaq/gCY4jfO
timfJc6SmrygMer36Tdqzg==
=Qzch
-----END PGP SIGNATURE-----

-- 
Było mi bardzo miło.                    Czwarta pospolita klęska, [...]
>Łukasz<                      Już nie katolicka lecz złodziejska.  (c)PP


----------------------------------------------------------------------
Zobacz nowosci salonu moto w Madrycie >>> http://link.interia.pl/f1961


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

* Re: [patch] ipv6 source address selection in addrconf.c (2.6.17)
       [not found] <20060622.011257.85558580.yoshfuji@linux-ipv6.org>
@ 2006-06-22  8:39 ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2006-06-22  8:39 UTC (permalink / raw)
  To: yoshfuji; +Cc: netdev

From: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Date: Thu, 22 Jun 2006 01:12:57 +0900 (JST)

> I think it is trivial enough to push this to -stable as well.
> 
> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

Ok, done.

Thanks a lot!

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

end of thread, other threads:[~2006-06-22  8:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20060622.011257.85558580.yoshfuji@linux-ipv6.org>
2006-06-22  8:39 ` [patch] ipv6 source address selection in addrconf.c (2.6.17) David Miller
2006-06-20 21:38 Lukasz Stelmach
2006-06-21 13:42 ` [patch] " Lukasz Stelmach
2006-06-21 15:12   ` YOSHIFUJI Hideaki / 吉藤英明
2006-06-21 16:05     ` Lukasz Stelmach

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