From 642a1a181dbf3e532c3a1fc88cef25d88f48ed98 Mon Sep 17 00:00:00 2001 From: Tor Krill Date: Tue, 4 Jul 2006 19:22:49 +0000 Subject: [PATCH] Applied two patches from Valentine Sinitsyn - Explicitly check for DHCP configuration - Check if daemons are running before starting them git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1861 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 9 +++++++++ src/backends/NetworkManagerArch.c | 32 ++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 370aa27ae..1b688f96a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-07-04 Tor Krill + + Patch from Valentine Sinitsyn + * src/backends/NetworkManagerArch.c: (nm_system_update_dns), + (nm_system_restart_mdns_responder), (ArchReadConfig), + (nm_system_device_get_system_config): + - Explicitly check for DHCP configuration + - Check if daemons are running before starting them + 2006-06-25 Dan Williams * libnm-util/dbus-dict-helpers.[ch] diff --git a/src/backends/NetworkManagerArch.c b/src/backends/NetworkManagerArch.c index 13aa94fdd..388c78845 100644 --- a/src/backends/NetworkManagerArch.c +++ b/src/backends/NetworkManagerArch.c @@ -5,6 +5,8 @@ * Tor Krill and Will Rea * * Updated by Wael Nasreddine + * + * Updated by Valentine Sinitsyn * * Heavily based on NetworkManagerDebian.c by Matthew Garrett * @@ -35,6 +37,7 @@ #include #include #include +#include #include "NetworkManagerSystem.h" #include "NetworkManagerUtils.h" #include "nm-device.h" @@ -364,8 +367,11 @@ void nm_system_kill_all_dhcp_daemons (void) */ void nm_system_update_dns (void) { - nm_spawn_process ("/etc/rc.d/nscd restart"); - + /* 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"); + } } @@ -378,7 +384,11 @@ void nm_system_update_dns (void) */ void nm_system_restart_mdns_responder (void) { - nm_spawn_process ("/etc/rc.d/avahi-daemon restart"); + /* Check if the daemon was already running - do not start a new instance */ + if (g_file_test("/var/run/daemons/avahi-daemon", G_FILE_TEST_EXISTS)) + { + nm_spawn_process ("/etc/rc.d/avahi-daemon restart"); + } } @@ -581,6 +591,14 @@ static GHashTable * ArchReadConfig(const char* file, const char* dev) } } + else + { + /* This interface is probably using DHCP - check this */ + if (!g_ascii_strcasecmp(splt[0],"dhcp")) + { + g_hash_table_insert(ifs,g_strdup("dhcp"),g_strdup("true")); + } + } } } @@ -666,10 +684,10 @@ void* nm_system_device_get_system_config (NMDevice * dev, NMData *app_data) g_free(sys_data); return NULL; } - - if ((val=g_hash_table_lookup(ifh,nm_device_get_iface(dev)))) + val=g_hash_table_lookup(ifh,nm_device_get_iface(dev)); + if (val && !g_hash_table_lookup(ifh, "dhcp")) { - // We found an IP-nr and thus have a static configuration + /* This device does not use DHCP */ sys_data->use_dhcp=FALSE; sys_data->config = nm_ip4_config_new(); @@ -707,7 +725,7 @@ void* nm_system_device_get_system_config (NMDevice * dev, NMData *app_data) } set_ip4_config_from_resolv_conf (SYSCONFDIR"/resolv.conf", sys_data->config); -#if 1 +#if 0 { int j; nm_debug ("------ Config (%s)", nm_device_get_iface (dev));