NetworkManager r3946 - in trunk: . src src/backends
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: NetworkManager r3946 - in trunk: . src src/backends
- Date: Tue, 12 Aug 2008 22:40:27 +0000 (UTC)
Author: dcbw
Date: Tue Aug 12 22:40:27 2008
New Revision: 3946
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3946&view=rev
Log:
2008-08-12 Dan Williams <dcbw redhat com>
* src/nm-device.c
- (nm_device_set_ip4_config): don't touch hostnames here; distros
that want to use DHCP hostnames should use dispatcher scripts
for that
* src/NetworkManagerSystem.h
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGeneric.c
src/backends/NetworkManagerGeneric.h
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- Remove nm_system_set_hostname(), no longer used
* src/backends/Makefile.am
src/backends/shvar.c
src/backends/shvar.h
- Remove shvar.*; no longer used
Removed:
trunk/src/backends/shvar.c
trunk/src/backends/shvar.h
Modified:
trunk/ChangeLog
trunk/src/NetworkManagerSystem.h
trunk/src/backends/Makefile.am
trunk/src/backends/NetworkManagerArch.c
trunk/src/backends/NetworkManagerDebian.c
trunk/src/backends/NetworkManagerFrugalware.c
trunk/src/backends/NetworkManagerGeneric.c
trunk/src/backends/NetworkManagerGeneric.h
trunk/src/backends/NetworkManagerGentoo.c
trunk/src/backends/NetworkManagerMandriva.c
trunk/src/backends/NetworkManagerPaldo.c
trunk/src/backends/NetworkManagerRedHat.c
trunk/src/backends/NetworkManagerSlackware.c
trunk/src/backends/NetworkManagerSuSE.c
trunk/src/nm-device.c
Modified: trunk/src/NetworkManagerSystem.h
==============================================================================
--- trunk/src/NetworkManagerSystem.h (original)
+++ trunk/src/NetworkManagerSystem.h Tue Aug 12 22:40:27 2008
@@ -62,8 +62,6 @@
gboolean nm_system_device_is_up (NMDevice *device);
gboolean nm_system_device_is_up_with_iface (const char *iface);
-void nm_system_set_hostname (NMIP4Config *config);
-
gboolean nm_system_device_set_mtu (const char *iface, guint32 mtu);
#endif
Modified: trunk/src/backends/Makefile.am
==============================================================================
--- trunk/src/backends/Makefile.am (original)
+++ trunk/src/backends/Makefile.am Tue Aug 12 22:40:27 2008
@@ -7,54 +7,46 @@
noinst_LTLIBRARIES = libnmbackend.la
-libnmbackend_la_SOURCES = NetworkManagerGeneric.c \
+libnmbackend_la_SOURCES = NetworkManagerGeneric.c \
NetworkManagerGeneric.h
libnmbackend_la_LIBADD =
if TARGET_REDHAT
-libnmbackend_la_SOURCES += NetworkManagerRedHat.c \
- shvar.c \
- shvar.h
+libnmbackend_la_SOURCES += NetworkManagerRedHat.c
endif
if TARGET_SUSE
-libnmbackend_la_SOURCES += NetworkManagerSuSE.c \
- shvar.c \
- shvar.h
+libnmbackend_la_SOURCES += NetworkManagerSuSE.c
endif
if TARGET_GENTOO
-libnmbackend_la_SOURCES += NetworkManagerGentoo.c \
- shvar.c \
- shvar.h
+libnmbackend_la_SOURCES += NetworkManagerGentoo.c
endif
if TARGET_DEBIAN
-libnmbackend_la_SOURCES += NetworkManagerDebian.c
+libnmbackend_la_SOURCES += NetworkManagerDebian.c
endif
if TARGET_SLACKWARE
-libnmbackend_la_SOURCES += NetworkManagerSlackware.c
+libnmbackend_la_SOURCES += NetworkManagerSlackware.c
endif
if TARGET_ARCH
-libnmbackend_la_SOURCES += NetworkManagerArch.c
+libnmbackend_la_SOURCES += NetworkManagerArch.c
endif
if TARGET_PALDO
-libnmbackend_la_SOURCES += NetworkManagerPaldo.c
+libnmbackend_la_SOURCES += NetworkManagerPaldo.c
endif
if TARGET_FRUGALWARE
-libnmbackend_la_SOURCES += NetworkManagerFrugalware.c
+libnmbackend_la_SOURCES += NetworkManagerFrugalware.c
libnmbackend_la_LIBADD += -lfwnetconfig -lfwutil
endif
if TARGET_MANDRIVA
-libnmbackend_la_SOURCES += NetworkManagerMandriva.c \
- shvar.c \
- shvar.h
+libnmbackend_la_SOURCES += NetworkManagerMandriva.c
endif
libnmbackend_la_LIBADD += $(DBUS_LIBS) $(GTHREAD_LIBS)
Modified: trunk/src/backends/NetworkManagerArch.c
==============================================================================
--- trunk/src/backends/NetworkManagerArch.c (original)
+++ trunk/src/backends/NetworkManagerArch.c Tue Aug 12 22:40:27 2008
@@ -36,20 +36,12 @@
#endif
#include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <signal.h>
-#include <arpa/inet.h>
-#include <glib/gprintf.h>
-#include <glib/gfileutils.h>
#include <string.h>
#include <stdlib.h>
#include "NetworkManagerGeneric.h"
#include "NetworkManagerSystem.h"
#include "NetworkManagerUtils.h"
-#include "nm-device.h"
-#include "nm-utils.h"
/*
* nm_system_enable_loopback
@@ -59,7 +51,7 @@
*/
void nm_system_enable_loopback (void)
{
- nm_system_device_set_up_down_with_iface ("lo", TRUE);
+ nm_generic_enable_loopback ();
}
/*
@@ -73,18 +65,6 @@
{
/* Check if the daemon was already running - do not start a new instance */
if (g_file_test("/var/run/daemons/nscd", G_FILE_TEST_EXISTS))
- {
nm_spawn_process ("/etc/rc.d/nscd restart");
- }
-}
-
-/*
- * nm_system_set_hostname
- *
- * set the hostname
- *
- */
-void nm_system_set_hostname (NMIP4Config *config)
-{
}
Modified: trunk/src/backends/NetworkManagerDebian.c
==============================================================================
--- trunk/src/backends/NetworkManagerDebian.c (original)
+++ trunk/src/backends/NetworkManagerDebian.c Tue Aug 12 22:40:27 2008
@@ -28,17 +28,12 @@
#endif
#include <stdio.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <arpa/inet.h>
#include <string.h>
#include <stdlib.h>
#include "NetworkManagerGeneric.h"
#include "NetworkManagerSystem.h"
#include "NetworkManagerUtils.h"
-#include "nm-device.h"
-#include "nm-utils.h"
/*
* nm_system_enable_loopback
@@ -61,15 +56,5 @@
void nm_system_update_dns (void)
{
nm_spawn_process ("/usr/sbin/invoke-rc.d nscd restart");
-
}
-/*
- * nm_system_set_hostname
- *
- * set the hostname
- *
- */
-void nm_system_set_hostname (NMIP4Config *config)
-{
-}
Modified: trunk/src/backends/NetworkManagerFrugalware.c
==============================================================================
--- trunk/src/backends/NetworkManagerFrugalware.c (original)
+++ trunk/src/backends/NetworkManagerFrugalware.c Tue Aug 12 22:40:27 2008
@@ -24,19 +24,13 @@
*/
#include <stdio.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <arpa/inet.h>
#include <string.h>
#include <stdlib.h>
#include "NetworkManagerSystem.h"
-#include "NetworkManagerUtils.h"
-#include "nm-device.h"
-#include "nm-utils.h"
-// Provided by the frugalwareutils package on Frugalware
-#include <libfwnetconfig.h>
+/* Provided by the frugalwareutils package on Frugalware */
+#include <libfwnetconfig.h>
/*
* nm_system_enable_loopback
@@ -62,12 +56,3 @@
/* I'm not running nscd */
}
-/*
- * nm_system_set_hostname
- *
- * set the hostname
- *
- */
-void nm_system_set_hostname (NMIP4Config *config)
-{
-}
Modified: trunk/src/backends/NetworkManagerGeneric.c
==============================================================================
--- trunk/src/backends/NetworkManagerGeneric.c (original)
+++ trunk/src/backends/NetworkManagerGeneric.c Tue Aug 12 22:40:27 2008
@@ -34,9 +34,8 @@
#include "NetworkManagerGeneric.h"
#include "NetworkManagerSystem.h"
#include "NetworkManagerUtils.h"
-#include "nm-device.h"
-#include "nm-utils.h"
#include "nm-netlink.h"
+#include "nm-utils.h"
/* Because of a bug in libnl, rtnl.h should be included before route.h */
#include <netlink/route/rtnl.h>
@@ -110,131 +109,3 @@
{
}
-/*
- * nm_generic_set_ip4_config_from_resolv_conf
- *
- * Add nameservers and search names from a resolv.conf format file.
- *
- */
-void nm_generic_set_ip4_config_from_resolv_conf (const char *filename, NMIP4Config *ip4_config)
-{
- char * contents = NULL;
- char ** split_contents = NULL;
- int i, len;
-
- g_return_if_fail (filename != NULL);
- g_return_if_fail (ip4_config != NULL);
-
- if (!g_file_get_contents (filename, &contents, NULL, NULL) || (contents == NULL))
- return;
-
- if (!(split_contents = g_strsplit (contents, "\n", 0)))
- goto out;
-
- len = g_strv_length (split_contents);
- for (i = 0; i < len; i++)
- {
- char *line = split_contents[i];
-
- /* Ignore comments */
- if (!line || (line[0] == ';') || (line[0] == '#'))
- continue;
-
- line = g_strstrip (line);
- if ((strncmp (line, "search", 6) == 0) && (strlen (line) > 6))
- {
- char *searches = g_strdup (line + 7);
- char **split_searches = NULL;
-
- if (!searches || !strlen (searches))
- continue;
-
- /* Allow space-separated search domains */
- if ((split_searches = g_strsplit (searches, " ", 0)))
- {
- int m, srch_len;
-
- srch_len = g_strv_length (split_searches);
- for (m = 0; m < srch_len; m++)
- {
- if (split_searches[m])
- nm_ip4_config_add_domain (ip4_config, split_searches[m]);
- }
- g_strfreev (split_searches);
- }
- else
- {
- /* Only 1 item, add the whole line */
- nm_ip4_config_add_domain (ip4_config, searches);
- }
-
- g_free (searches);
- }
- else if ((strncmp (line, "nameserver", 10) == 0) && (strlen (line) > 10))
- {
- guint32 addr = (guint32) (inet_addr (line + 11));
-
- if (addr != (guint32) -1)
- nm_ip4_config_add_nameserver (ip4_config, addr);
- }
- }
-
- g_strfreev (split_contents);
-
-out:
- g_free (contents);
-}
-
-
-/*
- * nm_generic_device_get_system_config
- *
- * Retrieve any relevant configuration info for a particular device
- * from the system network configuration information. Clear out existing
- * info before setting stuff too.
- *
- */
-void* nm_generic_device_get_system_config (NMDevice *dev)
-{
- return NULL;
-}
-
-/*
- * nm_generic_device_free_system_config
- *
- * Free stored system config data
- *
- */
-void nm_generic_device_free_system_config (NMDevice *dev, void *system_config_data)
-{
- return;
-}
-
-
-/*
- * nm_generic_device_get_disabled
- *
- * Return whether the distro-specific system config tells us to use
- * dhcp for this device.
- *
- */
-gboolean nm_generic_device_get_disabled (NMDevice *dev)
-{
- return FALSE;
-}
-
-
-NMIP4Config *nm_generic_device_new_ip4_system_config (NMDevice *dev)
-{
- return NULL;
-}
-
-/*
- * nm_generic_set_hostname
- *
- * set the hostname
- *
- */
-void nm_generic_set_hostname (NMIP4Config *config)
-{
-}
Modified: trunk/src/backends/NetworkManagerGeneric.h
==============================================================================
--- trunk/src/backends/NetworkManagerGeneric.h (original)
+++ trunk/src/backends/NetworkManagerGeneric.h Tue Aug 12 22:40:27 2008
@@ -24,32 +24,7 @@
#ifndef NETWORK_MANAGER_GENERIC_H
#define NETWORK_MANAGER_GENERIC_H
-#include <glib.h>
-#include "nm-device.h"
-#include "nm-ip4-config.h"
-#include "nm-named-manager.h"
-
-/* Prototypes for system/distribution dependent functions,
- * implemented in the backend files in backends/ directory
- */
-
-void nm_generic_enable_loopback (void);
-void nm_generic_update_dns (void);
-
-void nm_generic_set_ip4_config_from_resolv_conf (const char *filename, NMIP4Config *ip4_config);
-void * nm_generic_device_get_system_config (NMDevice *dev);
-void nm_generic_device_free_system_config (NMDevice *dev, void *system_config_data);
-NMIP4Config * nm_generic_device_new_ip4_system_config (NMDevice *dev);
-
-gboolean nm_generic_device_get_disabled (NMDevice *dev);
-
-gboolean nm_generic_device_set_from_ip4_config (NMDevice *dev);
-gboolean nm_generic_vpn_device_set_from_ip4_config (NMNamedManager *named, NMDevice *active_device, const char *iface, NMIP4Config *config, char **routes, int num_routes);
-gboolean nm_generic_vpn_device_unset_from_ip4_config (NMNamedManager *named, NMDevice *active_device, const char *iface, NMIP4Config *config);
-
-gboolean nm_generic_device_set_up_down (NMDevice *dev, gboolean up);
-gboolean nm_generic_device_set_up_down_with_iface (NMDevice *dev, const char *iface, gboolean up);
-
-void nm_generic_set_hostname (NMIP4Config *config);
+void nm_generic_enable_loopback (void);
+void nm_generic_update_dns (void);
#endif
Modified: trunk/src/backends/NetworkManagerGentoo.c
==============================================================================
--- trunk/src/backends/NetworkManagerGentoo.c (original)
+++ trunk/src/backends/NetworkManagerGentoo.c Tue Aug 12 22:40:27 2008
@@ -28,18 +28,12 @@
#endif
#include <stdio.h>
-#include <sys/types.h>
-#include <signal.h>
#include <string.h>
#include <stdlib.h>
-#include <arpa/inet.h>
#include "NetworkManagerGeneric.h"
#include "NetworkManagerSystem.h"
#include "NetworkManagerUtils.h"
-#include "nm-device.h"
-#include "nm-utils.h"
-#include "shvar.h"
/*
* nm_system_enable_loopback
@@ -71,12 +65,3 @@
#endif
}
-/*
- * nm_system_set_hostname
- *
- * set the hostname
- *
- */
-void nm_system_set_hostname (NMIP4Config *config)
-{
-}
Modified: trunk/src/backends/NetworkManagerMandriva.c
==============================================================================
--- trunk/src/backends/NetworkManagerMandriva.c (original)
+++ trunk/src/backends/NetworkManagerMandriva.c Tue Aug 12 22:40:27 2008
@@ -26,18 +26,12 @@
#endif
#include <stdio.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <arpa/inet.h>
#include <string.h>
#include <stdlib.h>
#include "NetworkManagerGeneric.h"
#include "NetworkManagerSystem.h"
#include "NetworkManagerUtils.h"
-#include "nm-device.h"
-#include "nm-utils.h"
-#include "shvar.h"
/*
* nm_system_enable_loopback
@@ -65,12 +59,3 @@
}
}
-/*
- * nm_system_set_hostname
- *
- * set the hostname
- *
- */
-void nm_system_set_hostname (NMIP4Config *config)
-{
-}
Modified: trunk/src/backends/NetworkManagerPaldo.c
==============================================================================
--- trunk/src/backends/NetworkManagerPaldo.c (original)
+++ trunk/src/backends/NetworkManagerPaldo.c Tue Aug 12 22:40:27 2008
@@ -27,17 +27,12 @@
#endif
#include <stdio.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <arpa/inet.h>
-#include <glib/gkeyfile.h>
#include <string.h>
#include <stdlib.h>
#include "NetworkManagerGeneric.h"
#include "NetworkManagerSystem.h"
#include "NetworkManagerUtils.h"
-#include "nm-device.h"
#include "nm-utils.h"
/*
@@ -64,12 +59,3 @@
nm_spawn_process ("/usr/sbin/nscd -i hosts");
}
-/*
- * nm_system_set_hostname
- *
- * set the hostname
- *
- */
-void nm_system_set_hostname (NMIP4Config *config)
-{
-}
Modified: trunk/src/backends/NetworkManagerRedHat.c
==============================================================================
--- trunk/src/backends/NetworkManagerRedHat.c (original)
+++ trunk/src/backends/NetworkManagerRedHat.c Tue Aug 12 22:40:27 2008
@@ -24,18 +24,12 @@
#endif
#include <stdio.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <arpa/inet.h>
#include <string.h>
#include <stdlib.h>
#include "NetworkManagerGeneric.h"
#include "NetworkManagerSystem.h"
#include "NetworkManagerUtils.h"
-#include "nm-device.h"
-#include "nm-utils.h"
-#include "shvar.h"
/*
* nm_system_enable_loopback
@@ -63,12 +57,3 @@
}
}
-/*
- * nm_system_set_hostname
- *
- * set the hostname
- *
- */
-void nm_system_set_hostname (NMIP4Config *config)
-{
-}
Modified: trunk/src/backends/NetworkManagerSlackware.c
==============================================================================
--- trunk/src/backends/NetworkManagerSlackware.c (original)
+++ trunk/src/backends/NetworkManagerSlackware.c Tue Aug 12 22:40:27 2008
@@ -25,16 +25,11 @@
#endif
#include <stdio.h>
-#include <sys/types.h>
-#include <signal.h>
#include <string.h>
#include <stdlib.h>
#include "NetworkManagerGeneric.h"
#include "NetworkManagerSystem.h"
-#include "NetworkManagerUtils.h"
-#include "nm-device.h"
-#include "nm-utils.h"
/*
* nm_system_enable_loopback
@@ -60,12 +55,3 @@
/* I'm not running nscd */
}
-/*
- * nm_system_set_hostname
- *
- * set the hostname
- *
- */
-void nm_system_set_hostname (NMIP4Config *config)
-{
-}
Modified: trunk/src/backends/NetworkManagerSuSE.c
==============================================================================
--- trunk/src/backends/NetworkManagerSuSE.c (original)
+++ trunk/src/backends/NetworkManagerSuSE.c Tue Aug 12 22:40:27 2008
@@ -28,23 +28,13 @@
#endif
#include <stdio.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <arpa/inet.h>
#include <string.h>
#include <stdlib.h>
-#include <unistd.h>
-#include <netdb.h>
-#include <errno.h>
#include "NetworkManagerGeneric.h"
#include "NetworkManagerSystem.h"
#include "NetworkManagerUtils.h"
-#include "nm-device.h"
-#include "NetworkManagerPolicy.h"
#include "nm-utils.h"
-#include "shvar.h"
/*
* nm_system_enable_loopback
@@ -70,64 +60,3 @@
nm_spawn_process ("/usr/sbin/nscd -i hosts");
}
-/*
- * nm_system_set_hostname
- *
- * set the hostname
- *
- */
-void nm_system_set_hostname (NMIP4Config *config)
-{
- char *filename, *h_name = NULL, *buf;
- shvarFile *file;
-
- g_return_if_fail (config != NULL);
-
- filename = g_strdup_printf (SYSCONFDIR"/sysconfig/network/dhcp");
- file = svNewFile (filename);
- if (!file)
- goto out_gfree;
-
- buf = svGetValue (file, "DHCLIENT_SET_HOSTNAME");
- if (!buf)
- goto out_close;
-
- if (!strcmp (buf, "yes"))
- {
- const char *hostname;
-
- hostname = nm_ip4_config_get_hostname (config);
- if (!hostname)
- {
- struct in_addr temp_addr;
- struct hostent *host;
- const NMSettingIP4Address *ip_address;
-
- /* try to get hostname via dns */
- ip_address = nm_ip4_config_get_address (config, 0);
- temp_addr.s_addr = ip_address->address;
- host = gethostbyaddr ((char *) &temp_addr, sizeof (temp_addr), AF_INET);
- if (host)
- {
- h_name = g_strdup (host->h_name);
- hostname = strtok (h_name, ".");
- }
- else
- nm_warning ("nm_system_set_hostname(): gethostbyaddr failed, h_errno = %d", h_errno);
- }
-
- if (hostname)
- {
- nm_info ("Setting hostname to '%s'", hostname);
- if (sethostname (hostname, strlen (hostname)) < 0)
- nm_warning ("Could not set hostname.");
- }
- }
-
- g_free (h_name);
- free (buf);
-out_close:
- svCloseFile (file);
-out_gfree:
- g_free (filename);
-}
Modified: trunk/src/nm-device.c
==============================================================================
--- trunk/src/nm-device.c (original)
+++ trunk/src/nm-device.c Tue Aug 12 22:40:27 2008
@@ -1754,10 +1754,8 @@
priv->ip4_config = g_object_ref (config);
success = nm_system_device_set_from_ip4_config (ip_iface, config);
- if (success) {
+ if (success)
nm_device_update_ip4_address (self);
- nm_system_set_hostname (config);
- }
g_object_notify (G_OBJECT (self), NM_DEVICE_INTERFACE_IP4_CONFIG);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]