device: update L3 if connectivity changes in IP_CHECK/SECONDARIES

If connectivity goes from/to FULL, the penalization of default route metric
may change. For this reason we re-commit L3 configuration if the
connectivity changes while the device is ACTIVATED.

However, there are more device states that need consideration:
IP_CHECK and SECONDARIES, that happen between initial configuration on
IP_CONFIG and removal when the device goes DEACTIVATING.

This should fix the issue encountered here:
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2070

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2212
This commit is contained in:
Lubomir Rintel
2025-05-19 18:39:42 +02:00
parent 43bcfbcdf5
commit ccd9431e82

View File

@@ -6617,8 +6617,12 @@ concheck_update_state(NMDevice *self,
_notify(self, IS_IPv4 ? PROP_IP4_CONNECTIVITY : PROP_IP6_CONNECTIVITY);
if (priv->state == NM_DEVICE_STATE_ACTIVATED && !nm_device_managed_type_is_external(self))
/* State change could've affected the route metrics (removed the penalty
* once FULL connectivity is reached), redo the L3 configuration. */
if (priv->state > NM_DEVICE_STATE_IP_CONFIG && priv->state < NM_DEVICE_STATE_DEACTIVATING
&& !nm_device_managed_type_is_external(self)) {
_dev_l3_register_l3cds(self, priv->l3cfg, TRUE, NM_TERNARY_DEFAULT);
}
}
const char *