Skip to content

Commit

Permalink
Bridge: Always send NETDEV_CHANGEADDR up on br MAC change.
Browse files Browse the repository at this point in the history
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 <shemminger@vyatta.com>
Signed-off-by: Andrei Warkentin <andreiw@motorola.com>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Andrei Warkentin authored and David S. Miller committed Aug 10, 2011
1 parent 8028837 commit 9be6dd6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion net/bridge/br_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
int br_del_if(struct net_bridge *br, struct net_device *dev)
{
struct net_bridge_port *p;
bool changed_addr;

p = br_port_get_rtnl(dev);
if (!p || p->br != br)
Expand All @@ -425,9 +426,12 @@ int br_del_if(struct net_bridge *br, struct net_device *dev)
del_nbp(p);

spin_lock_bh(&br->lock);
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);

netdev_update_features(br->dev);

return 0;
Expand Down
7 changes: 6 additions & 1 deletion net/bridge/br_notify.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
struct net_device *dev = ptr;
struct net_bridge_port *p;
struct net_bridge *br;
bool changed_addr;
int err;

/* register of bridge completed, add sysfs entries */
Expand All @@ -57,8 +58,12 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
case NETDEV_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;

case NETDEV_CHANGE:
Expand Down

0 comments on commit 9be6dd6

Please sign in to comment.