diff mbox

bridge: mark packets sent to any local mac address as PACKET_HOST

Message ID 1403534015-28496-1-git-send-email-mbizon@freebox.fr
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Maxime Bizon June 23, 2014, 2:33 p.m. UTC
The bridge code only set PACKET_HOST on packets sent to the bridge mac
address, packets sent to other local mac addresses are sent to upper
layers, but ignored because they are marked as PACKET_OTHERHOST.

Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
---
 net/bridge/br_input.c |    1 +
 1 file changed, 1 insertion(+)

Comments

David Miller June 25, 2014, 11:09 p.m. UTC | #1
From: Maxime Bizon <mbizon@freebox.fr>
Date: Mon, 23 Jun 2014 16:33:35 +0200

> The bridge code only set PACKET_HOST on packets sent to the bridge mac
> address, packets sent to other local mac addresses are sent to upper
> layers, but ignored because they are marked as PACKET_OTHERHOST.
> 
> Signed-off-by: Maxime Bizon <mbizon@freebox.fr>

This looks fine to me, Stephen and other bridge hackers please review.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Hemminger June 25, 2014, 11:13 p.m. UTC | #2
On Mon, 23 Jun 2014 16:33:35 +0200
Maxime Bizon <mbizon@freebox.fr> wrote:

> The bridge code only set PACKET_HOST on packets sent to the bridge mac
> address, packets sent to other local mac addresses are sent to upper
> layers, but ignored because they are marked as PACKET_OTHERHOST.
> 
> Signed-off-by: Maxime Bizon <mbizon@freebox.fr>

What are you trying to do? Bridge device itself only has one MAC address.
Are you trying to run macvlan on top of bridge?
We only respond to ARP with bridge's MAC address.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Maxime Bizon June 26, 2014, 11:15 a.m. UTC | #3
On Wed, 2014-06-25 at 16:13 -0700, Stephen Hemminger wrote:

> > The bridge code only set PACKET_HOST on packets sent to the bridge mac
> > address, packets sent to other local mac addresses are sent to upper
> > layers, but ignored because they are marked as PACKET_OTHERHOST.
> > 
> > Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
> 
> What are you trying to do? Bridge device itself only has one MAC address.
> Are you trying to run macvlan on top of bridge?
> We only respond to ARP with bridge's MAC address.

host1 uses a bridge with two interfaces: ethernet and wireless (AP mode
using hostapd)

for some reasons, hostapd kept adding and removing the interface from
the bridge, triggering a mac address of the bridge change each time (I
did not notice that).

Another host had a static arp entry for host1, using the ethernet mac
address, so its packets to host1 were randomly trashed depending on the
current mac of the bridge.

I have since fixed this by setting a static mac address on the bridge to
prevent dynamic change, but I thought this patch would prevent other
people from having the same bug in the future.

What do you think ?
David Miller June 26, 2014, 8:35 p.m. UTC | #4
From: Maxime Bizon <mbizon@freebox.fr>
Date: Thu, 26 Jun 2014 13:15:52 +0200

> for some reasons, hostapd kept adding and removing the interface from
> the bridge, triggering a mac address of the bridge change each time (I
> did not notice that).

I think this is what you need to investigate rather than making
changes to the bridge layer.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Maxime Bizon June 26, 2014, 9:19 p.m. UTC | #5
On Thursday 26 Jun 2014 à 13:35:50 (-0700), David Miller wrote:

> > for some reasons, hostapd kept adding and removing the interface from
> > the bridge, triggering a mac address of the bridge change each time (I
> > did not notice that).
> 
> I think this is what you need to investigate rather than making
> changes to the bridge layer.

Of course I fixed the problem with hostapd, I was just explaining how
I noticed that behaviour in the bridge code.

If that behaviour is intended then just forget that patch.
diff mbox

Patch

diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 366c436..b9cc8554 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -120,6 +120,7 @@  int br_handle_frame_finish(struct sk_buff *skb)
 			dst->is_local) {
 		skb2 = skb;
 		/* Do not forward the packet since it's local. */
+		skb2->pkt_type = PACKET_HOST;
 		skb = NULL;
 	}