Blob Blame History Raw
From 8d027cfe6012d001df5ba3342a3e1e75fe629088 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Tue, 19 Nov 2013 19:40:28 -0600
Subject: [PATCH 1/3] policy: ignore nameservers when starting lookup thread
 (rh #1031763)

When generating connections, we won't always have DNS information.
Plus, the "best" device already has the default route, which is a
pretty good indication it should be the address we use for looking
up the hostname.
---
 src/nm-policy.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/nm-policy.c b/src/nm-policy.c
index fe21d40..b9c915f 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -460,17 +460,15 @@ update_system_hostname (NMPolicy *policy, NMDevice *best4, NMDevice *best6)
 	 * bootup hostname. Start reverse DNS of the current IPv4 or IPv6 address.
 	 */
 	if (best4) {
 		NMIP4Config *ip4_config;
 		const NMPlatformIP4Address *addr4;
 
 		ip4_config = nm_device_get_ip4_config (best4);
-		if (   !ip4_config
-		    || (nm_ip4_config_get_num_nameservers (ip4_config) == 0)
-		    || (nm_ip4_config_get_num_addresses (ip4_config) == 0)) {
+		if (!ip4_config || (nm_ip4_config_get_num_addresses (ip4_config) == 0)) {
 			/* No valid IP4 config (!!); fall back to localhost.localdomain */
 			_set_hostname (policy, NULL, "no IPv4 config");
 			return;
 		}
 
 		addr4 = nm_ip4_config_get_address (ip4_config, 0);
 		g_assert (addr4); /* checked for > 1 address above */
@@ -478,17 +476,15 @@ update_system_hostname (NMPolicy *policy, NMDevice *best4, NMDevice *best6)
 		priv->lookup_addr = g_inet_address_new_from_bytes ((guint8 *) &addr4->address,
 		                                                     G_SOCKET_FAMILY_IPV4);
 	} else {
 		NMIP6Config *ip6_config;
 		const NMPlatformIP6Address *addr6;
 
 		ip6_config = nm_device_get_ip6_config (best6);
-		if (   !ip6_config
-		    || (nm_ip6_config_get_num_nameservers (ip6_config) == 0)
-		    || (nm_ip6_config_get_num_addresses (ip6_config) == 0)) {
+		if (!ip6_config || (nm_ip6_config_get_num_addresses (ip6_config) == 0)) {
 			/* No valid IP6 config (!!); fall back to localhost.localdomain */
 			_set_hostname (policy, NULL, "no IPv6 config");
 			return;
 		}
 
 		addr6 = nm_ip6_config_get_address (ip6_config, 0);
 		g_assert (addr6); /* checked for > 1 address above */
-- 
1.8.3.1