From: Andrei Warkentin <hidden> Date: 2011-08-05 17:03:56
This is my first time on netdev. I am writing about the ensuring
that upper network layers are aware of bridge MAC changes due
to re-configuration or port addition/removal.
It seems this topic has cropped up before, with one patch by
Stephen Hemminger already in 3.0, and a fix for it (sent 7/22)
(http://marc.info/?l=linux-netdev&m=131135705613958&w=2) pending.
The existing patches don't cover the br_del_if case, the case of
a changing MAC address on a port associated with the bridge, and
the case of manually setting the MAC address, which the following
patch remedies.
Table of Contents:
[PATCH] Bridge: Always send NETDEV_CHANGEADDR up on br MAC change.
Thank you,
A
From: Andrei Warkentin <hidden> Date: 2011-08-05 02:18:39
Minor fix in br_notify, such that notification only is sent if
bridge MAC address is updated.
ToC:
[PATCHv2] Bridge: Always send NETDEV_CHANGEADDR up on br MAC change.
A
From: Andrei Warkentin <hidden> Date: 2011-08-05 02:18:41
This ensures the neighbor entries associated with the bridge
dev are flushed, also invalidating the associated cached L2 headers.
This means we br_add_if/br_del_if ports to implement hand-over and
not wind up with bridge packets going out with stale MAC.
This means we can also change MAC of port device and also not wind
up with bridge packets going out with stale MAC.
This builds on Stephen Hemminger's patch, also handling the br_del_if
case, port MAC change case, and bridge MAC manual assignment case.
Change-Id: I6039ba021006f854e0e7e83dd1c4261c500aeab7
Cc: Stephen Hemminger <redacted>
Signed-off-by: Andrei Warkentin <redacted>
---
net/bridge/br_device.c | 1 +
net/bridge/br_if.c | 6 +++++-
net/bridge/br_notify.c | 6 +++++-
net/bridge/br_stp_if.c | 2 +-
4 files changed, 12 insertions(+), 3 deletions(-)
@@ -34,6 +34,7 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, vstructnet_device*dev=ptr;structnet_bridge_port*p=br_port_get(dev);structnet_bridge*br;+boolchanged_addr;interr;/* not a port of a bridge */
@@ -51,8 +52,11 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, vcaseNETDEV_CHANGEADDR:spin_lock_bh(&br->lock);br_fdb_changeaddr(p,dev->dev_addr);-br_stp_recalculate_bridge_id(br);+changed_addr=br_stp_recalculate_bridge_id(br);spin_unlock_bh(&br->lock);++if(changed_addr)+call_netdevice_notifiers(NETDEV_CHANGEADDR,br->dev);break;caseNETDEV_CHANGE:
@@ -213,7 +213,7 @@ bool br_stp_recalculate_bridge_id(struct net_bridge *br)/* user has chosen a value so keep it */if(br->flags&BR_SET_MAC_ADDR)-return;+returnfalse;list_for_each_entry(p,&br->port_list,list){if(addr==br_mac_zero||
From: Andrei Warkentin <hidden> Date: 2011-08-05 02:23:52
Hi,
I apologize for spamming. I removed the meaningless Change-Id from
the patch.
ToC:
[PATCHv3] Bridge: Always send NETDEV_CHANGEADDR up on br MAC change.
A
From: Andrei Warkentin <hidden> Date: 2011-08-05 02:23:56
This ensures the neighbor entries associated with the bridge
dev are flushed, also invalidating the associated cached L2 headers.
This means we br_add_if/br_del_if ports to implement hand-over and
not wind up with bridge packets going out with stale MAC.
This means we can also change MAC of port device and also not wind
up with bridge packets going out with stale MAC.
This builds on Stephen Hemminger's patch, also handling the br_del_if
case, port MAC change case, and bridge MAC manual assignment case.
Cc: Stephen Hemminger <redacted>
Signed-off-by: Andrei Warkentin <redacted>
---
net/bridge/br_device.c | 1 +
net/bridge/br_if.c | 6 +++++-
net/bridge/br_notify.c | 6 +++++-
net/bridge/br_stp_if.c | 2 +-
4 files changed, 12 insertions(+), 3 deletions(-)
@@ -34,6 +34,7 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, vstructnet_device*dev=ptr;structnet_bridge_port*p=br_port_get(dev);structnet_bridge*br;+boolchanged_addr;interr;/* not a port of a bridge */
@@ -51,8 +52,11 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, vcaseNETDEV_CHANGEADDR:spin_lock_bh(&br->lock);br_fdb_changeaddr(p,dev->dev_addr);-br_stp_recalculate_bridge_id(br);+changed_addr=br_stp_recalculate_bridge_id(br);spin_unlock_bh(&br->lock);++if(changed_addr)+call_netdevice_notifiers(NETDEV_CHANGEADDR,br->dev);break;caseNETDEV_CHANGE:
@@ -213,7 +213,7 @@ bool br_stp_recalculate_bridge_id(struct net_bridge *br)/* user has chosen a value so keep it */if(br->flags&BR_SET_MAC_ADDR)-return;+returnfalse;list_for_each_entry(p,&br->port_list,list){if(addr==br_mac_zero||
@@ -34,6 +34,7 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, vstructnet_device*dev=ptr;structnet_bridge_port*p=br_port_get(dev);structnet_bridge*br;+boolchanged_addr;interr;/* not a port of a bridge */
@@ -51,8 +52,11 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, vcaseNETDEV_CHANGEADDR:spin_lock_bh(&br->lock);br_fdb_changeaddr(p,dev->dev_addr);-br_stp_recalculate_bridge_id(br);+changed_addr=br_stp_recalculate_bridge_id(br);spin_unlock_bh(&br->lock);++if(changed_addr)+call_netdevice_notifiers(NETDEV_CHANGEADDR,br->dev);break;caseNETDEV_CHANGE:
This is also fine.
quoted hunk
iff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index c0990ba..4528e9a 100644
@@ -213,7 +213,7 @@ bool br_stp_recalculate_bridge_id(struct net_bridge *br)/* user has chosen a value so keep it */if(br->flags&BR_SET_MAC_ADDR)-return;+returnfalse;list_for_each_entry(p,&br->port_list,list){if(addr==br_mac_zero||
From: Andrei Warkentin <hidden> Date: 2011-08-05 12:31:28
This ensures the neighbor entries associated with the bridge
dev are flushed, also invalidating the associated cached L2 headers.
This means we br_add_if/br_del_if ports to implement hand-over and
not wind up with bridge packets going out with stale MAC.
This means we can also change MAC of port device and also not wind
up with bridge packets going out with stale MAC.
This builds on Stephen Hemminger's patch, also handling the br_del_if
case, port MAC change case, and bridge MAC manual assignment case.
Change-Id: I6039ba021006f854e0e7e83dd1c4261c500aeab7
Cc: Stephen Hemminger <redacted>
Signed-off-by: Andrei Warkentin <redacted>
---
net/bridge/br_device.c | 1 +
net/bridge/br_if.c | 6 +++++-
net/bridge/br_notify.c | 2 ++
net/bridge/br_stp_if.c | 2 +-
4 files changed, 9 insertions(+), 2 deletions(-)
@@ -213,7 +213,7 @@ bool br_stp_recalculate_bridge_id(struct net_bridge *br)/* user has chosen a value so keep it */if(br->flags&BR_SET_MAC_ADDR)-return;+returnfalse;list_for_each_entry(p,&br->port_list,list){if(addr==br_mac_zero||
/* user has chosen a value so keep it */
if (br->flags & BR_SET_MAC_ADDR)
- return;
+ return false;
list_for_each_entry(p, &br->port_list, list) {
if (addr == br_mac_zero ||
This is already in net-next.
Thank you for your feedback. I will clean this up and resubmit tomorrow.
A
From: Andrei Warkentin <hidden> Date: 2011-08-05 21:11:01
This ensures the neighbor entries associated with the bridge
dev are flushed, also invalidating the associated cached L2 headers.
This means we br_add_if/br_del_if ports to implement hand-over and
not wind up with bridge packets going out with stale MAC.
This means we can also change MAC of port device and also not wind
up with bridge packets going out with stale MAC.
This builds on Stephen Hemminger's patch, also handling the br_del_if
case and the port MAC change case.
Cc: Stephen Hemminger <redacted>
Signed-off-by: Andrei Warkentin <redacted>
---
net/bridge/br_if.c | 6 +++++-
net/bridge/br_notify.c | 7 ++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
From: Stephen Hemminger <hidden> Date: 2011-08-08 20:12:21
On Fri, 5 Aug 2011 16:04:10 -0500
Andrei Warkentin [off-list ref] wrote:
This ensures the neighbor entries associated with the bridge
dev are flushed, also invalidating the associated cached L2 headers.
This means we br_add_if/br_del_if ports to implement hand-over and
not wind up with bridge packets going out with stale MAC.
This means we can also change MAC of port device and also not wind
up with bridge packets going out with stale MAC.
This builds on Stephen Hemminger's patch, also handling the br_del_if
case and the port MAC change case.
Cc: Stephen Hemminger <redacted>
Signed-off-by: Andrei Warkentin <redacted>
From: Andrei Warkentin <hidden> Date: 2011-08-09 05:12:48
On Mon, Aug 8, 2011 at 3:12 PM, Stephen Hemminger [off-list ref] wrote:
On Fri, 5 Aug 2011 16:04:10 -0500
Andrei Warkentin [off-list ref] wrote:
quoted
This ensures the neighbor entries associated with the bridge
dev are flushed, also invalidating the associated cached L2 headers.
This means we br_add_if/br_del_if ports to implement hand-over and
not wind up with bridge packets going out with stale MAC.
This means we can also change MAC of port device and also not wind
up with bridge packets going out with stale MAC.
This builds on Stephen Hemminger's patch, also handling the br_del_if
case and the port MAC change case.
Cc: Stephen Hemminger <redacted>
Signed-off-by: Andrei Warkentin <redacted>
From: David Miller <davem@davemloft.net> Date: 2011-08-10 04:45:11
From: Stephen Hemminger <redacted>
Date: Mon, 8 Aug 2011 13:12:30 -0700
On Fri, 5 Aug 2011 16:04:10 -0500
Andrei Warkentin [off-list ref] wrote:
quoted
This ensures the neighbor entries associated with the bridge
dev are flushed, also invalidating the associated cached L2 headers.
This means we br_add_if/br_del_if ports to implement hand-over and
not wind up with bridge packets going out with stale MAC.
This means we can also change MAC of port device and also not wind
up with bridge packets going out with stale MAC.
This builds on Stephen Hemminger's patch, also handling the br_del_if
case and the port MAC change case.
Cc: Stephen Hemminger <redacted>
Signed-off-by: Andrei Warkentin <redacted>