2004-12-22 Dan Williams <dcbw@redhat.com>

* src/NetworkManagerDevice.c
                - Silently fail when setting bitrate doesn't work


        Patch from j@bootlab.org:
        * src/backends/NetworkManagerDebian
                - Update backend to match functionality in RedHat backend


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@355 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2004-12-22 18:42:37 +00:00
parent 0585e980a0
commit 5367649e73
3 changed files with 143 additions and 118 deletions

View File

@@ -1,3 +1,13 @@
2004-12-22 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerDevice.c
- Silently fail when setting bitrate doesn't work
Patch from j@bootlab.org:
* src/backends/NetworkManagerDebian
- Update backend to match functionality in RedHat backend
2004-12-21 Colin Walters <walters@verbum.org> 2004-12-21 Colin Walters <walters@verbum.org>
* panel-applet/NMWirelessAppletDbus.c (nmwa_dbus_update_devices): Correctly * panel-applet/NMWirelessAppletDbus.c (nmwa_dbus_update_devices): Correctly

View File

@@ -847,12 +847,12 @@ void nm_device_set_bitrate (NMDevice *dev, const int KHz)
} }
else else
{ {
/* Auto bitrate */
wrq.u.bitrate.value = -1; wrq.u.bitrate.value = -1;
wrq.u.bitrate.fixed = 0; wrq.u.bitrate.fixed = 0;
} }
err = iw_set_ext (sk, nm_device_get_iface (dev), SIOCSIWRATE, &wrq); /* Silently fail, not all drivers support this yet (ipw2x00 for example) */
if (err == -1) iw_set_ext (sk, nm_device_get_iface (dev), SIOCSIWRATE, &wrq);
syslog (LOG_ERR, "nm_device_set_bitrate(): error setting bitrate %d KHz for device %s. errno = %d", KHz, nm_device_get_iface (dev), errno);
close (sk); close (sk);
} }

View File

@@ -56,9 +56,9 @@ void nm_system_init (void)
*/ */
gboolean nm_system_device_run_dhcp (NMDevice *dev) gboolean nm_system_device_run_dhcp (NMDevice *dev)
{ {
char *buf; char *buf;
const char *iface; const char *iface;
int err; int err;
g_return_val_if_fail (dev != NULL, FALSE); g_return_val_if_fail (dev != NULL, FALSE);
@@ -100,8 +100,7 @@ void nm_system_device_stop_dhcp (NMDevice *dev)
return; return;
/* Find and kill the previous dhclient process for this device */ /* Find and kill the previous dhclient process for this device */
buf = g_strdup_printf ("/var/run/dhclient-%s.pid", buf = g_strdup_printf ("/var/run/dhclient-%s.pid", nm_device_get_iface (dev));
nm_device_get_iface (dev));
pidfile = fopen (buf, "r"); pidfile = fopen (buf, "r");
if (pidfile) if (pidfile)
{ {
@@ -118,7 +117,7 @@ void nm_system_device_stop_dhcp (NMDevice *dev)
if (n_pid > 0) if (n_pid > 0)
kill (n_pid, SIGTERM); kill (n_pid, SIGTERM);
} }
g_free (buf); g_free (buf);
} }
@@ -139,10 +138,32 @@ void nm_system_device_flush_routes (NMDevice *dev)
return; return;
/* Remove routing table entries */ /* Remove routing table entries */
buf = g_strdup_printf ("/sbin/ip route flush dev %s", buf = g_strdup_printf ("/sbin/ip route flush dev %s", nm_device_get_iface (dev));
nm_device_get_iface (dev));
nm_spawn_process (buf); nm_spawn_process (buf);
g_free (buf); g_free (buf);
}
/*
* nm_system_device_add_default_route_via_device
*
* Add default route to the given device
*
*/
void nm_system_device_add_default_route_via_device (NMDevice *dev)
{
char *buf;
g_return_if_fail (dev != NULL);
/* Not really applicable for test devices */
if (nm_device_is_test_device (dev))
return;
/* Add default gateway */
buf = g_strdup_printf ("/sbin/ip route add default dev %s", nm_device_get_iface (dev));
nm_spawn_process (buf);
g_free (buf);
} }
@@ -280,6 +301,106 @@ error:
} }
/*
* nm_system_enable_loopback
*
* Bring up the loopback interface
*
*/
void nm_system_enable_loopback (void)
{
nm_spawn_process ("/sbin/ifup lo");
}
/*
* nm_system_flush_loopback_routes
*
* Flush all routes associated with the loopback device, because it
* sometimes gets the first route for ZeroConf/Link-Local traffic.
*
*/
void nm_system_flush_loopback_routes (void)
{
nm_spawn_process ("/sbin/ip route flush dev lo");
}
/*
* nm_system_delete_default_route
*
* Remove the old default route in preparation for a new one
*
*/
void nm_system_delete_default_route (void)
{
nm_spawn_process ("/sbin/ip route del default");
}
/*
* nm_system_flush_arp_cache
*
* Flush all entries in the arp cache.
*
*/
void nm_system_flush_arp_cache (void)
{
nm_spawn_process ("/sbin/ip neigh flush all");
}
/*
* nm_system_kill_all_dhcp_daemons
*
* Kill all DHCP daemons currently running, done at startup.
*
*/
void nm_system_kill_all_dhcp_daemons (void)
{
nm_spawn_process ("/usr/bin/killall -q dhclient");
}
/*
* nm_system_update_dns
*
* Make glibc/nscd aware of any changes to the resolv.conf file by
* restarting nscd.
*
*/
void nm_system_update_dns (void)
{
nm_spawn_process ("/usr/sbin/invoke-rc.d nscd restart");
}
/*
* nm_system_load_device_modules
*
* This is a null op - all our drivers should already be loaded.
*
*/
void nm_system_load_device_modules (void)
{
return;
}
/*
* nm_system_restart_mdns_responder
*
* Restart the multicast DNS responder so that it knows about new
* network interfaces and IP addresses.
*
*/
void nm_system_restart_mdns_responder (void)
{
nm_spawn_process ("/usr/bin/killall -q -USR1 mDNSResponder");
}
/* /*
* nm_system_device_update_config_info * nm_system_device_update_config_info
* *
@@ -381,109 +502,3 @@ void nm_system_device_update_config_info (NMDevice *dev)
out: out:
ifparser_destroy(); ifparser_destroy();
} }
/*
* nm_system_enable_loopback
*
* Bring up the loopback interface
*
*/
void nm_system_enable_loopback (void)
{
nm_spawn_process ("/sbin/ifup lo");
}
/*
* nm_system_delete_default_route
*
* Remove the old default route in preparation for a new one
*
*/
void nm_system_delete_default_route (void)
{
nm_spawn_process ("/sbin/ip route del default");
}
/*
* nm_system_kill_all_dhcp_daemons
*
* Kill all DHCP daemons currently running, done at startup.
*
*/
void nm_system_kill_all_dhcp_daemons (void)
{
nm_spawn_process ("/usr/bin/killall -q dhclient");
}
/*
* nm_system_update_dns
*
* Make glibc/nscd aware of any changes to the resolv.conf file by
* restarting nscd.
*
*/
void nm_system_update_dns (void)
{
nm_spawn_process ("/usr/sbin/invoke-rc.d nscd restart");
}
/*
* nm_system_load_device_modules
*
* This is a null op - all our drivers should already be loaded.
*
*/
void nm_system_load_device_modules (void)
{
return;
}
/*
* nm_system_restart_mdns_responder
*
* Restart the multicast DNS responder so that it knows about new
* network interfaces and IP addresses.
*
*/
void nm_system_restart_mdns_responder (void)
{
}
/*
* nm_system_device_add_default_route_via_device
*
* Flush all routes associated with a network device
*
*/
void nm_system_device_add_default_route_via_device (NMDevice *dev)
{
}
/*
* nm_system_flush_loopback_routes
*
* Flush all routes associated with the loopback device, because it
* sometimes gets the first route for ZeroConf/Link-Local traffic.
*
*/
void nm_system_flush_loopback_routes (void)
{
}
/*
* nm_system_flush_arp_cache
*
* Flush all entries in the arp cache.
*
*/
void nm_system_flush_arp_cache (void)
{
}