diff options
author | Thomas Haller <thaller@redhat.com> | 2021-04-23 17:56:50 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2021-04-28 13:20:02 +0200 |
commit | 4285eed8ebf35bd4e751494bd49a46b88e881d6f (patch) | |
tree | d41ead9af21ff408024091d86e89ebb1888e23b3 | |
parent | 8ee5ec00f91a5f45c3ab1469d5b145ad16961e3f (diff) | |
download | NetworkManager-4285eed8ebf35bd4e751494bd49a46b88e881d6f.tar.gz |
dns/resolved: add watchdog D-Bus activating systemd-resolved
Currently, it doesn't actually do anything (beside logging).
Will be used next.
-rw-r--r-- | src/core/dns/nm-dns-systemd-resolved.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/core/dns/nm-dns-systemd-resolved.c b/src/core/dns/nm-dns-systemd-resolved.c index 01fec10699..fdd25aa93d 100644 --- a/src/core/dns/nm-dns-systemd-resolved.c +++ b/src/core/dns/nm-dns-systemd-resolved.c @@ -58,6 +58,7 @@ typedef struct { GDBusConnection *dbus_connection; GHashTable * dirty_interfaces; GCancellable * cancellable; + GSource * try_start_timeout_source; CList request_queue_lst_head; guint name_owner_changed_id; bool send_updates_warn_ratelimited : 1; @@ -323,6 +324,20 @@ prepare_one_interface(NMDnsSystemdResolved *self, InterfaceConfig *ic) return has_config; } +static gboolean +_ensure_resolved_running_timeout(gpointer user_data) +{ + NMDnsSystemdResolved * self = user_data; + NMDnsSystemdResolvedPrivate *priv = NM_DNS_SYSTEMD_RESOLVED_GET_PRIVATE(self); + + nm_clear_g_source_inst(&priv->try_start_timeout_source); + + _LOGT("send-updates: timeout waiting for systemd-resolved to start. Systemd-resolved won't be " + "used until it appears on the bus"); + + return G_SOURCE_CONTINUE; +} + static NMTernary ensure_resolved_running(NMDnsSystemdResolved *self) { @@ -344,6 +359,14 @@ ensure_resolved_running(NMDnsSystemdResolved *self) _LOGT("send-updates: no name owner. Try start service..."); priv->try_start_blocked = TRUE; + priv->try_start_timeout_source = + nm_g_source_attach(nm_g_timeout_source_new(4000, + G_PRIORITY_DEFAULT, + _ensure_resolved_running_timeout, + self, + NULL), + NULL); + nm_dbus_connection_call_start_service_by_name(priv->dbus_connection, SYSTEMD_RESOLVED_DBUS_SERVICE, -1, @@ -506,6 +529,8 @@ name_owner_changed(NMDnsSystemdResolved *self, const char *owner) else _LOGT("D-Bus name for systemd-resolved has owner %s", owner); + nm_clear_g_source_inst(&priv->try_start_timeout_source); + priv->dbus_has_owner = !!owner; if (owner) { priv->try_start_blocked = FALSE; @@ -628,6 +653,8 @@ dispose(GObject *object) nm_clear_g_cancellable(&priv->cancellable); + nm_clear_g_source_inst(&priv->try_start_timeout_source); + g_clear_object(&priv->dbus_connection); nm_clear_pointer(&priv->dirty_interfaces, g_hash_table_unref); |