Index: sys/mbuf.h =================================================================== RCS file: /home/ncvs/src/sys/sys/mbuf.h,v retrieving revision 1.96 diff -u -r1.96 mbuf.h --- sys/mbuf.h 15 Jul 2002 15:32:59 -0000 1.96 +++ sys/mbuf.h 30 Jul 2002 18:19:21 -0000 @@ -317,15 +317,7 @@ * "from" must have M_PKTHDR set, and "to" must be empty. * aux pointer will be moved to "to". */ -#define M_COPY_PKTHDR(to, from) do { \ - struct mbuf *_mfrom = (from); \ - struct mbuf *_mto = (to); \ - \ - _mto->m_data = _mto->m_pktdat; \ - _mto->m_flags = _mfrom->m_flags & M_COPYFLAGS; \ - _mto->m_pkthdr = _mfrom->m_pkthdr; \ - _mfrom->m_pkthdr.aux = NULL; \ -} while (0) +#define M_COPY_PKTHDR(to, from) m_copy_pkthdr(to, from) /* * Set the m_data pointer of a newly-allocated mbuf (m_get/MGET) to place @@ -487,6 +479,7 @@ void m_copydata(const struct mbuf *, int, int, caddr_t); struct mbuf *m_copym(struct mbuf *, int, int, int); struct mbuf *m_copypacket(struct mbuf *, int); +void m_copy_pkthdr(struct mbuf *to, struct mbuf *from); struct mbuf *m_devget(char *, int, int, struct ifnet *, void (*copy)(char *, caddr_t, u_int)); struct mbuf *m_dup(struct mbuf *, int); Index: kern/uipc_mbuf.c =================================================================== RCS file: /home/ncvs/src/sys/kern/uipc_mbuf.c,v retrieving revision 1.94 diff -u -r1.94 uipc_mbuf.c --- kern/uipc_mbuf.c 24 Jul 2002 15:11:23 -0000 1.94 +++ kern/uipc_mbuf.c 30 Jul 2002 18:19:21 -0000 @@ -62,6 +62,20 @@ SYSCTL_INT(_kern_ipc, KIPC_MAX_DATALEN, max_datalen, CTLFLAG_RW, &max_datalen, 0, ""); +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,