summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorangelos <angelos@openbsd.org>2000-04-18 06:35:02 +0000
committerangelos <angelos@openbsd.org>2000-04-18 06:35:02 +0000
commit834deb6a51ab36829a33c043eabc093ffc3815b9 (patch)
treefc2ee84d2e07aff895615b5abec90d44db809b8b
parentcd detach (diff)
downloadwireguard-openbsd-834deb6a51ab36829a33c043eabc093ffc3815b9.tar.xz
wireguard-openbsd-834deb6a51ab36829a33c043eabc093ffc3815b9.zip
Sanity check on dequeued mbufs, also keep track of correct interface
for statistics purposes.
-rw-r--r--sys/net/if_enc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/net/if_enc.c b/sys/net/if_enc.c
index 329a342d690..74cf10e5e2d 100644
--- a/sys/net/if_enc.c
+++ b/sys/net/if_enc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_enc.c,v 1.28 2000/04/12 18:05:47 angelos Exp $ */
+/* $OpenBSD: if_enc.c,v 1.29 2000/04/18 06:35:02 angelos Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
@@ -239,7 +239,15 @@ struct ifnet *ifp;
if (m == NULL) /* Empty queue */
return;
+
+ /* Sanity check */
+ if ((m->m_flags & M_PKTHDR) == 0)
+ {
+ m_freem(m);
+ continue;
+ }
+ m->m_pkthdr.rcvif = ifp;
mp = NULL;
/* Encapsulate in etherip or ip-in-ip, depending on interface flag */