diff options
author | rwatson <rwatson@FreeBSD.org> | 2002-07-30 18:28:58 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2002-07-30 18:28:58 +0000 |
commit | f41233d2cf47a661abee65d4a6dce082cf02432d (patch) | |
tree | 91ad33cffc9e42a558c99f2a5af6abe2628bfb89 /sys/kern/uipc_mbuf.c | |
parent | 1c6108c052f57baa18dabe12442da2df87a622ca (diff) | |
download | FreeBSD-src-f41233d2cf47a661abee65d4a6dce082cf02432d.zip FreeBSD-src-f41233d2cf47a661abee65d4a6dce082cf02432d.tar.gz |
Make M_COPY_PKTHDR() macro into a wrapper for a m_copy_pkthdr()
function. This permits conditionally compiled extensions to the
packet header copying semantic, such as extensions to copy MAC
labels.
Reviewed by: bmilekic
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
Diffstat (limited to 'sys/kern/uipc_mbuf.c')
-rw-r--r-- | sys/kern/uipc_mbuf.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 2c74a4c..e8a679e 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -63,6 +63,25 @@ SYSCTL_INT(_kern_ipc, KIPC_MAX_DATALEN, max_datalen, CTLFLAG_RW, &max_datalen, 0, ""); /* + * Copy mbuf pkthdr from "from" to "to". + * "from" must have M_PKTHDR set, and "to" must be empty. + * aux pointer will be moved to "to". + */ +void +m_copy_pkthdr(struct mbuf *to, struct mbuf *from) +{ + +#if 0 + KASSERT(to->m_flags & M_PKTHDR, + ("m_copy_pkthdr() called on non-header")); +#endif + to->m_data = to->m_pktdat; + to->m_flags = from->m_flags & M_COPYFLAGS; + to->m_pkthdr = from->m_pkthdr; + from->m_pkthdr.aux = NULL; +} + +/* * Lesser-used path for M_PREPEND: * allocate new mbuf to prepend to chain, * copy junk along. |