From da29726b07d40b0dc4c7039474c8fca99a4b3d2c Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 26 Oct 2022 14:29:28 +0200 Subject: [PATCH] policy: skip external devices in any_devices_active() any_devices_active() exists to avoid hostname update when no devices are active. See [1] and commit b07f6712e983 ('policy: check for active devices before triggering dns update on hostname change'). Soon, we will add support for loopback device, so "lo" will almost always be activated (either externally or actively managed by NetworkManager). In any case, external devices should not count here, even if they appear activating/activated. [1] https://bugzilla.redhat.com/show_bug.cgi?id=1344303 --- src/core/nm-policy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/nm-policy.c b/src/core/nm-policy.c index c12cd8c476..ec03616a1b 100644 --- a/src/core/nm-policy.c +++ b/src/core/nm-policy.c @@ -467,9 +467,10 @@ any_devices_active(NMPolicy *self) NMDeviceState state; state = nm_device_get_state(device); - if (state <= NM_DEVICE_STATE_DISCONNECTED || state >= NM_DEVICE_STATE_DEACTIVATING) { + if (state <= NM_DEVICE_STATE_DISCONNECTED || state >= NM_DEVICE_STATE_DEACTIVATING) + continue; + if (nm_device_sys_iface_state_is_external(device)) continue; - } return TRUE; } return FALSE;