2005-02-10 Dan Williams <dcbw@redhat.com>
* 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
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
Reference in New Issue
Block a user