]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.17.2/ipv6-fix-source-address-selection.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.17.2 / ipv6-fix-source-address-selection.patch
CommitLineData
8a94cecc
CW
1From stable-bounces@linux.kernel.org Thu Jun 22 01:39:43 2006
2Date: Thu, 22 Jun 2006 01:39:05 -0700 (PDT)
3From: David Miller <davem@davemloft.net>
4To: stable@kernel.org
5Cc:
6Subject: IPV6: Fix source address selection.
7
fab9fc09 8From: Łukasz Stelmach <stlman@poczta.fm>
8a94cecc
CW
9
10Two additional labels (RFC 3484, sec. 10.3) for IPv6 addreses
11are defined to make a distinction between global unicast
12addresses and Unique Local Addresses (fc00::/7, RFC 4193) and
13Teredo (2001::/32, RFC 4380). It is necessary to avoid attempts
14of connection that would either fail (eg. fec0:: to 2001:feed::)
15or be sub-optimal (2001:0:: to 2001:feed::).
16
fab9fc09 17Signed-off-by: Łukasz Stelmach <stlman@poczta.fm>
8a94cecc
CW
18Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
19Signed-off-by: David S. Miller <davem@davemloft.net>
20Signed-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