[PATCH] resolv.conf updating
- From: "Tambet Ingo" <tambet gmail com>
- To: "network manager" <networkmanager-list gnome org>
- Subject: [PATCH] resolv.conf updating
- Date: Mon, 11 Aug 2008 13:28:19 +0300
Hey,
There's been quite a few discussions on how to update resolv.conf on
debian. Now that opensuse is also moving to a script to update
resolv.conf, I wrote a patch for NM to allow distro specific methods
for updating. It defaults to writing out manually (all distros except
opensuse for now), but should give a good example how to add a debian
specific workaround.
The other patch just removes the unused (and broken by design)
"should_update_resolv_conf".
Tambet
From 029c0b6fc59721a79a5df571c243b405162afad0 Mon Sep 17 00:00:00 2001
From: Tambet Ingo <tambet gmail com>
Date: Mon, 11 Aug 2008 12:44:18 +0300
Subject: [PATCH] resolv.conf updating rework.
diff --git a/src/NetworkManagerPolicy.c b/src/NetworkManagerPolicy.c
index 631068f..ea5d5e1 100644
--- a/src/NetworkManagerPolicy.c
+++ b/src/NetworkManagerPolicy.c
@@ -122,7 +122,6 @@ update_routing_and_dns (NMPolicy *policy, gboolean force_update)
NMActRequest *best_req = NULL;
GSList *devices, *iter;
NMNamedManager *named_mgr;
- NMIP4Config *config;
devices = nm_manager_get_devices (policy->manager);
for (iter = devices; iter; iter = g_slist_next (iter)) {
@@ -196,8 +195,10 @@ update_routing_and_dns (NMPolicy *policy, gboolean force_update)
}
named_mgr = nm_named_manager_get ();
- config = nm_device_get_ip4_config (best);
- nm_named_manager_add_ip4_config (named_mgr, config, NM_NAMED_IP_CONFIG_TYPE_BEST_DEVICE);
+ nm_named_manager_add_ip4_config (named_mgr,
+ nm_device_get_ip_iface (best),
+ nm_device_get_ip4_config (best),
+ NM_NAMED_IP_CONFIG_TYPE_BEST_DEVICE);
g_object_unref (named_mgr);
/* Now set new default active connection _after_ updating DNS info, so that
diff --git a/src/NetworkManagerSystem.c b/src/NetworkManagerSystem.c
index bf6b11d..5793963 100644
--- a/src/NetworkManagerSystem.c
+++ b/src/NetworkManagerSystem.c
@@ -385,7 +385,7 @@ nm_system_vpn_device_set_from_ip4_config (NMDevice *active_device,
out:
named_mgr = nm_named_manager_get ();
- nm_named_manager_add_ip4_config (named_mgr, config, NM_NAMED_IP_CONFIG_TYPE_VPN);
+ nm_named_manager_add_ip4_config (named_mgr, iface, config, NM_NAMED_IP_CONFIG_TYPE_VPN);
g_object_unref (named_mgr);
return TRUE;
@@ -406,7 +406,7 @@ gboolean nm_system_vpn_device_unset_from_ip4_config (NMDevice *active_device, co
g_return_val_if_fail (config != NULL, FALSE);
named_mgr = nm_named_manager_get ();
- nm_named_manager_remove_ip4_config (named_mgr, config);
+ nm_named_manager_remove_ip4_config (named_mgr, iface, config);
g_object_unref (named_mgr);
return TRUE;
diff --git a/src/named-manager/nm-named-manager.c b/src/named-manager/nm-named-manager.c
index 0162ea9..dc4a0b9 100644
--- a/src/named-manager/nm-named-manager.c
+++ b/src/named-manager/nm-named-manager.c
@@ -1,3 +1,5 @@
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+
/*
* Copyright (C) 2004 - 2008 Red Hat, Inc.
*
@@ -26,6 +28,8 @@
#include <stdlib.h>
#include <errno.h>
#include <arpa/inet.h>
+#include <sys/types.h>
+#include <unistd.h>
#include <glib.h>
#include <glib/gi18n.h>
@@ -85,50 +89,6 @@ nm_named_manager_error_quark (void)
return quark;
}
-static char *
-compute_nameservers (NMIP4Config *config)
-{
- int i, num;
- GString *str = NULL;
-
- g_return_val_if_fail (config != NULL, NULL);
-
- num = nm_ip4_config_get_num_nameservers (config);
- if (num == 0)
- return NULL;
-
- str = g_string_new ("");
- for (i = 0; i < num; i++) {
- #define ADDR_BUF_LEN 50
- struct in_addr addr;
- char *buf;
-
- addr.s_addr = nm_ip4_config_get_nameserver (config, i);
- buf = g_malloc0 (ADDR_BUF_LEN);
- if (!buf)
- continue;
-
- if (!inet_ntop (AF_INET, &addr, buf, ADDR_BUF_LEN))
- nm_warning ("%s: error converting IP4 address 0x%X",
- __func__, ntohl (addr.s_addr));
-
- if (i == 3) {
- g_string_append (str, "\n# ");
- g_string_append (str, _("NOTE: the glibc resolver does not support more than 3 nameservers."));
- g_string_append (str, "\n# ");
- g_string_append (str, _("The nameservers listed below may not be recognized."));
- g_string_append_c (str, '\n');
- }
-
- g_string_append (str, "nameserver ");
- g_string_append (str, buf);
- g_string_append_c (str, '\n');
- g_free (buf);
- }
-
- return g_string_free (str, FALSE);
-}
-
static void
merge_one_ip4_config (NMIP4Config *dst, NMIP4Config *src)
{
@@ -155,49 +115,221 @@ merge_one_ip4_config (NMIP4Config *dst, NMIP4Config *src)
}
}
+#if defined(TARGET_SUSE)
+/**********************************/
+/* SUSE */
+
+static void
+netconfig_child_setup (gpointer user_data G_GNUC_UNUSED)
+{
+ pid_t pid = getpid ();
+ setpgid (pid, pid);
+}
+
+static gint
+run_netconfig (GError **error)
+{
+ GPtrArray *argv;
+ gint stdin_fd;
+
+ argv = g_ptr_array_new ();
+ g_ptr_array_add (argv, "/sbin/netconfig");
+ g_ptr_array_add (argv, "modify");
+ g_ptr_array_add (argv, "--service");
+ g_ptr_array_add (argv, "NetworkManager");
+ g_ptr_array_add (argv, NULL);
+
+ if (!g_spawn_async_with_pipes (NULL, (char **) argv->pdata, NULL,
+ G_SPAWN_DO_NOT_REAP_CHILD,
+ netconfig_child_setup,
+ NULL, NULL, &stdin_fd,
+ NULL, NULL, error)) {
+ stdin_fd = -1;
+ }
+
+ g_ptr_array_free (argv, TRUE);
+
+ return stdin_fd;
+}
+
+static void
+write_to_netconfig (gint fd, const char *key, const char *value)
+{
+ char *str;
+ int x;
+
+ str = g_strdup_printf ("%s='%s'\n", key, value);
+ x = write (fd, str, strlen (str));
+ g_free (str);
+}
+
static gboolean
-rewrite_resolv_conf (NMNamedManager *mgr, GError **error)
+update_resolv_conf (const char *iface,
+ const char *domain,
+ char **searches,
+ char **nameservers,
+ GError **error)
{
- NMNamedManagerPrivate *priv;
- const char *tmp_resolv_conf = RESOLV_CONF ".tmp";
- char *searches = NULL, *domain = NULL;
- char *nameservers = NULL;
- guint32 num_domains, num_searches, i;
- NMIP4Config *composite;
- GSList *iter;
- FILE *f;
- GString *str;
+ gint fd;
+ char *str;
- g_return_val_if_fail (error != NULL, FALSE);
- g_return_val_if_fail (*error == NULL, FALSE);
+ fd = run_netconfig (error);
+ if (fd < 0)
+ return FALSE;
- priv = NM_NAMED_MANAGER_GET_PRIVATE (mgr);
+ write_to_netconfig (fd, "INTERFACE", iface);
- /* If the sysadmin disabled modifying resolv.conf, exit silently */
- if (!nm_system_should_modify_resolv_conf ()) {
- nm_info ("DHCP returned name servers but system has disabled dynamic modification!");
- return TRUE;
+ if (searches) {
+ str = g_strjoinv (" ", searches);
+ write_to_netconfig (fd, "DNSDOMAIN", str);
+ g_free (str);
}
+ if (nameservers) {
+ str = g_strjoinv (" ", nameservers);
+ write_to_netconfig (fd, "DNSSERVERS", str);
+ g_free (str);
+ }
+
+ close (fd);
+
+ return TRUE;
+}
+
+#else
+/**********************************/
+/* Generic */
+
+static gboolean
+update_resolv_conf (const char *iface,
+ const char *domain,
+ char **searches,
+ char **nameservers,
+ GError **error)
+{
+ const char *tmp_resolv_conf = RESOLV_CONF ".tmp";
+ char *domain_str = NULL;
+ char *searches_str = NULL;
+ char *nameservers_str = NULL;
+ FILE *f;
+
if ((f = fopen (tmp_resolv_conf, "w")) == NULL) {
g_set_error (error,
- NM_NAMED_MANAGER_ERROR,
- NM_NAMED_MANAGER_ERROR_SYSTEM,
- "Could not open " RESOLV_CONF ": %s\n",
- g_strerror (errno));
+ NM_NAMED_MANAGER_ERROR,
+ NM_NAMED_MANAGER_ERROR_SYSTEM,
+ "Could not open " RESOLV_CONF ": %s\n",
+ g_strerror (errno));
return FALSE;
}
if (fprintf (f, "%s","# generated by NetworkManager, do not edit!\n\n") < 0) {
g_set_error (error,
- NM_NAMED_MANAGER_ERROR,
- NM_NAMED_MANAGER_ERROR_SYSTEM,
- "Could not write " RESOLV_CONF ": %s\n",
- g_strerror (errno));
+ NM_NAMED_MANAGER_ERROR,
+ NM_NAMED_MANAGER_ERROR_SYSTEM,
+ "Could not write " RESOLV_CONF ": %s\n",
+ g_strerror (errno));
fclose (f);
return FALSE;
}
+ if (domain)
+ domain_str = g_strconcat ("domain ", domain, "\n\n", NULL);
+
+ if (searches) {
+ char *tmp_str;
+
+ tmp_str = g_strjoinv (" ", searches);
+ searches_str = g_strconcat ("search ", tmp_str, "\n\n", NULL);
+ g_free (tmp_str);
+ }
+
+ if (nameservers) {
+ GString *str;
+ int num;
+ int i;
+
+ str = g_string_new ("");
+ num = g_strv_length (nameservers);
+
+ for (i = 0; i < num; i++) {
+ if (i == 3) {
+ g_string_append (str, "\n# ");
+ g_string_append (str, _("NOTE: the glibc resolver does not support more than 3 nameservers."));
+ g_string_append (str, "\n# ");
+ g_string_append (str, _("The nameservers listed below may not be recognized."));
+ g_string_append_c (str, '\n');
+ }
+
+ g_string_append (str, "nameserver ");
+ g_string_append (str, nameservers[i]);
+ g_string_append_c (str, '\n');
+ }
+
+ nameservers_str = g_string_free (str, FALSE);
+ }
+
+ if (fprintf (f, "%s%s%s\n",
+ domain ? domain : "",
+ searches_str ? searches_str : "",
+ nameservers_str ? nameservers_str : "") < 0) {
+ g_set_error (error,
+ NM_NAMED_MANAGER_ERROR,
+ NM_NAMED_MANAGER_ERROR_SYSTEM,
+ "Could not write to " RESOLV_CONF ": %s\n",
+ g_strerror (errno));
+ }
+
+ g_free (domain_str);
+ g_free (searches_str);
+ g_free (nameservers_str);
+
+ if (fclose (f) < 0) {
+ if (*error == NULL) {
+ g_set_error (error,
+ NM_NAMED_MANAGER_ERROR,
+ NM_NAMED_MANAGER_ERROR_SYSTEM,
+ "Could not close " RESOLV_CONF ": %s\n",
+ g_strerror (errno));
+ }
+ }
+
+ if (*error == NULL) {
+ if (rename (tmp_resolv_conf, RESOLV_CONF) < 0) {
+ g_set_error (error,
+ NM_NAMED_MANAGER_ERROR,
+ NM_NAMED_MANAGER_ERROR_SYSTEM,
+ "Could not replace " RESOLV_CONF ": %s\n",
+ g_strerror (errno));
+ }
+ }
+
+ return *error ? FALSE : TRUE;
+}
+#endif
+
+#define ADDR_BUF_LEN 50
+
+static gboolean
+rewrite_resolv_conf (NMNamedManager *mgr, const char *iface, GError **error)
+{
+ NMNamedManagerPrivate *priv;
+ NMIP4Config *composite;
+ GSList *iter;
+ GPtrArray *array;
+ const char *domain = NULL;
+ char **searches = NULL;
+ char **nameservers = NULL;
+ int num_domains;
+ int num_searches;
+ int num_nameservers;
+ int i;
+ gboolean success;
+
+ g_return_val_if_fail (error != NULL, FALSE);
+ g_return_val_if_fail (*error == NULL, FALSE);
+
+ priv = NM_NAMED_MANAGER_GET_PRIVATE (mgr);
+
/* Construct the composite config from all the currently active IP4Configs */
composite = nm_ip4_config_new ();
@@ -239,79 +371,65 @@ rewrite_resolv_conf (NMNamedManager *mgr, GError **error)
num_domains = nm_ip4_config_get_num_domains (composite);
num_searches = nm_ip4_config_get_num_searches (composite);
+ /* Domain */
+ if (num_domains > 0)
+ domain = nm_ip4_config_get_domain (composite, 0);
+
+ /* Searches */
if ((num_searches == 0) && (num_domains > 0)) {
- str = g_string_new ("search");
- for (i = 0; i < num_domains; i++) {
- g_string_append_c (str, ' ');
- g_string_append (str, nm_ip4_config_get_domain (composite, i));
- }
+ array = g_ptr_array_sized_new (num_domains + 1);
+ for (i = 0; i < num_domains; i++)
+ g_ptr_array_add (array, g_strdup (nm_ip4_config_get_domain (composite, i)));
- g_string_append (str, "\n\n");
- searches = g_string_free (str, FALSE);
+ g_ptr_array_add (array, NULL);
+ searches = (char **) g_ptr_array_free (array, FALSE);
} else if (num_searches > 0) {
- str = g_string_new ("search");
- for (i = 0; i < num_searches; i++) {
- g_string_append_c (str, ' ');
- g_string_append (str, nm_ip4_config_get_search (composite, i));
- }
+ array = g_ptr_array_sized_new (num_searches + 1);
+ for (i = 0; i < num_searches; i++)
+ g_ptr_array_add (array, g_strdup (nm_ip4_config_get_search (composite, i)));
- g_string_append (str, "\n\n");
- searches = g_string_free (str, FALSE);
+ g_ptr_array_add (array, NULL);
+ searches = (char **) g_ptr_array_free (array, FALSE);
}
- /* Compute resolv.conf domain */
- if (num_domains > 0) {
- str = g_string_new ("domain ");
- g_string_append (str, nm_ip4_config_get_domain (composite, 0));
- g_string_append (str, "\n\n");
+ /* Name servers */
+ num_nameservers = nm_ip4_config_get_num_nameservers (composite);
+ if (num_nameservers > 0) {
+ array = g_ptr_array_sized_new (num_nameservers + 1);
+ for (i = 0; i < num_nameservers; i++) {
+ struct in_addr addr;
+ char *buf;
+
+ addr.s_addr = nm_ip4_config_get_nameserver (composite, i);
+ buf = g_malloc0 (ADDR_BUF_LEN);
+ if (!buf)
+ continue;
+
+ if (inet_ntop (AF_INET, &addr, buf, ADDR_BUF_LEN))
+ g_ptr_array_add (array, buf);
+ else
+ nm_warning ("%s: error converting IP4 address 0x%X",
+ __func__, ntohl (addr.s_addr));
+ }
- domain = g_string_free (str, FALSE);
+ g_ptr_array_add (array, NULL);
+ nameservers = (char **) g_ptr_array_free (array, FALSE);
}
- /* Using glibc resolver */
- nameservers = compute_nameservers (composite);
- if (fprintf (f, "%s%s%s\n",
- domain ? domain : "",
- searches ? searches : "",
- nameservers ? nameservers : "") < 0) {
- g_set_error (error,
- NM_NAMED_MANAGER_ERROR,
- NM_NAMED_MANAGER_ERROR_SYSTEM,
- "Could not write to " RESOLV_CONF ": %s\n",
- g_strerror (errno));
- }
- g_free (nameservers);
-
- if (fclose (f) < 0) {
- if (*error == NULL) {
- g_set_error (error,
- NM_NAMED_MANAGER_ERROR,
- NM_NAMED_MANAGER_ERROR_SYSTEM,
- "Could not close " RESOLV_CONF ": %s\n",
- g_strerror (errno));
- }
- }
+ success = update_resolv_conf (iface, domain, searches, nameservers, error);
- g_free (domain);
- g_free (searches);
+ g_strfreev (searches);
+ g_strfreev (nameservers);
- if (*error == NULL) {
- if (rename (tmp_resolv_conf, RESOLV_CONF) < 0) {
- g_set_error (error,
- NM_NAMED_MANAGER_ERROR,
- NM_NAMED_MANAGER_ERROR_SYSTEM,
- "Could not replace " RESOLV_CONF ": %s\n",
- g_strerror (errno));
- } else {
- nm_system_update_dns ();
- }
- }
+ if (success)
+ nm_system_update_dns ();
- return *error ? FALSE : TRUE;
+ return success;
}
gboolean
nm_named_manager_add_ip4_config (NMNamedManager *mgr,
+ const char *iface,
NMIP4Config *config,
NMNamedIPConfigType cfg_type)
{
@@ -319,6 +437,7 @@ nm_named_manager_add_ip4_config (NMNamedManager *mgr,
GError *error = NULL;
g_return_val_if_fail (mgr != NULL, FALSE);
+ g_return_val_if_fail (iface != NULL, FALSE);
g_return_val_if_fail (config != NULL, FALSE);
priv = NM_NAMED_MANAGER_GET_PRIVATE (mgr);
@@ -338,7 +457,7 @@ nm_named_manager_add_ip4_config (NMNamedManager *mgr,
if (!g_slist_find (priv->configs, config))
priv->configs = g_slist_append (priv->configs, g_object_ref (config));
- if (!rewrite_resolv_conf (mgr, &error)) {
+ if (!rewrite_resolv_conf (mgr, iface, &error)) {
nm_warning ("Could not commit DNS changes. Error: '%s'", error ? error->message : "(none)");
g_error_free (error);
}
@@ -347,12 +466,15 @@ nm_named_manager_add_ip4_config (NMNamedManager *mgr,
}
gboolean
-nm_named_manager_remove_ip4_config (NMNamedManager *mgr, NMIP4Config *config)
+nm_named_manager_remove_ip4_config (NMNamedManager *mgr,
+ const char *iface,
+ NMIP4Config *config)
{
NMNamedManagerPrivate *priv;
GError *error = NULL;
g_return_val_if_fail (mgr != NULL, FALSE);
+ g_return_val_if_fail (iface != NULL, FALSE);
g_return_val_if_fail (config != NULL, FALSE);
priv = NM_NAMED_MANAGER_GET_PRIVATE (mgr);
@@ -371,7 +493,7 @@ nm_named_manager_remove_ip4_config (NMNamedManager *mgr, NMIP4Config *config)
g_object_unref (config);
- if (!rewrite_resolv_conf (mgr, &error)) {
+ if (!rewrite_resolv_conf (mgr, iface, &error)) {
nm_warning ("Could not commit DNS changes. Error: '%s'", error ? error->message : "(none)");
if (error)
g_error_free (error);
diff --git a/src/named-manager/nm-named-manager.h b/src/named-manager/nm-named-manager.h
index 33f4dec..00787a8 100644
--- a/src/named-manager/nm-named-manager.h
+++ b/src/named-manager/nm-named-manager.h
@@ -68,10 +68,13 @@ GType nm_named_manager_get_type (void);
NMNamedManager * nm_named_manager_get (void);
gboolean nm_named_manager_add_ip4_config (NMNamedManager *mgr,
+ const char *iface,
NMIP4Config *config,
NMNamedIPConfigType cfg_type);
-gboolean nm_named_manager_remove_ip4_config (NMNamedManager *mgr, NMIP4Config *config);
+gboolean nm_named_manager_remove_ip4_config (NMNamedManager *mgr,
+ const char *iface,
+ NMIP4Config *config);
G_END_DECLS
diff --git a/src/nm-device.c b/src/nm-device.c
index 9b20649..070b556 100644
--- a/src/nm-device.c
+++ b/src/nm-device.c
@@ -1734,13 +1734,14 @@ nm_device_set_ip4_config (NMDevice *self, NMIP4Config *config, NMDeviceStateReas
g_return_val_if_fail (reason != NULL, FALSE);
priv = NM_DEVICE_GET_PRIVATE (self);
+ ip_iface = nm_device_get_ip_iface (self);
if (priv->ip4_config) {
NMNamedManager *named_mgr;
/* Remove any previous IP4 Config from the named manager */
named_mgr = nm_named_manager_get ();
- nm_named_manager_remove_ip4_config (named_mgr, priv->ip4_config);
+ nm_named_manager_remove_ip4_config (named_mgr, ip_iface, priv->ip4_config);
g_object_unref (named_mgr);
g_object_unref (priv->ip4_config);
@@ -1752,8 +1753,6 @@ nm_device_set_ip4_config (NMDevice *self, NMIP4Config *config, NMDeviceStateReas
priv->ip4_config = g_object_ref (config);
- ip_iface = nm_device_get_ip_iface (self);
-
success = nm_system_device_set_from_ip4_config (ip_iface, config);
if (success) {
nm_device_update_ip4_address (self);
--
1.5.4.5
From 63830c2b9687f3b914387793ad6889795ebdac28 Mon Sep 17 00:00:00 2001
From: Tambet Ingo <tambet gmail com>
Date: Mon, 11 Aug 2008 12:48:37 +0300
Subject: [PATCH] Remove should_remove_resolv_conf.
diff --git a/src/NetworkManagerSystem.h b/src/NetworkManagerSystem.h
index 75c550b..496a314 100644
--- a/src/NetworkManagerSystem.h
+++ b/src/NetworkManagerSystem.h
@@ -66,6 +66,4 @@ void nm_system_set_hostname (NMIP4Config *config);
gboolean nm_system_device_set_mtu (const char *iface, guint32 mtu);
-gboolean nm_system_should_modify_resolv_conf (void);
-
#endif
diff --git a/src/backends/NetworkManagerArch.c b/src/backends/NetworkManagerArch.c
index cc847eb..a7a4fe4 100644
--- a/src/backends/NetworkManagerArch.c
+++ b/src/backends/NetworkManagerArch.c
@@ -79,16 +79,6 @@ void nm_system_update_dns (void)
}
/*
- * nm_system_should_modify_resolv_conf
- *
- * Can NM update resolv.conf, or is it locked down?
- */
-gboolean nm_system_should_modify_resolv_conf (void)
-{
- return TRUE;
-}
-
-/*
* nm_system_set_hostname
*
* set the hostname
diff --git a/src/backends/NetworkManagerDebian.c b/src/backends/NetworkManagerDebian.c
index 0ea3b6d..d9e2ead 100644
--- a/src/backends/NetworkManagerDebian.c
+++ b/src/backends/NetworkManagerDebian.c
@@ -73,14 +73,3 @@ void nm_system_update_dns (void)
void nm_system_set_hostname (NMIP4Config *config)
{
}
-
-/*
- * nm_system_should_modify_resolv_conf
- *
- * Can NM update resolv.conf, or is it locked down?
- */
-gboolean nm_system_should_modify_resolv_conf (void)
-{
- return TRUE;
-}
-
diff --git a/src/backends/NetworkManagerFrugalware.c b/src/backends/NetworkManagerFrugalware.c
index 7eadfa9..47a19f5 100644
--- a/src/backends/NetworkManagerFrugalware.c
+++ b/src/backends/NetworkManagerFrugalware.c
@@ -71,14 +71,3 @@ void nm_system_update_dns (void)
void nm_system_set_hostname (NMIP4Config *config)
{
}
-
-/*
- * nm_system_should_modify_resolv_conf
- *
- * Can NM update resolv.conf, or is it locked down?
- */
-gboolean nm_system_should_modify_resolv_conf (void)
-{
- return TRUE;
-}
-
diff --git a/src/backends/NetworkManagerGeneric.c b/src/backends/NetworkManagerGeneric.c
index b6a9d3b..ed4b02e 100644
--- a/src/backends/NetworkManagerGeneric.c
+++ b/src/backends/NetworkManagerGeneric.c
@@ -238,14 +238,3 @@ NMIP4Config *nm_generic_device_new_ip4_system_config (NMDevice *dev)
void nm_generic_set_hostname (NMIP4Config *config)
{
}
-
-/*
- * nm_generic_should_modify_resolv_conf
- *
- * Can NM update resolv.conf, or is it locked down?
- */
-gboolean nm_generic_should_modify_resolv_conf (void)
-{
- return TRUE;
-}
-
diff --git a/src/backends/NetworkManagerGeneric.h b/src/backends/NetworkManagerGeneric.h
index 0cb88bc..8c2a817 100644
--- a/src/backends/NetworkManagerGeneric.h
+++ b/src/backends/NetworkManagerGeneric.h
@@ -52,6 +52,4 @@ gboolean nm_generic_device_set_up_down_with_iface (NMDevice *dev, const char *
void nm_generic_set_hostname (NMIP4Config *config);
-gboolean nm_generic_should_modify_resolv_conf (void);
-
#endif
diff --git a/src/backends/NetworkManagerGentoo.c b/src/backends/NetworkManagerGentoo.c
index ef4abbe..a34ba3f 100644
--- a/src/backends/NetworkManagerGentoo.c
+++ b/src/backends/NetworkManagerGentoo.c
@@ -80,15 +80,3 @@ void nm_system_update_dns (void)
void nm_system_set_hostname (NMIP4Config *config)
{
}
-
-/*
- * nm_system_should_modify_resolv_conf
- *
- * Can NM update resolv.conf, or is it locked down?
- */
-gboolean nm_system_should_modify_resolv_conf (void)
-{
- return TRUE;
-}
-
-
diff --git a/src/backends/NetworkManagerMandriva.c b/src/backends/NetworkManagerMandriva.c
index bf4e63e..c9d79f0 100644
--- a/src/backends/NetworkManagerMandriva.c
+++ b/src/backends/NetworkManagerMandriva.c
@@ -74,15 +74,3 @@ void nm_system_update_dns (void)
void nm_system_set_hostname (NMIP4Config *config)
{
}
-
-
-/*
- * nm_system_should_modify_resolv_conf
- *
- * Can NM update resolv.conf, or is it locked down?
- */
-gboolean nm_system_should_modify_resolv_conf (void)
-{
- return TRUE;
-}
-
diff --git a/src/backends/NetworkManagerPaldo.c b/src/backends/NetworkManagerPaldo.c
index b1fdc0a..a2ea9ca 100644
--- a/src/backends/NetworkManagerPaldo.c
+++ b/src/backends/NetworkManagerPaldo.c
@@ -73,15 +73,3 @@ void nm_system_update_dns (void)
void nm_system_set_hostname (NMIP4Config *config)
{
}
-
-
-/*
- * nm_system_should_modify_resolv_conf
- *
- * Can NM update resolv.conf, or is it locked down?
- */
-gboolean nm_system_should_modify_resolv_conf (void)
-{
- return TRUE;
-}
-
diff --git a/src/backends/NetworkManagerRedHat.c b/src/backends/NetworkManagerRedHat.c
index fd7cc45..50e47f2 100644
--- a/src/backends/NetworkManagerRedHat.c
+++ b/src/backends/NetworkManagerRedHat.c
@@ -72,15 +72,3 @@ void nm_system_update_dns (void)
void nm_system_set_hostname (NMIP4Config *config)
{
}
-
-
-/*
- * nm_system_should_modify_resolv_conf
- *
- * Can NM update resolv.conf, or is it locked down?
- */
-gboolean nm_system_should_modify_resolv_conf (void)
-{
- return TRUE;
-}
-
diff --git a/src/backends/NetworkManagerSlackware.c b/src/backends/NetworkManagerSlackware.c
index 191c5ac..16c3c17 100644
--- a/src/backends/NetworkManagerSlackware.c
+++ b/src/backends/NetworkManagerSlackware.c
@@ -69,14 +69,3 @@ void nm_system_update_dns (void)
void nm_system_set_hostname (NMIP4Config *config)
{
}
-
-/*
- * nm_system_should_modify_resolv_conf
- *
- * Can NM update resolv.conf, or is it locked down?
- */
-gboolean nm_system_should_modify_resolv_conf (void)
-{
- return TRUE;
-}
-
diff --git a/src/backends/NetworkManagerSuSE.c b/src/backends/NetworkManagerSuSE.c
index 36934b6..5ba7e8d 100644
--- a/src/backends/NetworkManagerSuSE.c
+++ b/src/backends/NetworkManagerSuSE.c
@@ -131,36 +131,3 @@ out_close:
out_gfree:
g_free (filename);
}
-
-/*
- * nm_system_should_modify_resolv_conf
- *
- * Can NM update resolv.conf, or is it locked down?
- */
-gboolean nm_system_should_modify_resolv_conf (void)
-{
- char *name, *buf;
- shvarFile *file;
- gboolean ret = TRUE;
-
- name = g_strdup_printf (SYSCONFDIR"/sysconfig/network/dhcp");
- file = svNewFile (name);
- if (!file)
- goto out_gfree;
-
- buf = svGetValue (file, "DHCLIENT_MODIFY_RESOLV_CONF");
- if (!buf)
- goto out_close;
-
- if (strcmp (buf, "no") == 0)
- ret = FALSE;
-
- free (buf);
-out_close:
- svCloseFile (file);
-out_gfree:
- g_free (name);
-
- return ret;
-}
-
--
1.5.4.5
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]