diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2010-05-08 10:55:07 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2010-05-08 10:55:07 +0000 |
commit | e1de4271f372f688511cd5a9c17a2ee15e749d90 (patch) | |
tree | f474e87a2aa561318a88dd414780bcb803ffad04 /sys/netinet6 | |
parent | 7701d700bc5fe131aabe1703ce8e852ab89a5d05 (diff) |
During IPv6 source address selection, prefer RFC 4941 temporary addresses
over other addresses configured on the same interface.
Facilitates peaceful coexistence of temporary addresses for outgoing
connections and static addresses for incoming connections.
Fix typo in comment while here.
ok claudio@
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/in6.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 6fc39b55ddc..08fb95b9bab 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.86 2010/02/08 12:04:35 jsing Exp $ */ +/* $OpenBSD: in6.c,v 1.87 2010/05/08 10:55:06 stsp Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -2330,6 +2330,22 @@ in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst) IN6_IFF_DEPRECATED) == 0) goto replace; + if (oifp == ifp) { + /* Do not replace temporary autoconf addresses + * with non-temporary addresses. */ + if ((ifa_best->ia6_flags & IN6_IFF_PRIVACY) && + !(((struct in6_ifaddr *)ifa)->ia6_flags & + IN6_IFF_PRIVACY)) + continue; + + /* Replace non-temporary autoconf addresses + * with temporary addresses. */ + if (!(ifa_best->ia6_flags & IN6_IFF_PRIVACY) && + (((struct in6_ifaddr *)ifa)->ia6_flags & + IN6_IFF_PRIVACY)) + goto replace; + } + /* * At this point, we have two cases: * 1. we are looking at a non-deprecated address, @@ -2375,7 +2391,7 @@ in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst) * equal equal larger N/A | Yes (8) * equal equal smaller N/A | No (9) * equal equal equal Yes | Yes (a) - * eaual eqaul equal No | No (b) + * equal equal equal No | No (b) */ dscopecmp = IN6_ARE_SCOPE_CMP(src_scope, dst_scope); bscopecmp = IN6_ARE_SCOPE_CMP(src_scope, best_scope); |