Browse files

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
  • Loading branch information...
1 parent d11f8ce commit 66acd3ba6eb9d3017cc3cdf36d1268749512dd82 @bms bms committed Jun 18, 2004
Showing with 2 additions and 1 deletion.
  1. +2 −1 sys/netinet/ip_input.c
@@ -587,7 +587,8 @@ ip_input(struct mbuf *m)
* 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)

0 comments on commit 66acd3b

Please sign in to comment.