PERFORCE change 113322 for review

Todd Miller millert at FreeBSD.org
Mon Jan 22 15:20:39 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=113322

Change 113322 by millert at millert_macbook on 2007/01/22 15:19:53

	Use m_dup_pkthdr() instead of M_COPY_PKTHDR() in m_copym()
	and m_copym_with_hdrs() since with MAC, M_COPY_PKTHDR()
	moves the mbuf tags instead of copying them, which effectively
	leaves the source mbuf unlabeled.
	
	Also need to zero out m_pkthdr.aux in the source mbuf after
	m_dup_pkthdr().  m_copy_pkthdr() did this for us but
	m_dup_pkthdr() does not.

Affected files ...

.. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/kern/uipc_mbuf.c#6 edit

Differences ...

==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/kern/uipc_mbuf.c#6 (text+ko) ====

@@ -1536,7 +1536,11 @@
 		if (n == 0)
 			goto nospace;
 		if (copyhdr) {
-			M_COPY_PKTHDR(n, m);
+			MBUF_UNLOCK();
+			if (!m_dup_pkthdr(n, m, wait))
+				goto nospace_unlock;
+			MBUF_LOCK();
+			m->m_pkthdr.aux = (struct mbuf *)NULL;
 			if (len == M_COPYALL)
 				n->m_pkthdr.len -= off0;
 			else
@@ -1579,6 +1583,7 @@
 nospace:
 	MBUF_UNLOCK();
 
+nospace_unlock:
 	m_freem(top);
 	MCFail++;
 	return (0);
@@ -1677,7 +1682,11 @@
 		        *np = n;
 
 		if (copyhdr) {
-			M_COPY_PKTHDR(n, m);
+			MBUF_UNLOCK();
+			if (!m_dup_pkthdr(n, m, wait))
+				goto nospace_unlock;
+			MBUF_LOCK();
+			m->m_pkthdr.aux = (struct mbuf *)NULL;
 			n->m_pkthdr.len = len;
 			copyhdr = 0;
 		}


More information about the p4-projects mailing list