[ovs-dev] [PATCH] ofproto/bond: Fix bond/show when all interfaces are disabled

nickcooper-zhangtonghao nic at opencloud.tech
Fri Feb 17 05:39:11 UTC 2017


> On Feb 17, 2017, at 4:49 AM, Andy Zhou <azhou at ovn.org> wrote:
> 
> 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 <azhou at ovn.org <mailto:azhou at ovn.org>>
> ---
> ofproto/bond.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/ofproto/bond.c b/ofproto/bond.c
> index c138593..260023e 100644
> --- a/ofproto/bond.c
> +++ b/ofproto/bond.c
> @@ -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());
> }
> @@ -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);
>     }
> }
> -- 
> 1.9.1


looks good to me.





More information about the dev mailing list