diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index e8a679ed8d8..4d66465b7c4 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -34,12 +34,15 @@ * $FreeBSD$ */ +#include "opt_mac.h" #include "opt_param.h" + #include #include #include #include #include +#include #include #include #include @@ -74,10 +77,18 @@ 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 +#ifdef MAC + if (to->m_flags & M_PKTHDR) + mac_destroy_mbuf(to); #endif to->m_data = to->m_pktdat; to->m_flags = from->m_flags & M_COPYFLAGS; to->m_pkthdr = from->m_pkthdr; +#ifdef MAC + mac_init_mbuf(to, 1); /* XXXMAC no way to fail */ + mac_create_mbuf_from_mbuf(from, to); +#endif from->m_pkthdr.aux = NULL; } @@ -98,6 +109,9 @@ m_prepend(struct mbuf *m, int len, int how) } if (m->m_flags & M_PKTHDR) { M_COPY_PKTHDR(mn, m); +#ifdef MAC + mac_destroy_mbuf(m); +#endif m->m_flags &= ~M_PKTHDR; } mn->m_next = m;