aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/uipc_mbuf.c
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2002-07-30 18:28:58 +0000
committerRobert Watson <rwatson@FreeBSD.org>2002-07-30 18:28:58 +0000
commite37b1fcdeef8f6dc069f08cc3ca7b50cb199cb79 (patch)
tree91ad33cffc9e42a558c99f2a5af6abe2628bfb89 /sys/kern/uipc_mbuf.c
parentca095220db8fbf69d201d739aa0090f1ab958a56 (diff)
downloadsrc-e37b1fcdeef8f6dc069f08cc3ca7b50cb199cb79.tar.gz
src-e37b1fcdeef8f6dc069f08cc3ca7b50cb199cb79.zip
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
Notes
Notes: svn path=/head/; revision=100960
Diffstat (limited to 'sys/kern/uipc_mbuf.c')
-rw-r--r--sys/kern/uipc_mbuf.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 2c74a4c04fda..e8a679ed8d86 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.