netdev
[Top] [All Lists]

Re: [PATCH][BRIDGE-NF] Fix wrong use of skb->protocol

To: Bart De Schuymer <bdschuym@xxxxxxxxxx>
Subject: Re: [PATCH][BRIDGE-NF] Fix wrong use of skb->protocol
From: Patrick McHardy <kaber@xxxxxxxxx>
Date: Fri, 31 Dec 2004 01:33:15 +0100
Cc: Lennert Buytenhek <buytenh@xxxxxxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, netdev@xxxxxxxxxxx, snort2004@xxxxxxx
In-reply-to: <1104448248.15601.55.camel@xxxxxxxxxxxxxxxxxxxxx>
References: <1104432914.15601.19.camel@xxxxxxxxxxxxxxxxxxxxx> <20041230222415.GB19587@xxxxxxxxxxxxxxxxx> <1104448248.15601.55.camel@xxxxxxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5
Bart De Schuymer wrote:
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.

It is set shortly before the packet leaves the IP stack,
in ip_finish_output. This is after LOCAL_OUT, but before
POST_ROUTING. So your fix looks fine.

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.

The IP stack knows it's IP anyway :) After that it has to
hold the right value.

Regards
Patrick

<Prev in Thread] Current Thread [Next in Thread>