summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2015-10-30 12:54:37 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2015-10-30 12:54:37 +0000
commitc8467f89a5663b92781c07e7812031a12f2801b5 (patch)
treeba14c6e86538863fe000d0bcb7d528ce100bfc50 /sys/kern
parentcec717f7712015bf2b0130106c0aaf5bbdb1a684 (diff)
Add m_resethdr() to clear any state (pf, tags, flags) of an mbuf packet.
Start using it in pair(4) to clear state on the receiving interface; m_resethdr() will also be used in other parts of the stack. OK bluhm@ mikeb@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_mbuf.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 79443d4cb3b..2c8f87a90da 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_mbuf.c,v 1.208 2015/10/22 05:26:06 dlg Exp $ */
+/* $OpenBSD: uipc_mbuf.c,v 1.209 2015/10/30 12:54:36 reyk Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */
/*
@@ -250,6 +250,18 @@ m_inithdr(struct mbuf *m)
return (m);
}
+void
+m_resethdr(struct mbuf *m)
+{
+ /* like the previous, but keep any associated data and mbufs */
+ m->m_flags = M_PKTHDR;
+ memset(&m->m_pkthdr.pf, 0, sizeof(m->m_pkthdr.pf));
+ m->m_pkthdr.pf.prio = IFQ_DEFPRIO;
+
+ /* also delete all mbuf tags to reset the state */
+ m_tag_delete_chain(m);
+}
+
struct mbuf *
m_getclr(int nowait, int type)
{