From 4f450ff9a51de08576ddf3d9e883e7b16daf76eb Mon Sep 17 00:00:00 2001 From: Bruce M Simpson Date: Fri, 18 Jun 2004 12:58:45 +0000 Subject: [PATCH] Check that m->m_pkthdr.rcvif is not NULL before checking if a packet was received on a broadcast address on the input path. Under certain circumstances this could result in a panic, notably for locally-generated packets which do not have m_pkthdr.rcvif set. This is a similar situation to that which is solved by src/sys/netinet/ip_icmp.c rev 1.66. PR: kern/52935 --- sys/netinet/ip_input.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index a84ed078ac46..048f6130f64c 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -587,7 +587,8 @@ pass: * be handled via ip_forward() and ether_output() with the loopback * into the stack for SIMPLEX interfaces handled by ether_output(). */ - if (m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST) { + if (m->m_pkthdr.rcvif != NULL && + m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST) { TAILQ_FOREACH(ifa, &m->m_pkthdr.rcvif->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET) continue;