From: mpi Date: Thu, 21 Aug 2014 10:07:07 +0000 (+0000) Subject: If an ifa has as NULL ifp pointer then is should be considered as X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0c4b27b8e5679d494df4479a49d6035d3d36d94f;p=openbsd 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@ --- 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) {