Commit c7d88645 authored by Thomas Haller's avatar Thomas Haller
Browse files

connectivity: honor "main.systemd-resolved" setting to not resolve names first

If the user disabled systemd-resolved, two things seem apparent:

 - the user does not want us to use systemd-resolved

 - NetworkManager is not pushing the DNS configuration to

It seems to me, we should not consult systemd-resolved in that case.
parent df734a03
......@@ -402,11 +402,13 @@ no-auto-default=*
<literal>systemd-resolved</literal>. Defaults to "<literal>true</literal>".
<para>Note that this setting is complementary to the
<varname>dns</varname> setting. You can keep this enable while using
<varname>dns</varname> setting. You can keep this enabled while using
<varname>dns</varname> set to another DNS plugin alongside
<literal>systemd-resolved</literal>, or <varname>dns</varname> set to
<literal>systemd-resolved</literal> to configure the system resolver to use
<para>If systemd-resolved is enabled, the connectivity check resolves the
hostname per-device.</para>
......@@ -344,6 +344,21 @@ _ip_config_lst_head (NMDnsManager *self)
nm_dns_manager_has_systemd_resolved (NMDnsManager *self)
NMDnsManagerPrivate *priv;
g_return_val_if_fail (NM_IS_DNS_MANAGER (self), FALSE);
return priv->sd_resolve_plugin
|| NM_IS_DNS_SYSTEMD_RESOLVED (priv->plugin);
static void
add_string_item (GPtrArray *array, const char *str, gboolean dup)
......@@ -129,6 +129,8 @@ typedef enum {
void nm_dns_manager_stop (NMDnsManager *self);
gboolean nm_dns_manager_has_systemd_resolved (NMDnsManager *self);
char *nmtst_dns_create_resolv_conf (const char *const*searches,
......@@ -23,7 +23,6 @@
#include "nm-default.h"
#include "nm-connectivity.h"
#include "nm-dbus-manager.h"
#include <string.h>
......@@ -34,6 +33,8 @@
#include "c-list/src/c-list.h"
#include "nm-config.h"
#include "NetworkManagerUtils.h"
#include "nm-dbus-manager.h"
#include "dns/nm-dns-manager.h"
#define HEADER_STATUS_ONLINE "X-NetworkManager-Status: online\r\n"
......@@ -114,9 +115,10 @@ typedef struct {
char *host;
char *port;
char *response;
gboolean enabled;
guint interval;
NMConfig *config;
guint interval;
bool enabled:1;
} NMConnectivityPrivate;
struct _NMConnectivity {
......@@ -728,10 +730,22 @@ nm_connectivity_check_start (NMConnectivity *self,
if (iface && ifindex > 0 && priv->enabled && priv->host) {
GDBusConnection *dbus_connection;
gboolean has_systemd_resolved;
cb_data->concheck.ifindex = ifindex;
/* note that we pick up support for systemd-resolved right away when we need it.
* We don't need to remember the setting, because we can (cheaply) check anew
* on each request.
* Yes, this makes NMConnectivity singleton dependent on NMDnsManager singleton.
* Well, not really: it makes connectivity-check-start dependent on NMDnsManager
* which merely means, not to start a connectivity check, late during shutdown. */
has_systemd_resolved = nm_dns_manager_has_systemd_resolved (nm_dns_manager_get ());
if (has_systemd_resolved) {
GDBusConnection *dbus_connection;
dbus_connection = nm_dbus_manager_get_dbus_connection (nm_dbus_manager_get ());
if (!dbus_connection) {
/* we have no D-Bus connection? That might happen in configure and quit mode.
......@@ -761,10 +775,15 @@ nm_connectivity_check_start (NMConnectivity *self,
_LOG2D ("start request to '%s' (try resolving '%s' using systemd-resolved)",
} else {
_LOG2D ("start request to '%s' (systemd-resolved not available)",
do_curl_request (cb_data);
return cb_data;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment