summaryrefslogtreecommitdiff
path: root/sys/netinet/igmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet/igmp.c')
-rw-r--r--sys/netinet/igmp.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c
index f4c4bf03a9a..3a486107f76 100644
--- a/sys/netinet/igmp.c
+++ b/sys/netinet/igmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: igmp.c,v 1.48 2014/12/17 09:57:13 mpi Exp $ */
+/* $OpenBSD: igmp.c,v 1.49 2015/06/16 11:09:40 mpi Exp $ */
/* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */
/*
@@ -209,7 +209,7 @@ void
igmp_input(struct mbuf *m, ...)
{
int iphlen;
- struct ifnet *ifp = m->m_pkthdr.rcvif;
+ struct ifnet *ifp;
struct ip *ip = mtod(m, struct ip *);
struct igmp *igmp;
int igmplen;
@@ -229,6 +229,12 @@ igmp_input(struct mbuf *m, ...)
igmplen = ntohs(ip->ip_len) - iphlen;
+ ifp = if_get(m->m_pkthdr.ph_ifidx);
+ if (ifp == NULL) {
+ m_freem(m);
+ return;
+ }
+
/*
* Validate lengths
*/