diff options
author | sam <sam@FreeBSD.org> | 2002-10-16 01:54:46 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2002-10-16 01:54:46 +0000 |
commit | 2a86be217a6aed33eda6628df2b175e49172cd9f (patch) | |
tree | b26e1e9f49b40642051748bcd3961cc2a2b5ff1d /sys/kern/subr_mbuf.c | |
parent | 733bfbdd78ddb9efc129532b2c2239d0bacfaf1a (diff) | |
download | FreeBSD-src-2a86be217a6aed33eda6628df2b175e49172cd9f.zip FreeBSD-src-2a86be217a6aed33eda6628df2b175e49172cd9f.tar.gz |
Replace aux mbufs with packet tags:
o instead of a list of mbufs use a list of m_tag structures a la openbsd
o for netgraph et. al. extend the stock openbsd m_tag to include a 32-bit
ABI/module number cookie
o for openbsd compatibility define a well-known cookie MTAG_ABI_COMPAT and
use this in defining openbsd-compatible m_tag_find and m_tag_get routines
o rewrite KAME use of aux mbufs in terms of packet tags
o eliminate the most heavily used aux mbufs by adding an additional struct
inpcb parameter to ip_output and ip6_output to allow the IPsec code to
locate the security policy to apply to outbound packets
o bump __FreeBSD_version so code can be conditionalized
o fixup ipfilter's call to ip_output based on __FreeBSD_version
Reviewed by: julian, luigi (silent), -arch, -net, darren
Approved by: julian, silence from everyone else
Obtained from: openbsd (mostly)
MFC after: 1 month
Diffstat (limited to 'sys/kern/subr_mbuf.c')
-rw-r--r-- | sys/kern/subr_mbuf.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/sys/kern/subr_mbuf.c b/sys/kern/subr_mbuf.c index b8dc867..87b9da6 100644 --- a/sys/kern/subr_mbuf.c +++ b/sys/kern/subr_mbuf.c @@ -1037,7 +1037,7 @@ mb_reclaim(void) (m)->m_flags = M_PKTHDR; \ (m)->m_pkthdr.rcvif = NULL; \ (m)->m_pkthdr.csum_flags = 0; \ - (m)->m_pkthdr.aux = NULL; \ + SLIST_INIT(&(m)->m_pkthdr.tags); \ } while (0) #define _mcl_setup(m) do { \ @@ -1333,11 +1333,8 @@ m_free(struct mbuf *mb) int cchnum; short persist = 0; - /* XXX: This check is bogus... please fix (see KAME). */ - if ((mb->m_flags & M_PKTHDR) != 0 && mb->m_pkthdr.aux) { - m_freem(mb->m_pkthdr.aux); - mb->m_pkthdr.aux = NULL; - } + if ((mb->m_flags & M_PKTHDR) != 0) + m_tag_delete_chain(mb, NULL); #ifdef MAC if ((mb->m_flags & M_PKTHDR) && (mb->m_pkthdr.label.l_flags & MAC_FLAG_INITIALIZED)) @@ -1371,8 +1368,7 @@ m_free(struct mbuf *mb) * we'll eventually be holding the lock across more than merely two * consecutive frees but right now this is hard to implement because of * things like _mext_dealloc_ref (may do a free()) and atomic ops in the - * loop, as well as the fact that we may recurse on m_freem() in - * m_pkthdr.aux != NULL cases. + * loop. * * - mb: the mbuf chain to free. */ @@ -1384,11 +1380,8 @@ m_freem(struct mbuf *mb) short persist; while (mb != NULL) { - /* XXX: This check is bogus... please fix (see KAME). */ - if ((mb->m_flags & M_PKTHDR) != 0 && mb->m_pkthdr.aux) { - m_freem(mb->m_pkthdr.aux); - mb->m_pkthdr.aux = NULL; - } + if ((mb->m_flags & M_PKTHDR) != 0) + m_tag_delete_chain(mb, NULL); #ifdef MAC if ((mb->m_flags & M_PKTHDR) && (mb->m_pkthdr.label.l_flags & MAC_FLAG_INITIALIZED)) @@ -1448,7 +1441,7 @@ m_getcl(int how, short type, int flags) mb->m_nextpkt = NULL; mb->m_pkthdr.rcvif = NULL; mb->m_pkthdr.csum_flags = 0; - mb->m_pkthdr.aux = NULL; + SLIST_INIT(&mb->m_pkthdr.tags); } mb->m_ext.ext_buf = (caddr_t)mb_alloc(&mb_list_clust, how, |