]>
Commit | Line | Data |
---|---|---|
8a94cecc CW |
1 | From stable-bounces@linux.kernel.org Thu Jun 22 01:39:43 2006 |
2 | Date: Thu, 22 Jun 2006 01:39:05 -0700 (PDT) | |
3 | From: David Miller <davem@davemloft.net> | |
4 | To: stable@kernel.org | |
5 | Cc: | |
6 | Subject: IPV6: Fix source address selection. | |
7 | ||
fab9fc09 | 8 | From: Łukasz Stelmach <stlman@poczta.fm> |
8a94cecc CW |
9 | |
10 | Two additional labels (RFC 3484, sec. 10.3) for IPv6 addreses | |
11 | are defined to make a distinction between global unicast | |
12 | addresses and Unique Local Addresses (fc00::/7, RFC 4193) and | |
13 | Teredo (2001::/32, RFC 4380). It is necessary to avoid attempts | |
14 | of connection that would either fail (eg. fec0:: to 2001:feed::) | |
15 | or be sub-optimal (2001:0:: to 2001:feed::). | |
16 | ||
fab9fc09 | 17 | Signed-off-by: Łukasz Stelmach <stlman@poczta.fm> |
8a94cecc CW |
18 | Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> |
19 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
20 | Signed-off-by: Chris Wright <chrisw@sous-sol.org> | |
8a94cecc CW |
21 | --- |
22 | net/ipv6/addrconf.c | 6 ++++++ | |
23 | 1 file changed, 6 insertions(+) | |
24 | ||
25 | --- linux-2.6.17.1.orig/net/ipv6/addrconf.c | |
26 | +++ linux-2.6.17.1/net/ipv6/addrconf.c | |
27 | @@ -862,6 +862,8 @@ static int inline ipv6_saddr_label(const | |
28 | * 2002::/16 2 | |
29 | * ::/96 3 | |
30 | * ::ffff:0:0/96 4 | |
31 | + * fc00::/7 5 | |
32 | + * 2001::/32 6 | |
33 | */ | |
34 | if (type & IPV6_ADDR_LOOPBACK) | |
35 | return 0; | |
36 | @@ -869,8 +871,12 @@ static int inline ipv6_saddr_label(const | |
37 | return 3; | |
38 | else if (type & IPV6_ADDR_MAPPED) | |
39 | return 4; | |
40 | + else if (addr->s6_addr32[0] == htonl(0x20010000)) | |
41 | + return 6; | |
42 | else if (addr->s6_addr16[0] == htons(0x2002)) | |
43 | return 2; | |
44 | + else if ((addr->s6_addr[0] & 0xfe) == 0xfc) | |
45 | + return 5; | |
46 | return 1; | |
47 | } | |
48 |