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 b07f6712e9 ('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
This commit is contained in:
Thomas Haller 2022-10-26 14:29:28 +02:00
parent 18e107e098
commit da29726b07
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -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;