diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2015-09-10 14:02:36 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2015-09-10 14:02:36 +0000 |
commit | e1587e4188d630a330e92ff4f1d302d712bcd763 (patch) | |
tree | c72438228ce2359e49d19add6368150b85717a28 /sys/netinet6/in6.c | |
parent | bd311681f56613760b8fdd44acc358a7722dc8a0 (diff) |
In IPv6 source address selection prefer addresses of the outgoing
interface.
OK mpi@
Diffstat (limited to 'sys/netinet6/in6.c')
-rw-r--r-- | sys/netinet6/in6.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 18efe274793..60cb6ee77c6 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.172 2015/09/10 08:45:32 claudio Exp $ */ +/* $OpenBSD: in6.c,v 1.173 2015/09/10 14:02:35 bluhm Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -1802,6 +1802,12 @@ in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst, u_int rdomain) IN6_IFF_DEPRECATED) == 0) goto replace; + /* RFC 3484 5. Rule 5: Prefer outgoing interface */ + if (ia6_best->ia_ifp == oifp && ifp != oifp) + continue; + if (ia6_best->ia_ifp != oifp && ifp == oifp) + goto replace; + /* * At this point, we have two cases: * 1. we are looking at a non-deprecated address, |