diff options
| author | Michael Biebl <biebl@debian.org> | 2013-02-20 23:06:45 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2013-02-20 23:06:45 +0100 |
| commit | 8d275584fc94f398f0a7c990dcd057533d9a5856 (patch) | |
| tree | 1bf4a928e201222a008e6776799d174ee3223be3 /src/nm-device-wifi.c | |
| parent | e17c5736fc3722ce51cb33f3edb203960125a4c1 (diff) | |
Imported Upstream version 0.9.8.0 upstream/0.9.8.0
Diffstat (limited to 'src/nm-device-wifi.c')
| -rw-r--r-- | src/nm-device-wifi.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/nm-device-wifi.c b/src/nm-device-wifi.c index 67a10d43..abbf7c44 100644 --- a/src/nm-device-wifi.c +++ b/src/nm-device-wifi.c @@ -1016,6 +1016,7 @@ check_connection_compatible (NMDevice *device, NMSettingWireless *s_wireless; const GByteArray *mac; const GSList *mac_blacklist, *mac_blacklist_iter; + const char *mode; s_con = nm_connection_get_setting_connection (connection); g_assert (s_con); @@ -1071,8 +1072,17 @@ check_connection_compatible (NMDevice *device, return FALSE; } - /* Early exit if supplicant or device don't support AP mode */ - if (g_strcmp0 (nm_setting_wireless_get_mode (s_wireless), NM_SETTING_WIRELESS_MODE_AP) == 0) { + /* Early exit if supplicant or device doesn't support requested mode */ + mode = nm_setting_wireless_get_mode (s_wireless); + if (g_strcmp0 (mode, NM_SETTING_WIRELESS_MODE_ADHOC) == 0) { + if (!(priv->capabilities & NM_WIFI_DEVICE_CAP_ADHOC)) { + g_set_error_literal (error, + NM_WIFI_ERROR, + NM_WIFI_ERROR_ADHOC_MODE_UNSUPPORTED, + "Ad-Hoc mode is not supported by this device."); + return FALSE; + } + } else if (g_strcmp0 (mode, NM_SETTING_WIRELESS_MODE_AP) == 0) { if (!(priv->capabilities & NM_WIFI_DEVICE_CAP_AP)) { g_set_error_literal (error, NM_WIFI_ERROR, @@ -2448,7 +2458,15 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface, break; case NM_SUPPLICANT_INTERFACE_STATE_DOWN: cleanup_association_attempt (self, FALSE); + + /* If the device is already in UNAVAILABLE state then the state change + * is a NOP and the interface won't be re-acquired in the device state + * change handler. So ensure we have a new one here so that we're + * ready if the supplicant comes back. + */ supplicant_interface_release (self); + supplicant_interface_acquire (self); + nm_device_state_changed (device, NM_DEVICE_STATE_UNAVAILABLE, NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED); |