All of lore.kernel.org
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Network Development <netdev@vger.kernel.org>
Subject: Re: BUG?: receiving on a packet socket with .sll_protocoll and bridging
Date: Mon, 7 May 2018 04:22:23 +0900	[thread overview]
Message-ID: <CAF=yD-KsfvzAdd1jt9qEjy5kOghBrS=Oo3CVBm_QR9+=1zj7rQ@mail.gmail.com> (raw)
In-Reply-To: <20180506191459.2y7f4wa3gbdkkrhl@pengutronix.de>

>> > If now I add veth0 to a bridge (e.g.
>> >
>> >         ip link add br0 type bridge
>> >         ip link set dev veth0 master br0
>> >
>> > ) and continue to send on veth1 and receive on veth0 I don't receive
>> > the packets any more. The other direction (veth0 sending, veth1
>> > receiving) still works fine.
>> >
>> > Each of the following changes allow to
>> > receive again:
>> >
>> >  a) take veth0 out of the bridge
>> >  b) bind(2) the receiving socket to br0 instead of veth0
>> >  c) use .sll_protocol = htons(ETH_P_ALL) for bind(2)
>> >
>> > In the end only c) could be sensible (because I need to know the port
>> > the packet entered the stack and that might well be bridged), but I
>> > wonder why .sll_protocol = htons(ETH_P_MRP) seems to do the right thing
>> > for an unbridged device but not for a bridged one.
>> >
>> > Is this a bug or a feature I don't understand?
>>
>> Packets are redirected to the bridge device in __netif_receive_skb_core
>> at the rx_handler hook.
>
> OK, thanks for finding that place. It would have taken quite some of my
> time to find it.
>
>> This happens after packets are passed to packet types attached to
>> list ptype_all, which includes packet sockets with protocol ETH_P_ALL.
>> But before packets are passed to protocol specific packet types (and
>> sockets) attached to ptype_base[].
>
> Still I wonder if there is something to fix in the kernel or if this
> inconsistency is intended (or at least accepted).

It is established behavior.

      reply	other threads:[~2018-05-06 19:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-05  8:57 BUG?: receiving on a packet socket with .sll_protocoll and bridging Uwe Kleine-König
2018-05-06 16:58 ` Willem de Bruijn
2018-05-06 19:14   ` Uwe Kleine-König
2018-05-06 19:22     ` Willem de Bruijn [this message]

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='CAF=yD-KsfvzAdd1jt9qEjy5kOghBrS=Oo3CVBm_QR9+=1zj7rQ@mail.gmail.com' \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.