From c75b7dd8935cd713a65df366176909de2aa2f05f Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Mon, 18 Oct 2021 12:43:17 +0200 Subject: [PATCH] core: make Device emit StateChanged a bit later We need to make sure StateChanged goes on the D-Bus only after the policy is done dealing with the state change internally. This is done so that we can be sure the DNS changes are committed at the time "nmcli c up" returns. https://bugzilla.redhat.com/show_bug.cgi?id=2006677 --- src/core/devices/nm-device.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index fc11e458ed..7251d73c18 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -16705,6 +16705,15 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, _notify(self, PROP_STATE); _notify(self, PROP_STATE_REASON); + g_signal_emit(self, + signals[STATE_CHANGED], + 0, + (guint) state, + (guint) old_state, + (guint) reason); + + /* Only tell the clients of the change once we dealt with the state + * change internally. That is, policy finished the DNS update and such. */ nm_dbus_object_emit_signal(NM_DBUS_OBJECT(self), &interface_info_device, &signal_info_state_changed, @@ -16712,12 +16721,6 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, (guint32) state, (guint32) old_state, (guint32) reason); - g_signal_emit(self, - signals[STATE_CHANGED], - 0, - (guint) state, - (guint) old_state, - (guint) reason); /* Post-process the event after internal notification */