summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2008-11-26 16:48:16 +0000
committerclaudio <claudio@openbsd.org>2008-11-26 16:48:16 +0000
commit30e233493a620f96ccdd00818d5f8afa8d0bbf39 (patch)
tree8c429da29febe7f6f93b6a81f9de206c08085c59 /sys
parentStop maintaining internal queues of received scsi_xfer structures. (diff)
downloadwireguard-openbsd-30e233493a620f96ccdd00818d5f8afa8d0bbf39.tar.xz
wireguard-openbsd-30e233493a620f96ccdd00818d5f8afa8d0bbf39.zip
Make M_DUP_PKTHDR and M_MOVE_PKTHDR a bit saver by respecting the M_EXT &
M_CLUSTER flags from the target mbuf. Still these function are only allowed on newly allocated buffers. OK dlg@
Diffstat (limited to 'sys')
-rw-r--r--sys/sys/mbuf.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index 7d7cb027944..8103621a63d 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mbuf.h,v 1.116 2008/11/25 19:09:34 claudio Exp $ */
+/* $OpenBSD: mbuf.h,v 1.117 2008/11/26 16:48:16 claudio Exp $ */
/* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */
/*
@@ -301,9 +301,11 @@ struct mbuf {
* from must have M_PKTHDR set, and to must be empty.
*/
#define M_DUP_PKTHDR(to, from) do { \
- (to)->m_flags = (from)->m_flags & M_COPYFLAGS; \
+ (to)->m_flags = ((to)->m_flags & (M_EXT | M_CLUSTER)); \
+ (to)->m_flags |= (from)->m_flags & M_COPYFLAGS; \
M_DUP_HDR((to), (from)); \
- (to)->m_data = (to)->m_pktdat; \
+ if (((to)->m_flags & M_EXT) == 0) \
+ (to)->m_data = (to)->m_pktdat; \
} while (/* CONSTCOND */ 0)
/*
@@ -311,9 +313,11 @@ struct mbuf {
* from must have M_PKTHDR set, and to must be empty.
*/
#define M_MOVE_PKTHDR(to, from) do { \
- (to)->m_flags = (from)->m_flags & M_COPYFLAGS; \
+ (to)->m_flags = ((to)->m_flags & (M_EXT | M_CLUSTER)); \
+ (to)->m_flags |= (from)->m_flags & M_COPYFLAGS; \
M_MOVE_HDR((to), (from)); \
- (to)->m_data = (to)->m_pktdat; \
+ if (((to)->m_flags & M_EXT) == 0) \
+ (to)->m_data = (to)->m_pktdat; \
} while (/* CONSTCOND */ 0)
/*