diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2007-09-26 13:05:53 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2007-09-26 13:05:53 +0000 |
commit | 840875529f90055d075f45cd3b26a4ec8ad20d44 (patch) | |
tree | 8e500d02eed906b5308f5b97cf1263bf483dfada /sys/kern | |
parent | 7c7b7adabcdab5abf6ac15d613f20c313ec47ec1 (diff) |
provide m_inithdr(), which takes an mbuf and gives an initialized M_PKTHDR
mbuf back.
for fixing PR5563 in a few, tested janjaap@stack.nl, ok claudio
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/uipc_mbuf.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 5bec7746a28..c95648a262a 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_mbuf.c,v 1.85 2007/07/20 09:59:19 claudio Exp $ */ +/* $OpenBSD: uipc_mbuf.c,v 1.86 2007/09/26 13:05:52 henning Exp $ */ /* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */ /* @@ -186,6 +186,8 @@ m_gethdr(int nowait, int type) if (m) { m->m_type = type; mbstat.m_mtypes[type]++; + + /* keep in sync with m_inithdr */ m->m_next = (struct mbuf *)NULL; m->m_nextpkt = (struct mbuf *)NULL; m->m_data = m->m_pktdat; @@ -205,6 +207,27 @@ m_gethdr(int nowait, int type) } struct mbuf * +m_inithdr(struct mbuf *m) +{ + /* keep in sync with m_gethdr */ + m->m_next = (struct mbuf *)NULL; + m->m_nextpkt = (struct mbuf *)NULL; + m->m_data = m->m_pktdat; + m->m_flags = M_PKTHDR; + m->m_pkthdr.rcvif = NULL; + SLIST_INIT(&m->m_pkthdr.tags); + m->m_pkthdr.csum_flags = 0; + m->m_pkthdr.pf.hdr = NULL; + m->m_pkthdr.pf.rtableid = 0; + m->m_pkthdr.pf.qid = 0; + m->m_pkthdr.pf.tag = 0; + m->m_pkthdr.pf.flags = 0; + m->m_pkthdr.pf.routed = 0; + + return (m); +} + +struct mbuf * m_getclr(int nowait, int type) { struct mbuf *m; |