diff options
author | shin <shin@FreeBSD.org> | 2000-02-07 01:32:41 +0000 |
---|---|---|
committer | shin <shin@FreeBSD.org> | 2000-02-07 01:32:41 +0000 |
commit | f70608d097453462b734b50effa7e049dd9c2bae (patch) | |
tree | b1c40288f50ae6b7ca56273101a58228f1b372be /sys/netinet6/in6.c | |
parent | 67ff6efc68d0c0596659fc9ac95df21a77ff603b (diff) | |
download | FreeBSD-src-f70608d097453462b734b50effa7e049dd9c2bae.zip FreeBSD-src-f70608d097453462b734b50effa7e049dd9c2bae.tar.gz |
Permit site local addr in IPv6 source address selection rule.
KAME source addr selection rule had a problem to treat IPv6 site
local addr.
The rule is completely rewritten recently and the above problem
is also fixed, but rewriting same code part in freebsd4.0 is too
dangerous in this stage, so just add workaround to avoid
the problem. Just add code for IPv6 site local addresses into IPv6
source addr selection algorythm part.
Diffstat (limited to 'sys/netinet6/in6.c')
-rw-r--r-- | sys/netinet6/in6.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index d744b04..234bd52 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1564,9 +1564,9 @@ in6_ifawithscope(ifp, dst) int dst_scope = in6_addrscope(dst), blen = -1, tlen; struct ifaddr *ifa; struct in6_ifaddr *besta = NULL, *ia; - struct in6_ifaddr *dep[2]; /*last-resort: deprecated*/ + struct in6_ifaddr *dep[3]; /*last-resort: deprecated*/ - dep[0] = dep[1] = NULL; + dep[0] = dep[1] = dep[2] = NULL; /* * We first look for addresses in the same scope. @@ -1628,11 +1628,32 @@ in6_ifawithscope(ifp, dst) return ia; } + for (ia = in6_ifaddr; ia; ia = ia->ia_next) { + if (IPV6_ADDR_SCOPE_SITELOCAL != + in6_addrscope(&(ia->ia_addr.sin6_addr))) + continue; + /* XXX: is there any case to allow anycast? */ + if ((ia->ia6_flags & IN6_IFF_ANYCAST) != 0) + continue; + if ((ia->ia6_flags & IN6_IFF_NOTREADY) != 0) + continue; + if ((ia->ia6_flags & IN6_IFF_DETACHED) != 0) + continue; + if ((ia->ia6_flags & IN6_IFF_DEPRECATED) != 0) { + if (ip6_use_deprecated) + dep[2] = (struct in6_ifaddr *)ifa; + continue; + } + return ia; + } + /* use the last-resort values, that are, deprecated addresses */ if (dep[0]) return dep[0]; if (dep[1]) return dep[1]; + if (dep[2]) + return dep[2]; return NULL; } |