From owner-freebsd-net@FreeBSD.ORG Sat Aug 30 04:35:16 2008 Return-Path: Delivered-To: net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94A07106564A; Sat, 30 Aug 2008 04:35:16 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from ebb.errno.com (ebb.errno.com [69.12.149.25]) by mx1.freebsd.org (Postfix) with ESMTP id 3EE488FC18; Sat, 30 Aug 2008 04:35:16 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from trouble.errno.com (trouble.errno.com [10.0.0.248]) (authenticated bits=0) by ebb.errno.com (8.13.6/8.12.6) with ESMTP id m7U4ZEwH065379 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 29 Aug 2008 21:35:14 -0700 (PDT) (envelope-from sam@freebsd.org) Message-ID: <48B8CE01.6010604@freebsd.org> Date: Fri, 29 Aug 2008 21:35:13 -0700 From: Sam Leffler Organization: FreeBSD Project User-Agent: Thunderbird 2.0.0.9 (X11/20071125) MIME-Version: 1.0 To: Andrew Thompson References: <20080825190207.GA73478@zibbi.meraka.csir.co.za> <20080825194038.GA75840@zibbi.meraka.csir.co.za> <20080826144130.S66593@maildrop.int.zabbadoz.net> <48B4A62D.3080300@freebsd.org> <20080829162853.GB46693@onelab2.iet.unipi.it> <48B8248A.3060103@freebsd.org> <20080829164145.GA47030@onelab2.iet.unipi.it> <20080829223546.GG98483@citylink.fud.org.nz> In-Reply-To: <20080829223546.GG98483@citylink.fud.org.nz> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-DCC--Metrics: ebb.errno.com; whitelist Cc: "Bjoern A. Zeeb" , net@freebsd.org, Luigi Rizzo , gnn@freebsd.org Subject: Re: Small patch to multicast code... 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: Sat, 30 Aug 2008 04:35:16 -0000 Andrew Thompson wrote: > On Fri, Aug 29, 2008 at 06:41:45PM +0200, Luigi Rizzo wrote: > >> On Fri, Aug 29, 2008 at 09:32:10AM -0700, Sam Leffler wrote: >> >>> Luigi Rizzo wrote: >>> >> ... >> >>>> and to be more explicit - the result of m_pullup is that >>>> the number of bytes specified as m_pullup argument are in >>>> a private piece of memory -- the 'data' region within the mbuf -- so >>>> you can freely play with them without trouble. >>>> >>>> That is why i suggested to just increase the argument to m_pullup >>>> by the size of the udp header so one can overwrite the checksum >>>> within the mbuf without touching the shared part in the cluster >>>> (if any). >>>> >>>> >>> Hmm, never considered the m_pullup guaranteed a private copy (but I see >>> it in the code). The original semantics were just that the data was >>> contiguous. >>> >> funny, i thought the guarantee of a writable copy was also part >> of the original semantics :) >> > > The bridge code does a deep copy of the packet for each interface it > broadcasts on due the firewall code modifying the headers. It sounds > like this should just be a copy+pullup instead. > > I'd not do that. I think there are paths that assume the deep copy. Right now the network code is very poor honoring read-only-ness of mbuf chains. To get this right we need to do a good audit. I know I hit issues when doing some tricks w/ marking rx buffers read-only to avoid cache flushes. netbsd trys to be more pedantic but still has problems too. Sam