summary refs log tree commit diff
path: root/src/core/devices/nm-device-utils.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2022-01-13 22:30:39 +0100
committerMichael Biebl <biebl@debian.org>2022-01-13 22:30:39 +0100
commit88c227d90a6b7b388c5c85d72802a0ca8f05ed5c (patch)
tree71f32df6617802270e8a78574bd8e1637dc532f4 /src/core/devices/nm-device-utils.c
parente74c568b07b50b97873fb4ee1d776dedefbd54d6 (diff)
New upstream version 1.34.0 upstream/1.34.0
Diffstat (limited to 'src/core/devices/nm-device-utils.c')
-rw-r--r--src/core/devices/nm-device-utils.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/core/devices/nm-device-utils.c b/src/core/devices/nm-device-utils.c
index f40ca570..2a6ab04e 100644
--- a/src/core/devices/nm-device-utils.c
+++ b/src/core/devices/nm-device-utils.c
@@ -10,7 +10,7 @@
 /*****************************************************************************/
 
 NM_UTILS_LOOKUP_STR_DEFINE(
-    nm_device_state_queued_state_to_str,
+    nm_device_state_queued_state_to_string,
     NMDeviceState,
     NM_UTILS_LOOKUP_DEFAULT(NM_PENDING_ACTIONPREFIX_QUEUED_STATE_CHANGE "???"),
     NM_UTILS_LOOKUP_STR_ITEM(NM_DEVICE_STATE_UNKNOWN,
@@ -41,14 +41,14 @@ NM_UTILS_LOOKUP_STR_DEFINE(
                              NM_PENDING_ACTIONPREFIX_QUEUED_STATE_CHANGE "failed"), );
 
 const char *
-nm_device_state_to_str(NMDeviceState state)
+nm_device_state_to_string(NMDeviceState state)
 {
-    return nm_device_state_queued_state_to_str(state)
+    return nm_device_state_queued_state_to_string(state)
            + NM_STRLEN(NM_PENDING_ACTIONPREFIX_QUEUED_STATE_CHANGE);
 }
 
 NM_UTILS_LOOKUP_STR_DEFINE(
-    nm_device_state_reason_to_str,
+    nm_device_state_reason_to_string,
     NMDeviceStateReason,
     NM_UTILS_LOOKUP_DEFAULT(NULL),
     NM_UTILS_LOOKUP_STR_ITEM(NM_DEVICE_STATE_REASON_UNKNOWN, "unknown"),
@@ -129,7 +129,7 @@ NM_UTILS_LOOKUP_STR_DEFINE(
                              "sriov-configuration-failed"),
     NM_UTILS_LOOKUP_STR_ITEM(NM_DEVICE_STATE_REASON_PEER_NOT_FOUND, "peer-not-found"), );
 
-NM_UTILS_LOOKUP_STR_DEFINE(nm_device_mtu_source_to_str,
+NM_UTILS_LOOKUP_STR_DEFINE(nm_device_mtu_source_to_string,
                            NMDeviceMtuSource,
                            NM_UTILS_LOOKUP_DEFAULT_NM_ASSERT("unknown"),
                            NM_UTILS_LOOKUP_STR_ITEM(NM_DEVICE_MTU_SOURCE_NONE, "none"),
@@ -138,7 +138,7 @@ NM_UTILS_LOOKUP_STR_DEFINE(nm_device_mtu_source_to_str,
                            NM_UTILS_LOOKUP_STR_ITEM(NM_DEVICE_MTU_SOURCE_CONNECTION,
                                                     "connection"), );
 
-NM_UTILS_LOOKUP_STR_DEFINE(nm_device_sys_iface_state_to_str,
+NM_UTILS_LOOKUP_STR_DEFINE(nm_device_sys_iface_state_to_string,
                            NMDeviceSysIfaceState,
                            NM_UTILS_LOOKUP_DEFAULT_NM_ASSERT("unknown"),
                            NM_UTILS_LOOKUP_STR_ITEM(NM_DEVICE_SYS_IFACE_STATE_EXTERNAL, "external"),
@@ -147,7 +147,7 @@ NM_UTILS_LOOKUP_STR_DEFINE(nm_device_sys_iface_state_to_str,
                            NM_UTILS_LOOKUP_STR_ITEM(NM_DEVICE_SYS_IFACE_STATE_REMOVED,
                                                     "removed"), );
 
-NM_UTILS_LOOKUP_STR_DEFINE(nm_device_ip_state_to_str,
+NM_UTILS_LOOKUP_STR_DEFINE(nm_device_ip_state_to_string,
                            NMDeviceIPState,
                            NM_UTILS_LOOKUP_DEFAULT_WARN("unknown"),
                            NM_UTILS_LOOKUP_STR_ITEM(NM_DEVICE_IP_STATE_NONE, "none"),
@@ -267,7 +267,18 @@ resolve_addr_resolved_cb(NMDnsSystemdResolved *                   resolved,
         _LOG2D(info, "error resolving via systemd-resolved: %s", error->message);
 
         dbus_error = g_dbus_error_get_remote_error(error);
-        if (nm_streq0(dbus_error, "org.freedesktop.resolve1.DnsError.NXDOMAIN")) {
+        if (NM_STR_HAS_PREFIX(dbus_error, "org.freedesktop.resolve1.")) {
+            /* systemd-resolved is enabled but it couldn't resolve the
+             * address via DNS.  Don't fall back to spawning the helper,
+             * because the helper will possibly ask again to
+             * systemd-resolved (via /etc/resolv.conf), potentially using
+             * other protocols than DNS or returning synthetic results.
+             *
+             * Consider the error as the final indication that the address
+             * can't be resolved.
+             *
+             * See: https://www.freedesktop.org/wiki/Software/systemd/resolved/#commonerrors
+             */
             resolve_addr_complete(info, NULL, g_error_copy(error));
             return;
         }