Received: with ECARTIS (v1.0.0; list netdev); Thu, 30 Dec 2004 14:58:29 -0800 (PST) Received: from adicia.telenet-ops.be (adicia.telenet-ops.be [195.130.132.56]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id iBUMw0vH002223 for ; Thu, 30 Dec 2004 14:58:21 -0800 Received: from localhost (localhost.localdomain [127.0.0.1]) by adicia.telenet-ops.be (Postfix) with SMTP id 28BF8441FE; Fri, 31 Dec 2004 00:06:35 +0100 (MET) Received: from 192.168.0.138 (D5763CA9.kabel.telenet.be [213.118.60.169]) by adicia.telenet-ops.be (Postfix) with ESMTP id C3F324408A; Fri, 31 Dec 2004 00:06:34 +0100 (MET) Subject: Re: [PATCH][BRIDGE-NF] Fix wrong use of skb->protocol From: Bart De Schuymer To: Lennert Buytenhek Cc: "David S. Miller" , netdev@oss.sgi.com, snort2004@mail.ru In-Reply-To: <20041230222415.GB19587@xi.wantstofly.org> References: <1104432914.15601.19.camel@localhost.localdomain> <20041230222415.GB19587@xi.wantstofly.org> Content-Type: text/plain Date: Fri, 31 Dec 2004 00:10:48 +0100 Message-Id: <1104448248.15601.55.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-3) Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.80/645/Mon Dec 27 14:56:20 2004 clamav-milter version 0.80j on 127.0.0.1 X-Virus-Status: Clean X-archive-position: 13259 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: bdschuym@pandora.be Precedence: bulk X-list: netdev Op do, 30-12-2004 te 23:24 +0100, schreef Lennert Buytenhek: > On Thu, Dec 30, 2004 at 07:55:14PM +0100, Bart De Schuymer wrote: > > > ip_sabotage_out() needs to distinguish IPv4 and IPv6 traffic. It > > currently does that by looking at skb->protocol. However, for locally > > originated packets, skb->protocol is not initialized. > > The patch below instead looks at the version number of the packet's > > data, which should be 4 or 6. > > A while ago there were a number of problems with bridging CIPE ethernet > devices, which turned out to be the bridge code not initialising > skb->protocol for locally originated STP frames. > > At the time I was told that initialising skb->protocol for locally > originated packets is required, so that is how I fixed it then. Hi Lennert, skb->protocol is not set for locally generated packets when the packet is still in the IP stack. I don't know what happens with it after the IP stack is finished with the packet. The comment in skbuff.h says "packet protocol from driver", from which I tend to conclude that skb->protocol is only set by drivers when a packet enters the box. Too bad stuff like this isn't clearly spelled out, the FIXME for the dst field has been sitting there for probably more than a year too. Anyway, it wouldn't hurt if the skb->protocol field always held the right value. cheers, Bart