summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/netinet6/in6.c8
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,