From: Eric Dumazet <eric.dumazet@gmail.com>
To: Erik Hugne <erik.hugne@ericsson.com>
Cc: netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net,
jon.maloy@ericsson.com, ying.xue@windriver.com
Subject: Re: skbs delivered to 'wrong' packet_type handler
Date: Wed, 07 Aug 2013 06:55:43 -0700 [thread overview]
Message-ID: <1375883743.4004.26.camel@edumazet-glaptop> (raw)
In-Reply-To: <20130807130856.GI3165@eerihug-hybrid.rnd.ki.sw.ericsson.se>
On Wed, 2013-08-07 at 15:08 +0200, Erik Hugne wrote:
> We have a race condition in TIPC when using both the parent ethernet
> device, and a vlan on top of this device as TIPC bearers. For some reason,
> net/core/dev.c is delivering vlan packets to packet handlers registered to
> the native device. This only seems to occur when a packet_type handler is
> registered on both the vlan device and it's parent ethernet device. This
> causes all kinds of weird behaviour in TIPC, from cross-vlan links being
> established to oopses.
>
> At first, i thought this was due to a missing PACKET_OTHERHOST filtering
> in the TIPC ethernet code, but adding that check did not resolve the issue.
> Adding an explicit check for skb->dev vs packet_type->dev does work, but
> i dont think that's the proper way to solve it.
> What's the purpose of having a dev entry in the packet_type if it's ignored
> by the lower layers?
Its not ignored, quite the contrary if you look at the code :
vi +3595 net/core/dev.c
type = skb->protocol;
list_for_each_entry_rcu(ptype,
&ptype_base[ntohs(type) & PTYPE_HASH_MASK], list) {
if (ptype->type == type &&
(ptype->dev == null_or_dev || ptype->dev == skb->dev ||
ptype->dev == orig_dev)) {
if (pt_prev)
ret = deliver_skb(skb, pt_prev, orig_dev);
pt_prev = ptype;
}
}
pkt->dev being set is only meaningful for packet sockets.
Protocols themselves should not care. If they want to care, they must
add their own checks.
Socket API has SO_BINDTODEVICE for this purpose.
IP layer has RP filtering.
A protocol should register a single ptype with NULL dev.
next prev parent reply other threads:[~2013-08-07 13:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-07 13:08 skbs delivered to 'wrong' packet_type handler Erik Hugne
2013-08-07 13:55 ` Eric Dumazet [this message]
2013-08-07 15:57 ` Erik Hugne
2013-08-08 2:21 ` Ying Xue
2013-08-08 7:43 ` Erik Hugne
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1375883743.4004.26.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=erik.hugne@ericsson.com \
--cc=jon.maloy@ericsson.com \
--cc=netdev@vger.kernel.org \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=ying.xue@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox