Skip to content

Commit

Permalink
ofproto/bond: Fix bond/show when all interfaces are disabled
Browse files Browse the repository at this point in the history
Without this patch, when all slaves are disabled, the 'bond/show'
command still shows the mac address of last active slave in
'active slave mac' output. This patch clears them to zeros.

Signed-off-by: Andy Zhou <[email protected]>
Acked-by: nickcooper-zhangtonghao <[email protected]>
  • Loading branch information
azhou-nicira committed Feb 17, 2017
1 parent beba3d8 commit f626af7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ofproto/bond.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,10 +488,13 @@ bond_find_slave_by_mac(const struct bond *bond, const struct eth_addr mac)
static void
bond_active_slave_changed(struct bond *bond)
{
struct eth_addr mac;

netdev_get_etheraddr(bond->active_slave->netdev, &mac);
bond->active_slave_mac = mac;
if (bond->active_slave) {
struct eth_addr mac;
netdev_get_etheraddr(bond->active_slave->netdev, &mac);
bond->active_slave_mac = mac;
} else {
bond->active_slave_mac = eth_addr_zero;
}
bond->active_slave_changed = true;
seq_change(connectivity_seq_get());
}
Expand Down Expand Up @@ -1866,6 +1869,7 @@ bond_choose_active_slave(struct bond *bond)
bond_active_slave_changed(bond);
}
} else if (old_active_slave) {
bond_active_slave_changed(bond);
VLOG_INFO_RL(&rl, "bond %s: all interfaces disabled", bond->name);
}
}
Expand Down

0 comments on commit f626af7

Please sign in to comment.