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:
17
ChangeLog
17
ChangeLog
@@ -1,3 +1,20 @@
|
||||
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
|
||||
|
||||
2005-02-10 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* src/NetworkManager.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);
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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
|
||||
*
|
||||
|
@@ -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
|
||||
*
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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
|
||||
*
|
||||
|
Reference in New Issue
Block a user