From 02bcf5aa14c6c5c02569d1744c9d2bb286a2a78d Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 10 Feb 2005 16:14:19 +0000 Subject: [PATCH] 2005-02-10 Dan Williams * dhcpcd/client.c - #rh147661# Don't send kernel version in DHCP requests * src/NetworkManagerSystem.h src/backends/NetworkManagerDebian.c src/backends/NetworkManagerGentoo.c src/backends/NetworkManagerRedHat.c src/backends/NetworkManagerSlackware.c - Remove the nm_system_device_run_dhcp() and nm_system_device_stop_dhcp() functions, they are no longer used anyway * src/backends/NetworkManagerRedHat.c - (nm_system_device_flush_addresses): only flush "scope global" and "scope site" addresses in an attempt to keep IPv6 local-scope addresses around git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@428 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 17 ++++++ dhcpcd/client.c | 5 +- src/NetworkManagerSystem.h | 2 - src/backends/NetworkManagerDebian.c | 76 ----------------------- src/backends/NetworkManagerGentoo.c | 68 --------------------- src/backends/NetworkManagerRedHat.c | 83 ++------------------------ src/backends/NetworkManagerSlackware.c | 70 ---------------------- 7 files changed, 24 insertions(+), 297 deletions(-) diff --git a/ChangeLog b/ChangeLog index a01f91c147..bf74d8d9bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2005-02-10 Dan Williams + + * dhcpcd/client.c + - #rh147661# Don't send kernel version in DHCP requests + + * src/NetworkManagerSystem.h + src/backends/NetworkManagerDebian.c + src/backends/NetworkManagerGentoo.c + src/backends/NetworkManagerRedHat.c + src/backends/NetworkManagerSlackware.c + - Remove the nm_system_device_run_dhcp() and nm_system_device_stop_dhcp() + functions, they are no longer used anyway + + * src/backends/NetworkManagerRedHat.c + - (nm_system_device_flush_addresses): only flush "scope global" and "scope site" + addresses in an attempt to keep IPv6 local-scope addresses around + 2005-02-10 Dan Williams * src/NetworkManager.c diff --git a/dhcpcd/client.c b/dhcpcd/client.c index 17a9333e50..98d28a43cf 100644 --- a/dhcpcd/client.c +++ b/dhcpcd/client.c @@ -300,9 +300,8 @@ void class_id_setup (dhcp_interface *iface, const char *g_cls_id) { struct utsname sname; if ( uname(&sname) ) - syslog (LOG_ERR,"classIDsetup: uname: %m\n"); - snprintf (iface->cls_id, DHCP_CLASS_ID_MAX_LEN, "%s %s %s", - sname.sysname, sname.release, sname.machine); + syslog (LOG_ERR,"class_id_setup(): uname returned an error: %m\n"); + snprintf (iface->cls_id, DHCP_CLASS_ID_MAX_LEN, "%s", sname.sysname); iface->cls_id_len = strlen (iface->cls_id); } } diff --git a/src/NetworkManagerSystem.h b/src/NetworkManagerSystem.h index c99748083d..901fbd87d3 100644 --- a/src/NetworkManagerSystem.h +++ b/src/NetworkManagerSystem.h @@ -31,8 +31,6 @@ */ void nm_system_init (void); -gboolean nm_system_device_run_dhcp (NMDevice *dev); -void nm_system_device_stop_dhcp (NMDevice *dev); gboolean nm_system_device_has_active_routes (NMDevice *dev); void nm_system_device_flush_routes (NMDevice *dev); void nm_system_device_add_default_route_via_device(NMDevice *dev); diff --git a/src/backends/NetworkManagerDebian.c b/src/backends/NetworkManagerDebian.c index 37fb9fe80b..2b763ba844 100644 --- a/src/backends/NetworkManagerDebian.c +++ b/src/backends/NetworkManagerDebian.c @@ -45,82 +45,6 @@ void nm_system_init (void) } -/* - * nm_system_device_run_dhcp - * - * Run the dhcp daemon for a particular interface. - * - * Returns: TRUE on success - * FALSE on dhcp error - * - */ -gboolean nm_system_device_run_dhcp (NMDevice *dev) -{ - char *buf; - const char *iface; - int err; - - g_return_val_if_fail (dev != NULL, FALSE); - - /* Fake it for a test device */ - if (nm_device_is_test_device (dev)) - { - g_usleep (2000); - return (TRUE); - } - - /* Unfortunately, dhclient can take a long time to get a dhcp address - * (for example, bad WEP key so it can't actually talk to the AP). - */ - iface = nm_device_get_iface (dev); - buf = g_strdup_printf ("/sbin/dhclient -q -lf /var/lib/dhcp/dhclient-%s.leases -pf /var/run/dhclient-%s.pid -cf /etc/dhclient-%s.conf %s\n", iface, iface, iface, iface); - err = nm_spawn_process (buf); - g_free (buf); - return (err == 0); -} - - -/* - * nm_system_device_stop_dhcp - * - * Kill any dhcp daemon that happens to be around. We may be changing - * interfaces and we're going to bring the previous one down, so there's - * no sense in keeping the dhcp daemon running on the old interface. - * - */ -void nm_system_device_stop_dhcp (NMDevice *dev) -{ - FILE *pidfile; - char *buf; - - g_return_if_fail (dev != NULL); - - /* Not really applicable for test devices */ - if (nm_device_is_test_device (dev)) - return; - - /* Find and kill the previous dhclient process for this device */ - buf = g_strdup_printf ("/var/run/dhclient-%s.pid", nm_device_get_iface (dev)); - pidfile = fopen (buf, "r"); - if (pidfile) - { - int len; - unsigned char s_pid[20]; - pid_t n_pid = -1; - - memset (s_pid, 0, 20); - fgets (s_pid, 19, pidfile); - len = strlen (s_pid); - fclose (pidfile); - - n_pid = atoi (s_pid); - if (n_pid > 0) - kill (n_pid, SIGTERM); - } - g_free (buf); -} - - /* * nm_system_device_flush_routes * diff --git a/src/backends/NetworkManagerGentoo.c b/src/backends/NetworkManagerGentoo.c index 4e7db78056..6eafa1061a 100644 --- a/src/backends/NetworkManagerGentoo.c +++ b/src/backends/NetworkManagerGentoo.c @@ -49,74 +49,6 @@ void nm_system_init (void) */ } -/* - * nm_system_device_run_dhcp - * - * Run the dhcp daemon for a particular interface. - * - * Returns: TRUE on success - * FALSE on dhcp error - * - */ -gboolean nm_system_device_run_dhcp (NMDevice *dev) -{ - char buf [500]; - const char *iface; - int err; - - g_return_val_if_fail (dev != NULL, FALSE); - - /* Fake it for a test device */ - if (nm_device_is_test_device (dev)) - { - g_usleep (2000); - return (TRUE); - } - - iface = nm_device_get_iface (dev); - snprintf (buf, 500, "/sbin/dhcpcd %s", iface); - err = nm_spawn_process (buf); - return (err == 0); -} - -/* - * nm_system_device_stop_dhcp - * - * Kill any dhcp daemon that happens to be around. We may be changing - * interfaces and we're going to bring the previous one down, so there's - * no sense in keeping the dhcp daemon running on the old interface. - * - */ -void nm_system_device_stop_dhcp (NMDevice *dev) -{ - FILE *pidfile; - char buf [500]; - - g_return_if_fail (dev != NULL); - - /* Not really applicable for test devices */ - if (nm_device_is_test_device (dev)) - return; - - snprintf (buf, 500, "/var/run/dhcpcd-%s.pid", nm_device_get_iface(dev)); - pidfile = fopen (buf, "r"); - if (pidfile) - { - int len; - unsigned char s_pid[20]; - pid_t n_pid = -1; - - memset (s_pid, 0, 20); - fgets (s_pid, 19, pidfile); - len = strnlen (s_pid, 20); - fclose (pidfile); - - n_pid = atoi (s_pid); - if (n_pid > 0) - kill (n_pid, SIGTERM); - } -} - /* * nm_system_device_flush_routes * diff --git a/src/backends/NetworkManagerRedHat.c b/src/backends/NetworkManagerRedHat.c index 8c0a3421a4..a4c6f0a31e 100644 --- a/src/backends/NetworkManagerRedHat.c +++ b/src/backends/NetworkManagerRedHat.c @@ -39,82 +39,6 @@ void nm_system_init (void) } -/* - * nm_system_device_run_dhcp - * - * Run the dhcp daemon for a particular interface. - * - * Returns: TRUE on success - * FALSE on dhcp error - * - */ -gboolean nm_system_device_run_dhcp (NMDevice *dev) -{ - char *buf; - const char *iface; - int err; - - g_return_val_if_fail (dev != NULL, FALSE); - - /* Fake it for a test device */ - if (nm_device_is_test_device (dev)) - { - g_usleep (2000); - return (TRUE); - } - - /* Unfortunately, dhclient can take a long time to get a dhcp address - * (for example, bad WEP key so it can't actually talk to the AP). - */ - iface = nm_device_get_iface (dev); - buf = g_strdup_printf ("/sbin/dhclient -1 -q -lf /var/lib/dhcp/dhclient-%s.leases -pf /var/run/dhclient-%s.pid -cf /etc/dhclient-%s.conf %s\n", iface, iface, iface, iface); - err = nm_spawn_process (buf); - g_free (buf); - return (err == 0); -} - - -/* - * nm_system_device_stop_dhcp - * - * Kill any dhcp daemon that happens to be around. We may be changing - * interfaces and we're going to bring the previous one down, so there's - * no sense in keeping the dhcp daemon running on the old interface. - * - */ -void nm_system_device_stop_dhcp (NMDevice *dev) -{ - FILE *pidfile; - char *buf; - - g_return_if_fail (dev != NULL); - - /* Not really applicable for test devices */ - if (nm_device_is_test_device (dev)) - return; - - /* Find and kill the previous dhclient process for this device */ - buf = g_strdup_printf ("/var/run/dhclient-%s.pid", nm_device_get_iface (dev)); - pidfile = fopen (buf, "r"); - if (pidfile) - { - int len; - unsigned char s_pid[20]; - pid_t n_pid = -1; - - memset (s_pid, 0, 20); - fgets (s_pid, 20, pidfile); - len = strlen (s_pid); - fclose (pidfile); - - n_pid = atoi (s_pid); - if (n_pid > 0) - kill (n_pid, SIGKILL); - } - g_free (buf); -} - - /* * nm_system_device_flush_routes * @@ -190,8 +114,11 @@ void nm_system_device_flush_addresses (NMDevice *dev) if (nm_device_is_test_device (dev)) return; - /* Remove all IP addresses for a device */ - buf = g_strdup_printf ("/sbin/ip address flush dev %s", nm_device_get_iface (dev)); + /* Remove all IP addresses for a device, but leave IPv6 local-scope addresses */ + buf = g_strdup_printf ("/sbin/ip address flush dev %s scope global", nm_device_get_iface (dev)); + nm_spawn_process (buf); + g_free (buf); + buf = g_strdup_printf ("/sbin/ip address flush dev %s scope site", nm_device_get_iface (dev)); nm_spawn_process (buf); g_free (buf); } diff --git a/src/backends/NetworkManagerSlackware.c b/src/backends/NetworkManagerSlackware.c index d30d8a53e6..79d06acc54 100644 --- a/src/backends/NetworkManagerSlackware.c +++ b/src/backends/NetworkManagerSlackware.c @@ -41,76 +41,6 @@ void nm_system_init (void) { } -/* - * nm_system_device_run_dhcp - * - * Run the dhcp daemon for a particular interface. - * - * Returns: TRUE on success - * FALSE on dhcp error - * - */ -gboolean nm_system_device_run_dhcp (NMDevice *dev) -{ - char buf [500]; - int err; - - g_return_val_if_fail (dev != NULL, FALSE); - - /* Fake it for a test device */ - if (nm_device_is_test_device (dev)) - { - g_usleep (2000); - return (TRUE); - } - - snprintf (buf, 500, "/sbin/dhcpcd %s", nm_device_get_iface(dev)); - err = nm_spawn_process (buf); - return (err == 0); -} - - - -/* - * nm_system_device_stop_dhcp - * - * Kill any dhcp daemon that happens to be around. We may be changing - * interfaces and we're going to bring the previous one down, so there's - * no sense in keeping the dhcp daemon running on the old interface. - * - */ -void nm_system_device_stop_dhcp (NMDevice *dev) -{ - FILE *pidfile; - char buf [500]; - - g_return_if_fail (dev != NULL); - - /* Not really applicable for test devices */ - if (nm_device_is_test_device (dev)) - return; - - /* Find and kill the previous dhclient process for this device */ - snprintf (buf, 500, "/etc/dhcpc/dhcpcd-%s.pid", nm_device_get_iface (dev)); - pidfile = fopen (buf, "r"); - if (pidfile) - { - int len; - unsigned char s_pid[20]; - pid_t n_pid = -1; - - memset (s_pid, 0, 20); - fgets (s_pid, 20, pidfile); - len = strlen (s_pid); - fclose (pidfile); - - n_pid = atoi (s_pid); - if (n_pid > 0) - kill (n_pid, SIGTERM); - } -} - - /* * nm_system_device_flush_routes *