summary refs log tree commit diff
path: root/src/nm-policy.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2011-03-18 20:17:47 +0100
committerMichael Biebl <biebl@debian.org>2011-03-18 20:17:47 +0100
commite22c6e05e9ebc6cce941762020c5710b8014677b (patch)
tree7e9fd7f8ae24a94b03f683e0cef9a346968e1e8b /src/nm-policy.c
parenta6b89d35fabd9f5934b84d7cde22e9268f92c3d3 (diff)
Imported Upstream version 0.8.3.998 upstream/0.8.3.998
Diffstat (limited to 'src/nm-policy.c')
-rw-r--r--src/nm-policy.c51
1 files changed, 1 insertions, 50 deletions
diff --git a/src/nm-policy.c b/src/nm-policy.c
index e8a18d02..aed2f897 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -42,7 +42,6 @@
 #include "nm-system.h"
 #include "nm-dns-manager.h"
 #include "nm-vpn-manager.h"
-#include "nm-policy-hosts.h"
 #include "nm-policy-hostname.h"
 
 struct NMPolicy {
@@ -233,9 +232,6 @@ _set_hostname (NMPolicy *policy,
                const char *new_hostname,
                const char *msg)
 {
-	char ip4_addr[INET_ADDRSTRLEN + 1];
-	char ip6_addr[INET6_ADDRSTRLEN + 1];
-
 	if (change_hostname) {
 		NMDnsManager *dns_mgr;
 
@@ -247,43 +243,7 @@ _set_hostname (NMPolicy *policy,
 		g_object_unref (dns_mgr);
 	}
 
-	/* Get the default IPv4 and IPv6 addresses so we can assign
-	 * the hostname to them in /etc/hosts.
-	 */
-	memset (ip4_addr, 0, sizeof (ip4_addr));
-	if (policy->default_device4) {
-		NMIP4Config *config = NULL;
-		NMIP4Address *addr = NULL;
-
-		config = nm_device_get_ip4_config (policy->default_device4);
-		if (config)
-			addr = nm_ip4_config_get_address (config, 0);
-
-		if (addr) {
-			struct in_addr tmp;
-
-			tmp.s_addr = nm_ip4_address_get_address (addr);
-			inet_ntop (AF_INET, &tmp, ip4_addr, sizeof (ip4_addr));
-		}
-	}
-
-	memset (ip6_addr, 0, sizeof (ip6_addr));
-	if (policy->default_device6) {
-		NMIP6Config *config = NULL;
-		NMIP6Address *addr = NULL;
-
-		config = nm_device_get_ip6_config (policy->default_device6);
-		if (config)
-			addr = nm_ip6_config_get_address (config, 0);
-
-		if (addr)
-			inet_ntop (AF_INET6, nm_ip6_address_get_address (addr), ip6_addr, sizeof (ip6_addr));
-	}
-
-	if (nm_policy_set_system_hostname (policy->cur_hostname,
-	                                   strlen (ip4_addr) ? ip4_addr : NULL,
-	                                   strlen (ip6_addr) ? ip6_addr : NULL,
-	                                   msg))
+	if (nm_policy_set_system_hostname (policy->cur_hostname, msg))
 		nm_utils_call_dispatcher ("hostname", NULL, NULL, NULL);
 }
 
@@ -1235,15 +1195,6 @@ nm_policy_destroy (NMPolicy *policy)
 	}
 	g_slist_free (policy->dev_signal_ids);
 
-	/* Rewrite /etc/hosts on exit to ensure we don't leave stale IP addresses
-	 * lying around.  FIXME: this will take out a valid IP address of an
-	 * ethernet device we're leaving active (ie, a connection we can "assume"
-	 * when NM starts again).
-	 */
-	policy->default_device4 = NULL;
-	policy->default_device6 = NULL;
-	update_system_hostname (policy, NULL, NULL);
-
 	g_free (policy->orig_hostname);
 	g_free (policy->cur_hostname);