public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Ying Xue <ying.xue@windriver.com>
To: Erik Hugne <erik.hugne@ericsson.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>, <netdev@vger.kernel.org>,
	<tipc-discussion@lists.sourceforge.net>, <jon.maloy@ericsson.com>
Subject: Re: skbs delivered to 'wrong' packet_type handler
Date: Thu, 8 Aug 2013 10:21:24 +0800	[thread overview]
Message-ID: <520300A4.10909@windriver.com> (raw)
In-Reply-To: <20130807155746.GA16408@eerihug-hybrid.rnd.ki.sw.ericsson.se>

On 08/07/2013 11:57 PM, Erik Hugne wrote:
> On Wed, Aug 07, 2013 at 06:55:43AM -0700, Eric Dumazet wrote:
>> 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.
>>
> 
> Very well, we'll have to fix the protocol registration and add appropriate 
> checks in TIPC then.

Currently the usage of what TIPC registers its protocol handler into
networking device is totally wrong because af_packet_priv in packet_type
should be only owned by AF_PACKET socket as well as ptype->dev is set
with a network device. But I am sure the patch in below link can
definitely fix your met issue although it's not a final version to be
submitted net-next:

http://permalink.gmane.org/gmane.network.tipc.general/4159


Regards,
Ying

> But i fail to understand why a handler registered on the native device needs 
> to get the packets destined to a child vlan device (the ptype->dev == orig_dev 
> check).
> 
> //E
> 
> 
> 

  reply	other threads:[~2013-08-08  4:08 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
2013-08-07 15:57   ` Erik Hugne
2013-08-08  2:21     ` Ying Xue [this message]
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=520300A4.10909@windriver.com \
    --to=ying.xue@windriver.com \
    --cc=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 \
    /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