diff options
author | Łukasz Stelmach <stlman@poczta.fm> | 2006-06-22 01:37:19 -0700 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-06-23 02:07:22 -0700 |
commit | 102128e3a27821bdcbacb10f4f2bba253f587ba4 (patch) | |
tree | bbde6e385045eea27c5e8aeae051ac420a5cda92 /net/ipv6/addrconf.c | |
parent | 5b057c6b1a25d57edf2b4d1e956e50936480a9ff (diff) | |
download | kernel_samsung_espresso10-102128e3a27821bdcbacb10f4f2bba253f587ba4.zip kernel_samsung_espresso10-102128e3a27821bdcbacb10f4f2bba253f587ba4.tar.gz kernel_samsung_espresso10-102128e3a27821bdcbacb10f4f2bba253f587ba4.tar.bz2 |
[IPV6]: Fix source address selection.
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>
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r-- | net/ipv6/addrconf.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index c2c26fa..6b361fc 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -862,6 +862,8 @@ static int inline ipv6_saddr_label(const struct in6_addr *addr, int type) * 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 struct in6_addr *addr, int type) 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; } |