From owner-freebsd-net@FreeBSD.ORG Wed Dec 14 18:07:51 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C93F116A41F for ; Wed, 14 Dec 2005 18:07:51 +0000 (GMT) (envelope-from emaste@phaedrus.sandvine.ca) Received: from mailserver.sandvine.com (sandvine.com [199.243.201.138]) by mx1.FreeBSD.org (Postfix) with ESMTP id CE86643D5A for ; Wed, 14 Dec 2005 18:07:50 +0000 (GMT) (envelope-from emaste@phaedrus.sandvine.ca) Received: from labgw2.phaedrus.sandvine.com ([192.168.3.11]) by mailserver.sandvine.com with Microsoft SMTPSVC(5.0.2195.6713); Wed, 14 Dec 2005 13:06:52 -0500 Received: by labgw2.phaedrus.sandvine.com (Postfix, from userid 12627) id D2A1B1365B; Wed, 14 Dec 2005 13:07:48 -0500 (EST) Date: Wed, 14 Dec 2005 13:07:48 -0500 From: Ed Maste To: freebsd-net@freebsd.org Message-ID: <20051214180748.GC629@sandvine.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-OriginalArrivalTime: 14 Dec 2005 18:06:52.0968 (UTC) FILETIME=[296EFA80:01C600D9] Subject: m_dup oddity -- creates mbuf chains with cluster containing 208 bytes of data X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Dec 2005 18:07:51 -0000 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