bonding: adjust link state based on active slaves 41/27141/4
authorMatthew Smith <mgsmith@netgate.com>
Mon, 18 May 2020 15:54:17 +0000 (10:54 -0500)
committerNeale Ranns <nranns@cisco.com>
Wed, 27 May 2020 12:58:33 +0000 (12:58 +0000)
commit9121c415a91904be50071ec55143d9c89b2f1b91
tree182693cb59362835f737d81fadb5e872ed84e16b
parent5556813fb63d28240a17ccf18f947e60c4cbb263
bonding: adjust link state based on active slaves

Type: improvement

Bond link state is being maintained inconsistently. It is initially set to
up.  If the bond interface admin state is set to down, the link state is
set to down. If the bond interface admin state is set to up, the link
state is only set to up if there are active slave interfaces at that point.
If slaves become active at some later time, it does not get updated. Its
next chance to be updated is the next time the bond interface is set to
admin up.

To address this, do not set the link state to up after creating a bond.
Adjust the link state as slave interfaces are attached or detached
based on whether the bond is getting its first active slave or losing
its last one.

Unit test added to verify correct maintenance of link state.

Change-Id: I31f17321f7f0e727e1ab1e01713423af6566dad9
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
src/vnet/bonding/cli.c
test/test_bond.py