device: commit l3cfg on link change only when the device is activating

On link change, the configuration should be reapplied only when the
device is activating.

Fixes: 58287cbcc0 ('core: rework IP configuration in NetworkManager using layer 3 configuration')

https://bugzilla.redhat.com/show_bug.cgi?id=2079054
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1216
(cherry picked from commit 77c8b2960a)
This commit is contained in:
Beniamino Galvani 2022-05-09 10:57:56 +02:00
parent e056a68d21
commit b596ad1058

View file

@ -6585,7 +6585,8 @@ device_link_changed(gpointer user_data)
* so that it theoretically would also work for NMVpnConnection (although,
* NMVpnConnection should become like a regular device, akin to NMDevicePpp).
*/
if (!nm_device_sys_iface_state_is_external(self))
if (priv->state >= NM_DEVICE_STATE_IP_CONFIG && priv->state <= NM_DEVICE_STATE_ACTIVATED
&& !nm_device_sys_iface_state_is_external(self))
nm_device_l3cfg_commit(self, NM_L3_CFG_COMMIT_TYPE_REAPPLY, FALSE);
}