m_dup oddity -- creates mbuf chains with cluster containing 208
bytes of data
Ed Maste
emaste at phaedrus.sandvine.ca
Wed Dec 14 10:07:51 PST 2005
A colleague discovered an oddity with m_dup(9), in that duping an
mbuf with 209 or more bytes of data creates a chain with 208 bytes
of data in a cluster attached to the first mbuf, with the rest of
the data chained on the end.
It seemed this behaviour appeared in v 1.130 of uipc_mbuf.c. The
patch below restores the behaviour of putting MCLBYTES into the
initial mbuf cluster.
Comments?
Index: uipc_mbuf.c
===================================================================
RCS file: /usr/cvs/src/sys/kern/uipc_mbuf.c,v
retrieving revision 1.159
diff -u -u -3 -r1.159 uipc_mbuf.c
--- uipc_mbuf.c 8 Dec 2005 13:13:05 -0000 1.159
+++ uipc_mbuf.c 14 Dec 2005 15:54:06 -0000
@@ -849,7 +849,8 @@
m_free(n);
goto nospace;
}
- nsize = MHLEN;
+ if ((n->m_flags & M_EXT) == 0)
+ nsize = MHLEN;
}
n->m_len = 0;
--
Ed Maste, Sandvine Incorporated
More information about the freebsd-net
mailing list