All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Linus Lüssing" <linus.luessing@c0d3.blue>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netdev@vger.kernel.org, bridge@lists.linux-foundation.org,
	Florian Westphal <fw@strlen.de>,
	linux-kernel@vger.kernel.org, coreteam@netfilter.org,
	netfilter-devel@vger.kernel.org,
	Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>,
	"David S . Miller" <davem@davemloft.net>
Subject: Re: [Bridge] [PATCH net] bridge: ebtables: fix reception of frames DNAT-ed to bridge device
Date: Tue, 21 Mar 2017 01:09:47 +0100	[thread overview]
Message-ID: <20170321000947.GA31709@otheros> (raw)
In-Reply-To: <20170319165506.GA15475@otheros>

On Sun, Mar 19, 2017 at 05:55:06PM +0100, Linus Lüssing wrote:
> On Fri, Mar 17, 2017 at 02:10:44PM +0100, Pablo Neira Ayuso wrote:
> > Wait.
> > 
> > May this break local multicast listener that are bound to the bridge
> > interface? Assuming the bridge interface got an IP address, and that
> > there is local multicast listener.
> > 
> > Missing anything here?
> 
> Hm, for multicast packets usually the code path a few lines
> later in br_handle_frame_finish() should be taken instead.
> 
> But you might be right for IP multicast packets with a unicast MAC
> destination (due to whatever reason, for instance via DNAT'ing
> again).
> 
> Will check that - thanks!

Ok, I tested DNAT'ing an IP multicast packet to the unicast MAC address
of the bridge interface.

Both ping-ing to an IPv4 and IPv6 multicast listener on br0 worked
and was replied to fine, both with or without changing skb->pkt_type
from PACKET_MULTICAST to PACKET_HOST.
("$ ping 224.1.0.123" and "$ ping6 ff02::1:ff40:707c%in0" from a
 network namespace, tied into the bridge via veth)

Also, a DNAT'ed PACKET_BROADCAST worked, with or without changing
it to PACKET_HOST.

I also checked via tcpdump that the destination MAC was changed
successfully.


So, so far I wasn't able to find any bugs with the current
patch. But I think I like the idea of leaving the skb->pkt_type
unaltered for PACKET_MULTICAST and PACKET_BROADCAST, seems cleaner.

I'd just add an "if (skb->pkt_type == PACKET_OTHERHOST)" check
then and resend a PATCH v2.

WARNING: multiple messages have this Message-ID (diff)
From: "Linus Lüssing" <linus.luessing@c0d3.blue>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netdev@vger.kernel.org, bridge@lists.linux-foundation.org,
	Florian Westphal <fw@strlen.de>,
	linux-kernel@vger.kernel.org, coreteam@netfilter.org,
	netfilter-devel@vger.kernel.org,
	Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>,
	"David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH net] bridge: ebtables: fix reception of frames DNAT-ed to bridge device
Date: Tue, 21 Mar 2017 01:09:47 +0100	[thread overview]
Message-ID: <20170321000947.GA31709@otheros> (raw)
In-Reply-To: <20170319165506.GA15475@otheros>

On Sun, Mar 19, 2017 at 05:55:06PM +0100, Linus Lüssing wrote:
> On Fri, Mar 17, 2017 at 02:10:44PM +0100, Pablo Neira Ayuso wrote:
> > Wait.
> > 
> > May this break local multicast listener that are bound to the bridge
> > interface? Assuming the bridge interface got an IP address, and that
> > there is local multicast listener.
> > 
> > Missing anything here?
> 
> Hm, for multicast packets usually the code path a few lines
> later in br_handle_frame_finish() should be taken instead.
> 
> But you might be right for IP multicast packets with a unicast MAC
> destination (due to whatever reason, for instance via DNAT'ing
> again).
> 
> Will check that - thanks!

Ok, I tested DNAT'ing an IP multicast packet to the unicast MAC address
of the bridge interface.

Both ping-ing to an IPv4 and IPv6 multicast listener on br0 worked
and was replied to fine, both with or without changing skb->pkt_type
from PACKET_MULTICAST to PACKET_HOST.
("$ ping 224.1.0.123" and "$ ping6 ff02::1:ff40:707c%in0" from a
 network namespace, tied into the bridge via veth)

Also, a DNAT'ed PACKET_BROADCAST worked, with or without changing
it to PACKET_HOST.

I also checked via tcpdump that the destination MAC was changed
successfully.


So, so far I wasn't able to find any bugs with the current
patch. But I think I like the idea of leaving the skb->pkt_type
unaltered for PACKET_MULTICAST and PACKET_BROADCAST, seems cleaner.

I'd just add an "if (skb->pkt_type == PACKET_OTHERHOST)" check
then and resend a PATCH v2.

  reply	other threads:[~2017-03-21  0:09 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-15  3:18 [Bridge] [PATCH net] bridge: ebtables: fix reception of frames DNAT-ed to bridge device Linus Lüssing
2017-03-15  3:18 ` Linus Lüssing
2017-03-15  3:18 ` Linus Lüssing
2017-03-15 10:26 ` [Bridge] " Florian Westphal
2017-03-15 10:26   ` Florian Westphal
2017-03-15 10:42   ` [Bridge] " Pablo Neira Ayuso
2017-03-15 10:42     ` Pablo Neira Ayuso
2017-03-15 10:42     ` Pablo Neira Ayuso
2017-03-15 14:27     ` [Bridge] " Linus Lüssing
2017-03-15 14:27       ` Linus Lüssing
2017-03-15 14:27       ` Linus Lüssing
2017-03-15 18:15       ` [Bridge] " Pablo Neira Ayuso
2017-03-15 18:15         ` Pablo Neira Ayuso
2017-03-15 18:15         ` Pablo Neira Ayuso
2017-03-15 21:16         ` [Bridge] " Linus Lüssing
2017-03-15 21:16           ` Linus Lüssing
2017-03-15 22:06           ` [Bridge] " Pablo Neira Ayuso
2017-03-15 22:06             ` Pablo Neira Ayuso
2017-03-15 22:06             ` Pablo Neira Ayuso
2017-03-17 13:10             ` [Bridge] " Pablo Neira Ayuso
2017-03-17 13:10               ` Pablo Neira Ayuso
2017-03-17 13:10               ` Pablo Neira Ayuso
2017-03-19 16:55               ` [Bridge] " Linus Lüssing
2017-03-19 16:55                 ` Linus Lüssing
2017-03-19 16:55                 ` Linus Lüssing
2017-03-21  0:09                 ` Linus Lüssing [this message]
2017-03-21  0:09                   ` Linus Lüssing
2017-03-21 10:11                   ` [Bridge] " Pablo Neira Ayuso
2017-03-21 10:11                     ` Pablo Neira Ayuso
2017-03-15 10:34 ` [Bridge] " Pablo Neira Ayuso
2017-03-15 10:34   ` Pablo Neira Ayuso
2017-03-15 10:34   ` Pablo Neira Ayuso

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=20170321000947.GA31709@otheros \
    --to=linus.luessing@c0d3.blue \
    --cc=bridge@lists.linux-foundation.org \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=fw@strlen.de \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /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.