mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-21 19:10:45 +01:00
2006-01-13 Dan Williams <dcbw@redhat.com>
* src/nm-device.c src/nm-device.h - Allow subclasses to implement deactivate_quickly() - (nm_device_deactivate_quickly): call subclass deactivate_quickly() methods - (nm_device_set_active_link): small cleanups, and don't deactivate the device right away because we risk a deadlock when called from device thread, waiting for the device thread to cancel activation * src/nm-device-802-11-wireless.c - (real_deactivate_quickly): new function - (nm_device_802_11_wireless_class_init): hook in real_deactivate_quickly - (real_deactivate): move supplicant cleanup to real_deactivate_quickly so that we kill the supplicant when we sleep too - (supplicant_interface_init): work around naive naming attempts of wpa_ctrl when naming sockets git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1326 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
42d050e807
commit
8b1b8ee7a5
4 changed files with 53 additions and 12 deletions
20
ChangeLog
20
ChangeLog
|
|
@ -1,3 +1,23 @@
|
|||
2006-01-13 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* src/nm-device.c
|
||||
src/nm-device.h
|
||||
- Allow subclasses to implement deactivate_quickly()
|
||||
- (nm_device_deactivate_quickly): call subclass
|
||||
deactivate_quickly() methods
|
||||
- (nm_device_set_active_link): small cleanups, and don't
|
||||
deactivate the device right away because we risk a deadlock
|
||||
when called from device thread, waiting for the device
|
||||
thread to cancel activation
|
||||
|
||||
* src/nm-device-802-11-wireless.c
|
||||
- (real_deactivate_quickly): new function
|
||||
- (nm_device_802_11_wireless_class_init): hook in real_deactivate_quickly
|
||||
- (real_deactivate): move supplicant cleanup to real_deactivate_quickly
|
||||
so that we kill the supplicant when we sleep too
|
||||
- (supplicant_interface_init): work around naive naming attempts of
|
||||
wpa_ctrl when naming sockets
|
||||
|
||||
2006-01-13 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* src/nm-device-802-11-wireless.c
|
||||
|
|
|
|||
|
|
@ -351,6 +351,16 @@ real_start (NMDevice *dev)
|
|||
g_source_unref (source);
|
||||
}
|
||||
|
||||
static void
|
||||
real_deactivate_quickly (NMDevice *dev)
|
||||
{
|
||||
NMDevice80211Wireless * self = NM_DEVICE_802_11_WIRELESS (dev);
|
||||
|
||||
supplicant_cleanup (self);
|
||||
remove_link_timeout (self);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
real_deactivate (NMDevice *dev)
|
||||
{
|
||||
|
|
@ -360,9 +370,6 @@ real_deactivate (NMDevice *dev)
|
|||
app_data = nm_device_get_app_data (dev);
|
||||
g_assert (app_data);
|
||||
|
||||
supplicant_cleanup (self);
|
||||
remove_link_timeout (self);
|
||||
|
||||
/* Clean up stuff, don't leave the card associated */
|
||||
nm_device_802_11_wireless_set_essid (self, "");
|
||||
nm_device_802_11_wireless_set_wep_enc_key (self, NULL, 0);
|
||||
|
|
@ -2437,6 +2444,7 @@ supplicant_interface_init (NMDevice80211Wireless *self)
|
|||
char * socket_path;
|
||||
const char * iface = nm_device_get_iface (NM_DEVICE (self));
|
||||
gboolean success = FALSE;
|
||||
int tries = 0;
|
||||
|
||||
if (!(ctrl = wpa_ctrl_open (WPA_SUPPLICANT_GLOBAL_SOCKET)))
|
||||
goto exit;
|
||||
|
|
@ -2445,13 +2453,21 @@ supplicant_interface_init (NMDevice80211Wireless *self)
|
|||
if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL,
|
||||
"INTERFACE_ADD %s\t\twext\t" WPA_SUPPLICANT_CONTROL_SOCKET "\t", iface))
|
||||
goto exit;
|
||||
|
||||
wpa_ctrl_close (ctrl);
|
||||
|
||||
/* attach to interface socket */
|
||||
/* Get a control socket to wpa_supplicant for this interface.
|
||||
* Try a couple times to work around naive socket naming
|
||||
* in wpa_ctrl that sometimes collides with stale ones.
|
||||
*/
|
||||
socket_path = supplicant_get_device_socket_path (self);
|
||||
self->priv->sup_ctrl = wpa_ctrl_open (socket_path);
|
||||
while (!self->priv->sup_ctrl && (tries++ < 10))
|
||||
self->priv->sup_ctrl = wpa_ctrl_open (socket_path);
|
||||
g_free (socket_path);
|
||||
if (!self->priv->sup_ctrl)
|
||||
{
|
||||
nm_info ("Error opening control interface to supplicant.");
|
||||
goto exit;
|
||||
}
|
||||
success = TRUE;
|
||||
|
||||
exit:
|
||||
|
|
@ -2872,6 +2888,7 @@ nm_device_802_11_wireless_class_init (NMDevice80211WirelessClass *klass)
|
|||
parent_class->act_stage4_get_ip4_config = real_act_stage4_get_ip4_config;
|
||||
parent_class->act_stage4_ip_config_timeout = real_act_stage4_ip_config_timeout;
|
||||
parent_class->deactivate = real_deactivate;
|
||||
parent_class->deactivate_quickly = real_deactivate_quickly;
|
||||
|
||||
parent_class->activation_failure_handler = real_activation_failure_handler;
|
||||
parent_class->activation_success_handler = real_activation_success_handler;
|
||||
|
|
|
|||
|
|
@ -543,24 +543,23 @@ void
|
|||
nm_device_set_active_link (NMDevice *self,
|
||||
const gboolean link_active)
|
||||
{
|
||||
NMData * app_data;
|
||||
NMData * app_data;
|
||||
NMActRequest * req;
|
||||
|
||||
g_return_if_fail (self != NULL);
|
||||
g_return_if_fail (self->priv->app_data != NULL);
|
||||
|
||||
app_data = self->priv->app_data;
|
||||
req = nm_device_get_act_request (self);
|
||||
|
||||
if (self->priv->link_active != link_active)
|
||||
{
|
||||
self->priv->link_active = link_active;
|
||||
|
||||
/* Deactivate a currently active device */
|
||||
if (!link_active && self->priv->act_request)
|
||||
{
|
||||
nm_device_deactivate (self);
|
||||
if (!link_active && req)
|
||||
nm_policy_schedule_device_change_check (app_data);
|
||||
}
|
||||
else if (link_active && !self->priv->act_request)
|
||||
else if (link_active && !req)
|
||||
{
|
||||
NMDevice * act_dev = nm_get_active_device (app_data);
|
||||
NMActRequest * act_dev_req = act_dev ? nm_device_get_act_request (act_dev) : NULL;
|
||||
|
|
@ -1441,6 +1440,10 @@ nm_device_deactivate_quickly (NMDevice *self)
|
|||
self->priv->act_request = NULL;
|
||||
}
|
||||
|
||||
/* Call device type-specific deactivation */
|
||||
if (NM_DEVICE_GET_CLASS (self)->deactivate_quickly)
|
||||
NM_DEVICE_GET_CLASS (self)->deactivate_quickly (self);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ struct _NMDeviceClass
|
|||
struct NMActRequest *req,
|
||||
NMIP4Config **config);
|
||||
void (* deactivate) (NMDevice *self);
|
||||
void (* deactivate_quickly) (NMDevice *self);
|
||||
void (* cancel_activation) (NMDevice *self);
|
||||
|
||||
void (* activation_failure_handler) (NMDevice *self,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue