device: fix condition for scheduling stage3 after carrier change

When the device gets carrier, we should reschedule stage3 even if the
device state is not exactly IP_CONFIG.

For example if IPv6 autoconf is waiting for carrier and IPv6 is
may-fail=yes, the device could be already ACTIVATED because manual
IPv4 succeeded; after getting carrier, we need to call
nm_device_activate_schedule_stage3_ip_config() to start IPv6 autoconf.

Fixes: bcf31a9b29 ('device: fix assertion failure on master carrier change')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1165
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1485
(cherry picked from commit 6ea924fa74)
This commit is contained in:
Beniamino Galvani 2022-12-19 10:18:46 +01:00
parent 1b0d98ab55
commit af1bbe8bd9

View file

@ -6392,7 +6392,8 @@ carrier_changed(NMDevice *self, gboolean carrier)
if (carrier) {
/* If needed, also resume IP configuration that is
* waiting for carrier. */
if (priv->state == NM_DEVICE_STATE_IP_CONFIG)
if (priv->state >= NM_DEVICE_STATE_IP_CONFIG
&& priv->state <= NM_DEVICE_STATE_ACTIVATED)
nm_device_activate_schedule_stage3_ip_config(self, FALSE);
return;
}