summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2014-08-21 10:07:08 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2014-08-21 10:07:08 +0000
commit25ae37e898b3bbdff05265d5a19a2dd3bc91df47 (patch)
tree6dfc2368477f6c45fc53339a3a533b0fd0bbcb72
parent0a83e31c69f4a4eee2fc849eddff907100657a4d (diff)
If an ifa has as NULL ifp pointer then is should be considered as
invalid. When such thing happens, it means that the address is no longer configured on the system but still referenced by some routes. So do not return such ifa in ifa_ifwithroute(). Fix a panic reported by Pierre Bardou. ok mikeb@, henning@
-rw-r--r--sys/net/route.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index b31351c13cb..e1bf33efa4f 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.179 2014/08/19 12:49:41 mpi Exp $ */
+/* $OpenBSD: route.c,v 1.180 2014/08/21 10:07:07 mpi Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -680,7 +680,8 @@ ifa_ifwithroute(int flags, struct sockaddr *dst, struct sockaddr *gateway,
if ((rt->rt_flags & RTF_GATEWAY) &&
rt_key(rt)->sa_family == dst->sa_family)
return (NULL);
- if ((ifa = rt->rt_ifa) == NULL)
+ ifa = rt->rt_ifa;
+ if (ifa == NULL || ifa->ifa_ifp == NULL)
return (NULL);
}
if (ifa->ifa_addr->sa_family != dst->sa_family) {