diff --git a/src/core/nm-l3cfg.c b/src/core/nm-l3cfg.c index 575840431b..93e92673df 100644 --- a/src/core/nm-l3cfg.c +++ b/src/core/nm-l3cfg.c @@ -2582,18 +2582,19 @@ _l3_commit_on_idle_cb(gpointer user_data) return G_SOURCE_REMOVE; } -void +gboolean nm_l3cfg_commit_on_idle_schedule(NML3Cfg *self) { nm_assert(NM_IS_L3CFG(self)); if (self->priv.p->commit_on_idle_source) - return; + return FALSE; _LOGT("commit on idle (scheduled)"); self->priv.p->commit_on_idle_source = nm_g_idle_source_new(G_PRIORITY_DEFAULT, _l3_commit_on_idle_cb, self, NULL); g_source_attach(self->priv.p->commit_on_idle_source, NULL); + return TRUE; } /*****************************************************************************/ @@ -3697,6 +3698,23 @@ _nm_l3cfg_unregister_ipv4ll(NML3Cfg *self) /*****************************************************************************/ +gboolean +nm_l3cfg_is_ready(NML3Cfg *self) +{ + g_return_val_if_fail(NM_IS_L3CFG(self), FALSE); + + if (self->priv.p->changed_configs_configs) + return FALSE; + if (self->priv.p->changed_configs_acd_state) + return FALSE; + if (self->priv.p->commit_on_idle_source) + return FALSE; + + return TRUE; +} + +/*****************************************************************************/ + static void set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { diff --git a/src/core/nm-l3cfg.h b/src/core/nm-l3cfg.h index 4efae0c54d..037f21784d 100644 --- a/src/core/nm-l3cfg.h +++ b/src/core/nm-l3cfg.h @@ -98,7 +98,8 @@ typedef enum { NM_L3_CONFIG_NOTIFY_TYPE_ACD_EVENT, - /* emitted at the end of nm_l3cfg_platform_commit(). */ + /* emitted at the end of nm_l3cfg_platform_commit(). This signals also that + * nm_l3cfg_is_ready() might have switched to TRUE. */ NM_L3_CONFIG_NOTIFY_TYPE_POST_COMMIT, /* NML3Cfg hooks to the NMPlatform signals for link, addresses and routes. @@ -170,6 +171,8 @@ NML3Cfg *nm_l3cfg_new(NMNetns *netns, int ifindex); /*****************************************************************************/ +gboolean nm_l3cfg_is_ready(NML3Cfg *self); + void _nm_l3cfg_notify_platform_change_on_idle(NML3Cfg *self, guint32 obj_type_flags); void _nm_l3cfg_notify_platform_change(NML3Cfg * self, @@ -328,7 +331,7 @@ typedef enum _nm_packed { void nm_l3cfg_commit(NML3Cfg *self, NML3CfgCommitType commit_type); -void nm_l3cfg_commit_on_idle_schedule(NML3Cfg *self); +gboolean nm_l3cfg_commit_on_idle_schedule(NML3Cfg *self); /*****************************************************************************/