diff --git a/src/core/dns/nm-dns-dnsmasq.h b/src/core/dns/nm-dns-dnsmasq.h index bd6d4c60b7..575b0b263f 100644 --- a/src/core/dns/nm-dns-dnsmasq.h +++ b/src/core/dns/nm-dns-dnsmasq.h @@ -7,6 +7,7 @@ #define __NETWORKMANAGER_DNS_DNSMASQ_H__ #include "nm-dns-plugin.h" +#include "nm-dns-manager.h" #define NM_TYPE_DNS_DNSMASQ (nm_dns_dnsmasq_get_type()) #define NM_DNS_DNSMASQ(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_DNS_DNSMASQ, NMDnsDnsmasq)) diff --git a/src/core/dns/nm-dns-manager.c b/src/core/dns/nm-dns-manager.c index f161b14c0d..4c498c8248 100644 --- a/src/core/dns/nm-dns-manager.c +++ b/src/core/dns/nm-dns-manager.c @@ -378,11 +378,11 @@ _mgr_get_configs_lst_head(NMDnsManager *self) /*****************************************************************************/ -gboolean -nm_dns_manager_has_systemd_resolved(NMDnsManager *self) +NMDnsPlugin * +nm_dns_manager_get_systemd_resolved(NMDnsManager *self) { - NMDnsManagerPrivate * priv; - NMDnsSystemdResolved *plugin = NULL; + NMDnsManagerPrivate *priv; + NMDnsPlugin * plugin = NULL; g_return_val_if_fail(NM_IS_DNS_MANAGER(self), FALSE); @@ -390,11 +390,14 @@ nm_dns_manager_has_systemd_resolved(NMDnsManager *self) if (priv->sd_resolve_plugin) { nm_assert(!NM_IS_DNS_SYSTEMD_RESOLVED(priv->plugin)); - plugin = NM_DNS_SYSTEMD_RESOLVED(priv->sd_resolve_plugin); + plugin = priv->sd_resolve_plugin; } else if (NM_IS_DNS_SYSTEMD_RESOLVED(priv->plugin)) - plugin = NM_DNS_SYSTEMD_RESOLVED(priv->plugin); + plugin = priv->plugin; - return plugin && nm_dns_systemd_resolved_is_running(plugin); + if (plugin && nm_dns_systemd_resolved_is_running(NM_DNS_SYSTEMD_RESOLVED(plugin))) + return plugin; + + return NULL; } /*****************************************************************************/ diff --git a/src/core/dns/nm-dns-manager.h b/src/core/dns/nm-dns-manager.h index 937ba62a05..501085f701 100644 --- a/src/core/dns/nm-dns-manager.h +++ b/src/core/dns/nm-dns-manager.h @@ -11,6 +11,7 @@ #include "nm-ip4-config.h" #include "nm-ip6-config.h" #include "nm-setting-connection.h" +#include "nm-dns-plugin.h" typedef enum { NM_DNS_IP_CONFIG_TYPE_REMOVED = -1, @@ -148,7 +149,7 @@ typedef enum { void nm_dns_manager_stop(NMDnsManager *self); -gboolean nm_dns_manager_has_systemd_resolved(NMDnsManager *self); +NMDnsPlugin *nm_dns_manager_get_systemd_resolved(NMDnsManager *self); /*****************************************************************************/ diff --git a/src/core/dns/nm-dns-plugin.h b/src/core/dns/nm-dns-plugin.h index 644d01e51b..82ca7d6b37 100644 --- a/src/core/dns/nm-dns-plugin.h +++ b/src/core/dns/nm-dns-plugin.h @@ -6,7 +6,8 @@ #ifndef __NM_DNS_PLUGIN_H__ #define __NM_DNS_PLUGIN_H__ -#include "nm-dns-manager.h" +#include "c-list/src/c-list.h" + #include "nm-config-data.h" #define NM_TYPE_DNS_PLUGIN (nm_dns_plugin_get_type()) diff --git a/src/core/dns/nm-dns-systemd-resolved.h b/src/core/dns/nm-dns-systemd-resolved.h index b7e30d81f7..9f9733184c 100644 --- a/src/core/dns/nm-dns-systemd-resolved.h +++ b/src/core/dns/nm-dns-systemd-resolved.h @@ -8,6 +8,7 @@ #define __NETWORKMANAGER_DNS_SYSTEMD_RESOLVED_H__ #include "nm-dns-plugin.h" +#include "nm-dns-manager.h" #define NM_TYPE_DNS_SYSTEMD_RESOLVED (nm_dns_systemd_resolved_get_type()) #define NM_DNS_SYSTEMD_RESOLVED(obj) \ diff --git a/src/core/nm-connectivity.c b/src/core/nm-connectivity.c index a29be6d2aa..85d41b4919 100644 --- a/src/core/nm-connectivity.c +++ b/src/core/nm-connectivity.c @@ -904,7 +904,7 @@ nm_connectivity_check_start(NMConnectivity * self, * This is relatively cumbersome to avoid, because we would have to go through * NMDnsSystemdResolved trying to asynchronously start the service, to ensure there * is only one attempt to start the service. */ - has_systemd_resolved = nm_dns_manager_has_systemd_resolved(nm_dns_manager_get()); + has_systemd_resolved = !!nm_dns_manager_get_systemd_resolved(nm_dns_manager_get()); if (has_systemd_resolved) { GDBusConnection *dbus_connection;