network: make degraded-carrier bond/bridge as routable (#27776)

This makes a bond or bridge interface in the degraded-carrier state but has a routable address
handled as routable operational state.

If the carrier is degraded but the address state is routable then the operational state should be
seen as routable and not degraded because that may be the case for bonds if some of the links are down,
but when that happens the bond as whole is still routable.

This also makes operational state to degraded if address state is degraded even if the link state is
degraded-carrier.

Fixes #22713.
This commit is contained in:
Henrik Holst
2023-06-15 13:32:10 +09:00
committed by GitHub
parent 4dad6101fd
commit cf4dbd84ac
3 changed files with 15 additions and 9 deletions
+7 -3
View File
@@ -1775,11 +1775,15 @@ void link_update_operstate(Link *link, bool also_update_master) {
* | off | no-carrier | dormant | degraded-carrier | carrier | enslaved
* ------------------------------------------------------------------------------
* off | off | no-carrier | dormant | degraded-carrier | carrier | enslaved
* address_state degraded | off | no-carrier | dormant | degraded-carrier | degraded | enslaved
* routable | off | no-carrier | dormant | degraded-carrier | routable | routable
* address_state degraded | off | no-carrier | dormant | degraded | degraded | enslaved
* routable | off | no-carrier | dormant | routable | routable | routable
*/
if (carrier_state < LINK_CARRIER_STATE_CARRIER || address_state == LINK_ADDRESS_STATE_OFF)
if (carrier_state == LINK_CARRIER_STATE_DEGRADED_CARRIER && address_state == LINK_ADDRESS_STATE_ROUTABLE)
operstate = LINK_OPERSTATE_ROUTABLE;
else if (carrier_state == LINK_CARRIER_STATE_DEGRADED_CARRIER && address_state == LINK_ADDRESS_STATE_DEGRADED)
operstate = LINK_OPERSTATE_DEGRADED;
else if (carrier_state < LINK_CARRIER_STATE_CARRIER || address_state == LINK_ADDRESS_STATE_OFF)
operstate = (LinkOperationalState) carrier_state;
else if (address_state == LINK_ADDRESS_STATE_ROUTABLE)
operstate = LINK_OPERSTATE_ROUTABLE;