summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2015-10-22 16:44:55 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2015-10-22 16:44:55 +0000
commitae355dd8b66edf5551dca2f929a404046784b953 (patch)
treee29a9ef351112318241a187e7a3bb183d9086904 /sys/net
parent0489c9050cea3b779b7fe6bd7daa13df7a9db206 (diff)
Make sure that the address matching the key (destination) of a route
entry is attached to this entry. ok phessler@, bluhm@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index fb1e0aecb8f..332303834b2 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.391 2015/10/22 15:37:47 bluhm Exp $ */
+/* $OpenBSD: if.c,v 1.392 2015/10/22 16:44:54 mpi Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -1321,6 +1321,8 @@ p2p_rtrequest(int req, struct rtentry *rt)
if (ifa == NULL)
break;
+ KASSERT(ifa == rt->rt_ifa);
+
/*
* XXX Since lo0 is in the default rdomain we should not
* (ab)use it for any route related to an interface of a
@@ -1335,17 +1337,6 @@ p2p_rtrequest(int req, struct rtentry *rt)
break;
rt->rt_flags &= ~RTF_LLINFO;
-
- /*
- * make sure to set rt->rt_ifa to the interface
- * address we are using, otherwise we will have trouble
- * with source address selection.
- */
- if (ifa != rt->rt_ifa) {
- ifafree(rt->rt_ifa);
- ifa->ifa_refcnt++;
- rt->rt_ifa = ifa;
- }
break;
case RTM_DELETE:
case RTM_RESOLVE: