diff options
author | Thomas Haller <thaller@redhat.com> | 2013-12-12 11:36:06 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2013-12-12 11:37:52 +0100 |
commit | 00347f4655a677cc91930b0cc4f0b10a569ca461 (patch) | |
tree | bd62afe0da9b6c50d9315238632d18bcf585e63e | |
parent | 5f3360d2952778cc0dbf7a02c076a22be2267076 (diff) | |
parent | d0db82a19f8615fba0130020de48884912f2a97c (diff) |
core: rework AP handling in nm-device-wifi (Merge branch 'th/rh1025371_wifi_ap_rework')
This reworks and fixes the handling of current_ap in nm-device-wifi.
https://bugzilla.redhat.com/show_bug.cgi?id=1025371
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | src/devices/nm-device-wifi.c | 308 | ||||
-rw-r--r-- | src/devices/nm-device-wifi.h | 2 | ||||
-rw-r--r-- | src/nm-wifi-ap.c | 2 | ||||
-rw-r--r-- | src/supplicant-manager/nm-supplicant-config.c | 12 | ||||
-rw-r--r-- | src/supplicant-manager/nm-supplicant-config.h | 4 | ||||
-rw-r--r-- | src/supplicant-manager/tests/test-supplicant-config.c | 6 | ||||
-rw-r--r-- | src/wifi/wifi-utils-nl80211.c | 1 | ||||
-rw-r--r-- | src/wifi/wifi-utils-private.h | 1 | ||||
-rw-r--r-- | src/wifi/wifi-utils-wext.c | 1 | ||||
-rw-r--r-- | src/wifi/wifi-utils.c | 7 | ||||
-rw-r--r-- | src/wifi/wifi-utils.h | 2 |
11 files changed, 134 insertions, 212 deletions
diff --git a/src/devices/nm-device-wifi.c b/src/devices/nm-device-wifi.c index 1434485783..147caff244 100644 --- a/src/devices/nm-device-wifi.c +++ b/src/devices/nm-device-wifi.c @@ -136,3 +136,3 @@ struct _NMDeviceWifiPrivate { gboolean enabled; /* rfkilled or not */ - + time_t scheduled_scan_time; @@ -198,2 +198,4 @@ static gboolean request_wireless_scan (gpointer user_data); +static void remove_access_point (NMDeviceWifi *device, NMAccessPoint *ap); + /*****************************************************************/ @@ -445,2 +447,5 @@ get_ap_by_path (NMDeviceWifi *self, const char *path) + if (!path) + return NULL; + for (iter = priv->ap_list; iter; iter = g_slist_next (iter)) { @@ -458,3 +463,6 @@ get_ap_by_supplicant_path (NMDeviceWifi *self, const char *path) - for (iter = priv->ap_list; iter && path; iter = g_slist_next (iter)) { + if (!path) + return NULL; + + for (iter = priv->ap_list; iter; iter = g_slist_next (iter)) { if (g_strcmp0 (path, nm_ap_get_supplicant_path (NM_AP (iter->data))) == 0) @@ -466,5 +474,5 @@ get_ap_by_supplicant_path (NMDeviceWifi *self, const char *path) static NMAccessPoint * -get_active_ap (NMDeviceWifi *self, - NMAccessPoint *ignore_ap, - gboolean match_hidden) +find_active_ap (NMDeviceWifi *self, + NMAccessPoint *ignore_ap, + gboolean match_hidden) { @@ -525,3 +533,3 @@ get_active_ap (NMDeviceWifi *self, - if (ignore_ap && (ap == ignore_ap)) { + if (ap == ignore_ap) { nm_log_dbg (LOGD_WIFI, " ignored"); @@ -594,2 +602,3 @@ get_active_ap (NMDeviceWifi *self, active_ap = match_nofreq; + goto done; } @@ -611,3 +620,3 @@ update_seen_bssids_cache (NMDeviceWifi *self, NMAccessPoint *ap) g_return_if_fail (NM_IS_DEVICE_WIFI (self)); - + if (ap == NULL) @@ -630,6 +639,5 @@ update_seen_bssids_cache (NMDeviceWifi *self, NMAccessPoint *ap) static void -set_active_ap (NMDeviceWifi *self, NMAccessPoint *new_ap) +set_current_ap (NMDeviceWifi *self, NMAccessPoint *new_ap, gboolean recheck_available_connections, gboolean force_remove_old_ap) { NMDeviceWifiPrivate *priv; - char *old_path = NULL; NMAccessPoint *old_ap; @@ -641,6 +649,4 @@ set_active_ap (NMDeviceWifi *self, NMAccessPoint *new_ap) - if (old_ap) { - old_path = g_strdup (nm_ap_get_dbus_path (old_ap)); - priv->current_ap = NULL; - } + if (old_ap == new_ap) + return; @@ -658,22 +664,22 @@ set_active_ap (NMDeviceWifi *self, NMAccessPoint *new_ap) update_seen_bssids_cache (self, priv->current_ap); - } + } else + priv->current_ap = NULL; - /* Unref old AP here to ensure object lives if new_ap == old_ap */ - if (old_ap) - g_object_unref (old_ap); + if (old_ap) { + NM80211Mode mode = nm_ap_get_mode (old_ap); - /* Only notify if it's really changed */ - if ( (!old_path && new_ap) - || (old_path && !new_ap) - || (old_path && new_ap && strcmp (old_path, nm_ap_get_dbus_path (new_ap)))) - g_object_notify (G_OBJECT (self), NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT); + if (force_remove_old_ap || mode == NM_802_11_MODE_ADHOC || mode == NM_802_11_MODE_AP || nm_ap_get_fake (old_ap)) { + remove_access_point (self, old_ap); + if (recheck_available_connections) + nm_device_recheck_available_connections (NM_DEVICE (self)); + } + g_object_unref (old_ap); + } - g_free (old_path); + g_object_notify (G_OBJECT (self), NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT); } -/* Called both as a GSourceFunc and standalone */ -static gboolean -periodic_update (gpointer user_data) +static void +periodic_update (NMDeviceWifi *self, NMAccessPoint *ignore_ap) { - NMDeviceWifi *self = NM_DEVICE_WIFI (user_data); NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); @@ -690,3 +696,3 @@ periodic_update (gpointer user_data) if (state != NM_DEVICE_STATE_ACTIVATED) - return TRUE; + return; @@ -700,3 +706,3 @@ periodic_update (gpointer user_data) || nm_supplicant_interface_get_scanning (priv->supplicant.iface)) - return TRUE; + return; @@ -704,3 +710,3 @@ periodic_update (gpointer user_data) if (priv->mode == NM_802_11_MODE_AP) - return TRUE; + return; @@ -726,3 +732,3 @@ periodic_update (gpointer user_data) - new_ap = get_active_ap (self, NULL, FALSE); + new_ap = find_active_ap (self, ignore_ap, FALSE); if (new_ap) { @@ -738,3 +744,3 @@ periodic_update (gpointer user_data) - if ((new_ap || priv->current_ap) && (new_ap != priv->current_ap)) { + if (new_ap != priv->current_ap) { const struct ether_addr *new_bssid = NULL; @@ -766,3 +772,3 @@ periodic_update (gpointer user_data) - set_active_ap (self, new_ap); + set_current_ap (self, new_ap, TRUE, FALSE); } @@ -774,3 +780,8 @@ periodic_update (gpointer user_data) } +} +static gboolean +periodic_update_cb (gpointer user_data) +{ + periodic_update (NM_DEVICE_WIFI (user_data), NULL); return TRUE; @@ -789,4 +800,3 @@ static void remove_access_point (NMDeviceWifi *device, - NMAccessPoint *ap, - gboolean recheck_available_connections) + NMAccessPoint *ap) { @@ -794,8 +804,9 @@ remove_access_point (NMDeviceWifi *device, - g_signal_emit (device, signals[ACCESS_POINT_REMOVED], 0, ap); + g_return_if_fail (ap); + g_return_if_fail (ap != priv->current_ap); + g_return_if_fail (g_slist_find (priv->ap_list, ap)); + priv->ap_list = g_slist_remove (priv->ap_list, ap); + g_signal_emit (device, signals[ACCESS_POINT_REMOVED], 0, ap); g_object_unref (ap); - - if (recheck_available_connections) - nm_device_recheck_available_connections (NM_DEVICE (device)); } @@ -807,11 +818,10 @@ remove_all_aps (NMDeviceWifi *self) - /* Remove outdated APs */ - while (g_slist_length (priv->ap_list)) { - NMAccessPoint *ap = NM_AP (priv->ap_list->data); - remove_access_point (self, ap, FALSE); - } - g_slist_free (priv->ap_list); - priv->ap_list = NULL; + if (priv->ap_list) { + set_current_ap (self, NULL, FALSE, FALSE); + + while (priv->ap_list) + remove_access_point (self, NM_AP (priv->ap_list->data)); - nm_device_recheck_available_connections (NM_DEVICE (self)); + nm_device_recheck_available_connections (NM_DEVICE (self)); + } } @@ -823,3 +833,2 @@ deactivate (NMDevice *dev) NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); - NMAccessPoint *orig_ap = nm_device_wifi_get_activation_ap (self); NMActRequest *req; @@ -842,3 +851,2 @@ deactivate (NMDevice *dev) - set_active_ap (self, NULL); priv->rate = 0; @@ -848,9 +856,5 @@ deactivate (NMDevice *dev) * was non-broadcasting or something) get rid of it, because 'fake' - * APs should only live for as long as we're connected to them. Fixes - * a bug where user-created Ad-Hoc APs are never removed from the scan - * list, because scanning is disabled while in Ad-Hoc mode (for stability), - * and thus the AP culling never happens. (bgo #569241) - */ - if (orig_ap && nm_ap_get_fake (orig_ap)) - remove_access_point (self, orig_ap, TRUE); + * APs should only live for as long as we're connected to them. + **/ + set_current_ap (self, NULL, TRUE, FALSE); @@ -1788,3 +1792,2 @@ merge_scanned_ap (NMDeviceWifi *self, gboolean strict_match = TRUE; - NMAccessPoint *current_ap = NULL; @@ -1819,4 +1822,3 @@ merge_scanned_ap (NMDeviceWifi *self, */ - current_ap = nm_device_wifi_get_activation_ap (self); - if (current_ap && nm_ap_get_fake (current_ap)) + if (priv->current_ap && nm_ap_get_fake (priv->current_ap)) strict_match = FALSE; @@ -1888,4 +1890,5 @@ cull_scan_list (NMDeviceWifi *self) /* Don't cull the associated AP or manually created APs */ - if (ap == priv->current_ap || nm_ap_get_fake (ap)) + if (ap == priv->current_ap) continue; + g_assert (!nm_ap_get_fake (ap)); /* only the current_ap can be fake */ @@ -1903,3 +1906,3 @@ cull_scan_list (NMDeviceWifi *self) if (nm_ap_get_last_seen (ap) + prune_interval_s < now) - outdated_list = g_slist_append (outdated_list, ap); + outdated_list = g_slist_prepend (outdated_list, ap); } @@ -1923,3 +1926,3 @@ cull_scan_list (NMDeviceWifi *self) - remove_access_point (self, outdated_ap, TRUE); + remove_access_point (self, outdated_ap); removed++; @@ -2090,3 +2093,2 @@ link_timeout_cb (gpointer user_data) NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); - NMAccessPoint *ap; @@ -2108,12 +2110,4 @@ link_timeout_cb (gpointer user_data) */ - if (priv->ssid_found == FALSE) { - if (priv->current_ap) { - ap = priv->current_ap; - priv->current_ap = NULL; - } else - ap = nm_device_wifi_get_activation_ap (self); - - if (ap) - remove_access_point (self, ap, TRUE); - } + if (priv->ssid_found == FALSE && priv->current_ap) + set_current_ap (self, NULL, TRUE, TRUE); @@ -2315,4 +2309,14 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface, if (devstate == NM_DEVICE_STATE_CONFIG) { - NMAccessPoint *ap = nm_device_wifi_get_activation_ap (self); - const GByteArray *ssid = ap ? nm_ap_get_ssid (ap) : NULL; + NMConnection *connection; + NMSettingWireless *s_wifi; + const GByteArray *ssid; + + connection = nm_device_get_connection (NM_DEVICE (self)); + g_return_if_fail (connection); + + s_wifi = nm_connection_get_setting_wireless (connection); + g_return_if_fail (s_wifi); + + ssid = nm_setting_wireless_get_ssid (s_wifi); + g_return_if_fail (ssid); @@ -2327,3 +2331,3 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface, } else if (devstate == NM_DEVICE_STATE_ACTIVATED) - periodic_update (self); + periodic_update (self, NULL); break; @@ -2461,3 +2465,3 @@ supplicant_iface_notify_scanning_cb (NMSupplicantInterface *iface, if (!scanning && state == NM_DEVICE_STATE_ACTIVATED) - periodic_update (self); + periodic_update (self, NULL); } @@ -2522,25 +2526,2 @@ handle_auth_or_fail (NMDeviceWifi *self, -static gboolean -is_encrypted (NMAccessPoint *ap, NMConnection *connection) -{ - NM80211ApFlags flags; - NM80211ApSecurityFlags wpa_flags, rsn_flags; - - g_return_val_if_fail (ap != NULL, FALSE); - g_return_val_if_fail (connection != NULL, FALSE); - - flags = nm_ap_get_flags (ap); - wpa_flags = nm_ap_get_wpa_flags (ap); - rsn_flags = nm_ap_get_rsn_flags (ap); - - if (flags & NM_802_11_AP_FLAGS_PRIVACY) - return TRUE; - if (wpa_flags & (NM_802_11_AP_SEC_KEY_MGMT_PSK | NM_802_11_AP_SEC_KEY_MGMT_802_1X)) - return TRUE; - if (rsn_flags & (NM_802_11_AP_SEC_KEY_MGMT_PSK | NM_802_11_AP_SEC_KEY_MGMT_802_1X)) - return TRUE; - - return FALSE; -} - /* @@ -2557,3 +2538,2 @@ supplicant_connection_timeout_cb (gpointer user_data) NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); - NMAccessPoint *ap; NMActRequest *req; @@ -2595,5 +2575,4 @@ supplicant_connection_timeout_cb (gpointer user_data) g_assert (priv->mode == NM_802_11_MODE_INFRA); - ap = nm_device_wifi_get_activation_ap (self); - if (priv->ssid_found && ap && is_encrypted (ap, connection)) { + if (priv->ssid_found && nm_connection_get_setting_wireless_security (connection)) { guint64 timestamp = 0; @@ -2674,3 +2653,3 @@ build_supplicant_config (NMDeviceWifi *self, NMConnection *connection, - NMAccessPoint *ap) + guint32 fixed_freq) { @@ -2698,5 +2677,3 @@ build_supplicant_config (NMDeviceWifi *self, s_wireless, - nm_ap_get_broadcast (ap), - nm_ap_get_freq (ap), - wifi_utils_can_scan_ssid (priv->wifi_data))) { + fixed_freq)) { nm_log_err (LOGD_WIFI, "Couldn't add 802-11-wireless setting to supplicant config."); @@ -2789,3 +2766,3 @@ update_initial_hw_address (NMDevice *dev) memcpy (priv->initial_hw_addr, nm_device_get_hw_address (dev, NULL), ETH_ALEN); - + mac_str = nm_utils_hwaddr_ntoa (priv->initial_hw_addr, ARPHRD_ETHER); @@ -2809,2 +2786,3 @@ act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) const char *mode; + const char *ap_path; @@ -2853,3 +2831,5 @@ act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) if (priv->mode != NM_802_11_MODE_AP) { - ap = nm_device_wifi_get_activation_ap (self); + + ap_path = nm_active_connection_get_specific_object (NM_ACTIVE_CONNECTION (req)); + ap = ap_path ? get_ap_by_path (self, ap_path) : NULL; if (ap) @@ -2892,3 +2872,3 @@ act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) done: - set_active_ap (self, ap); + set_current_ap (self, ap, TRUE, FALSE); return NM_ACT_STAGE_RETURN_SUCCESS; @@ -2945,6 +2925,5 @@ act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason) - ap = nm_device_wifi_get_activation_ap (self); + ap = priv->current_ap; if (!ap) { - nm_log_warn (LOGD_DEVICE | LOGD_WIFI, "act_stage2_config failed due to unexpected missing activation_ap. Abort"); - *reason = NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT; + *reason = NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED; goto out; @@ -2995,3 +2974,3 @@ act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason) /* Build up the supplicant configuration */ - config = build_supplicant_config (self, connection, ap); + config = build_supplicant_config (self, connection, nm_ap_get_freq (ap)); if (config == NULL) { @@ -3025,3 +3004,3 @@ act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason) if (!priv->periodic_source_id) - priv->periodic_source_id = g_timeout_add_seconds (6, periodic_update, self); + priv->periodic_source_id = g_timeout_add_seconds (6, periodic_update_cb, self); @@ -3062,28 +3041,22 @@ ip4_config_pre_commit (NMDevice *device, NMIP4Config *config) static gboolean -is_static_wep (NMAccessPoint *ap, NMConnection *connection) +is_static_wep (NMConnection *connection) { - NM80211ApFlags flags; - NM80211ApSecurityFlags wpa_flags, rsn_flags; NMSettingWirelessSecurity *s_wsec; - const char *key_mgmt; + const char *str; - g_return_val_if_fail (ap != NULL, FALSE); g_return_val_if_fail (connection != NULL, FALSE); - flags = nm_ap_get_flags (ap); - wpa_flags = nm_ap_get_wpa_flags (ap); - rsn_flags = nm_ap_get_rsn_flags (ap); - - if ( (flags & NM_802_11_AP_FLAGS_PRIVACY) - && (wpa_flags == NM_802_11_AP_SEC_NONE) - && (rsn_flags == NM_802_11_AP_SEC_NONE)) { - s_wsec = nm_connection_get_setting_wireless_security (connection); - if (s_wsec) { - key_mgmt = nm_setting_wireless_security_get_key_mgmt (s_wsec); - if (g_strcmp0 (key_mgmt, "none") == 0) - return TRUE; - } - } + s_wsec = nm_connection_get_setting_wireless_security (connection); + if (!s_wsec) + return FALSE; - return FALSE; + str = nm_setting_wireless_security_get_key_mgmt (s_wsec); + if (g_strcmp0 (str, "none") != 0) + return FALSE; + + str = nm_setting_wireless_security_get_auth_alg (s_wsec); + if (g_strcmp0 (str, "leap") == 0) + return FALSE; + + return TRUE; } @@ -3097,3 +3070,2 @@ handle_ip_config_timeout (NMDeviceWifi *self, { - NMAccessPoint *ap; NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE; @@ -3107,4 +3079,2 @@ handle_ip_config_timeout (NMDeviceWifi *self, - ap = nm_device_wifi_get_activation_ap (self); - /* If IP configuration times out and it's a static WEP connection, that @@ -3116,3 +3086,3 @@ handle_ip_config_timeout (NMDeviceWifi *self, */ - if (ap && is_static_wep (ap, connection) && (may_fail == FALSE)) { + if (!may_fail && is_static_wep (connection)) { /* Activation failed, we must have bad encryption key */ @@ -3190,3 +3160,3 @@ activation_success_handler (NMDevice *dev) struct ether_addr bssid = { {0x0, 0x0, 0x0, 0x0, 0x0, 0x0} }; - NMAccessPoint *tmp_ap; + NMAccessPoint *tmp_ap = NULL; NMActRequest *req; @@ -3203,3 +3173,3 @@ activation_success_handler (NMDevice *dev) - ap = nm_device_wifi_get_activation_ap (self); + ap = priv->current_ap; @@ -3208,4 +3178,6 @@ activation_success_handler (NMDevice *dev) */ - if (!ap || !nm_ap_get_fake (ap)) + if (!ap || !nm_ap_get_fake (ap)){ + ap = NULL; goto done; + } @@ -3223,3 +3195,3 @@ activation_success_handler (NMDevice *dev) - tmp_ap = get_active_ap (self, ap, TRUE); + tmp_ap = find_active_ap (self, ap, TRUE); if (tmp_ap) { @@ -3237,5 +3209,2 @@ activation_success_handler (NMDevice *dev) nm_ap_get_dbus_path (tmp_ap)); - - priv->ap_list = g_slist_remove (priv->ap_list, ap); - g_object_unref (ap); } @@ -3243,6 +3212,14 @@ activation_success_handler (NMDevice *dev) done: - periodic_update (self); + periodic_update (self, ap); - /* Update seen BSSIDs cache with the connected AP */ - update_seen_bssids_cache (self, priv->current_ap); + /* ap might be already unrefed, because it was a fake_ap. But we don't touch it... */ + if (tmp_ap && ap == priv->current_ap) { + /* Strange, we would expect periodic_update() to find a better AP + * then the fake one and reset it. Reset the fake current_ap to NULL + * now, which will remove the fake ap. + **/ + set_current_ap (self, NULL, TRUE, FALSE); + } + + /* No need to update seen BSSIDs cache, that is done by set_current_ap() already */ @@ -3255,4 +3232,2 @@ activation_failure_handler (NMDevice *dev) { - NMDeviceWifi *self = NM_DEVICE_WIFI (dev); - NMAccessPoint *ap; NMConnection *connection; @@ -3264,14 +3239,2 @@ activation_failure_handler (NMDevice *dev) g_object_set_data (G_OBJECT (connection), WIRELESS_SECRETS_TRIES, NULL); - - if ((ap = nm_device_wifi_get_activation_ap (self))) { - if (nm_ap_get_fake (ap)) { - /* Fake APs are ones that don't show up in scans, - * but which the user explicitly attempted to connect to. - * However, if we fail on one of these, remove it from the - * list because we don't have any scan or capability info - * for it, and they are pretty much useless. - */ - remove_access_point (self, ap, TRUE); - } - } } @@ -3310,3 +3273,2 @@ device_state_changed (NMDevice *device, cleanup_association_attempt (self, TRUE); - set_active_ap (self, NULL); remove_all_aps (self); @@ -3366,19 +3328,2 @@ device_state_changed (NMDevice *device, -NMAccessPoint * -nm_device_wifi_get_activation_ap (NMDeviceWifi *self) -{ - NMActRequest *req; - const char *ap_path; - - g_return_val_if_fail (NM_IS_DEVICE_WIFI (self), NULL); - - req = nm_device_get_act_request (NM_DEVICE (self)); - if (!req) - return NULL; - - ap_path = nm_active_connection_get_specific_object (NM_ACTIVE_CONNECTION (req)); - - return ap_path ? get_ap_by_path (self, ap_path) : NULL; -} - static void @@ -3488,3 +3433,2 @@ dispose (GObject *object) - set_active_ap (self, NULL); remove_all_aps (self); diff --git a/src/devices/nm-device-wifi.h b/src/devices/nm-device-wifi.h index 6ea303e773..2403c94530 100644 --- a/src/devices/nm-device-wifi.h +++ b/src/devices/nm-device-wifi.h @@ -93,4 +93,2 @@ NMDevice *nm_device_wifi_new (NMPlatformLink *platform_device); -NMAccessPoint * nm_device_wifi_get_activation_ap (NMDeviceWifi *self); - RfKillState nm_device_wifi_get_ipw_rfkill_state (NMDeviceWifi *self); diff --git a/src/nm-wifi-ap.c b/src/nm-wifi-ap.c index fb12754b10..b7af653289 100644 --- a/src/nm-wifi-ap.c +++ b/src/nm-wifi-ap.c @@ -796,3 +796,3 @@ nm_ap_set_ssid (NMAccessPoint *ap, const GByteArray * ssid) - if ((ssid == priv->ssid) && ssid == NULL) + if (ssid == priv->ssid) return; diff --git a/src/supplicant-manager/nm-supplicant-config.c b/src/supplicant-manager/nm-supplicant-config.c index 229f5e0025..6b36685bc1 100644 --- a/src/supplicant-manager/nm-supplicant-config.c +++ b/src/supplicant-manager/nm-supplicant-config.c @@ -336,5 +336,3 @@ nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self, NMSettingWireless * setting, - gboolean is_broadcast, - guint32 fixed_freq, - gboolean has_scan_capa_ssid) + guint32 fixed_freq) { @@ -355,8 +353,4 @@ nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self, priv->ap_scan = 2; - else if (is_broadcast == FALSE) { - /* drivers that support scanning specific SSIDs should use - * ap_scan=1, while those that do not should use ap_scan=2. - */ - priv->ap_scan = has_scan_capa_ssid ? 1 : 2; - } + else + priv->ap_scan = 1; diff --git a/src/supplicant-manager/nm-supplicant-config.h b/src/supplicant-manager/nm-supplicant-config.h index a8d304709a..75d6b779ff 100644 --- a/src/supplicant-manager/nm-supplicant-config.h +++ b/src/supplicant-manager/nm-supplicant-config.h @@ -67,5 +67,3 @@ gboolean nm_supplicant_config_add_setting_wireless (NMSupplicantConfig *self, NMSettingWireless *setting, - gboolean is_broadcast, - guint32 adhoc_freq, - gboolean has_scan_capa_ssid); + guint32 fixed_freq); diff --git a/src/supplicant-manager/tests/test-supplicant-config.c b/src/supplicant-manager/tests/test-supplicant-config.c index 95da39293d..458e1a1348 100644 --- a/src/supplicant-manager/tests/test-supplicant-config.c +++ b/src/supplicant-manager/tests/test-supplicant-config.c @@ -175,3 +175,3 @@ test_wifi_open (void) - success = nm_supplicant_config_add_setting_wireless (config, s_wifi, TRUE, 0, TRUE); + success = nm_supplicant_config_add_setting_wireless (config, s_wifi, 0); ASSERT (success == TRUE, @@ -274,3 +274,3 @@ test_wifi_wep_key (const char *detail, - success = nm_supplicant_config_add_setting_wireless (config, s_wifi, TRUE, 0, TRUE); + success = nm_supplicant_config_add_setting_wireless (config, s_wifi, 0); ASSERT (success == TRUE, @@ -407,3 +407,3 @@ test_wifi_wpa_psk (const char *detail, - success = nm_supplicant_config_add_setting_wireless (config, s_wifi, TRUE, 0, TRUE); + success = nm_supplicant_config_add_setting_wireless (config, s_wifi, 0); ASSERT (success == TRUE, diff --git a/src/wifi/wifi-utils-nl80211.c b/src/wifi/wifi-utils-nl80211.c index 5f65aef0e2..eb2534a22c 100644 --- a/src/wifi/wifi-utils-nl80211.c +++ b/src/wifi/wifi-utils-nl80211.c @@ -808,3 +808,2 @@ wifi_nl80211_init (const char *iface, int ifindex) nl80211->num_freqs = device_info.num_freqs; - nl80211->parent.can_scan_ssid = device_info.can_scan_ssid; nl80211->parent.caps = device_info.caps; diff --git a/src/wifi/wifi-utils-private.h b/src/wifi/wifi-utils-private.h index 83075090de..370f4fc0fd 100644 --- a/src/wifi/wifi-utils-private.h +++ b/src/wifi/wifi-utils-private.h @@ -32,3 +32,2 @@ struct WifiData { NMDeviceWifiCapabilities caps; - gboolean can_scan_ssid; diff --git a/src/wifi/wifi-utils-wext.c b/src/wifi/wifi-utils-wext.c index 6e990aed76..5022550339 100644 --- a/src/wifi/wifi-utils-wext.c +++ b/src/wifi/wifi-utils-wext.c @@ -632,3 +632,2 @@ wifi_wext_init (const char *iface, int ifindex, gboolean check_scan) if (scan_capa_range->scan_capa & NM_IW_SCAN_CAPA_ESSID) { - wext->parent.can_scan_ssid = TRUE; nm_log_info (LOGD_HW | LOGD_WIFI, diff --git a/src/wifi/wifi-utils.c b/src/wifi/wifi-utils.c index aa07a66089..b93cd40ea2 100644 --- a/src/wifi/wifi-utils.c +++ b/src/wifi/wifi-utils.c @@ -80,9 +80,2 @@ wifi_utils_get_caps (WifiData *data) -gboolean -wifi_utils_can_scan_ssid (WifiData *data) -{ - g_return_val_if_fail (data != NULL, FALSE); - return data->can_scan_ssid; -} - NM80211Mode diff --git a/src/wifi/wifi-utils.h b/src/wifi/wifi-utils.h index 09583e7bd4..b917ef2f9d 100644 --- a/src/wifi/wifi-utils.h +++ b/src/wifi/wifi-utils.h @@ -39,4 +39,2 @@ NMDeviceWifiCapabilities wifi_utils_get_caps (WifiData *data); -gboolean wifi_utils_can_scan_ssid (WifiData *data); - NM80211Mode wifi_utils_get_mode (WifiData *data); |