From 271c4d39aadc5ea3aa99cbacd45ea667ff57e622 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Mon, 19 May 2025 18:39:42 +0200 Subject: [PATCH] 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 --- src/core/devices/nm-device.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index 793378be88..1f68551f1d 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -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 *