]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpa_supplicant: Call frequency conflict handling during auth
authorIlan Peer <ilan.peer@intel.com>
Thu, 24 Apr 2014 05:45:40 +0000 (08:45 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 24 Apr 2014 09:15:32 +0000 (12:15 +0300)
Previously, the frequency conflict was handled only during the
association flow. However, some drivers, e.g., mac80211 based
drivers, will fail an authentication request in case that there
are no available channels for use (as they might be used by
other interfaces), and thus the frequency conflict resolution
is never called.

Fix this by calling frequency conflict resolution during
authentication (SME-in-wpa_supplicant) as well.

In addition, get the shared radio frequency from the wpa_s context in
both the SME-in-driver and SME-in-wpa_supplicant cases and not from the
driver.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
wpa_supplicant/sme.c
wpa_supplicant/wpa_supplicant.c

index 2538ba0ced85c804f65bb8e8d3902f8f8b2d8581..9b6667a62b7b93b4bc23d518f75a38a504ed1e01 100644 (file)
@@ -416,6 +416,32 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s,
        if (old_ssid != wpa_s->current_ssid)
                wpas_notify_network_changed(wpa_s);
 
+#ifdef CONFIG_P2P
+       /*
+        * If multi-channel concurrency is not supported, check for any
+        * frequency conflict. In case of any frequency conflict, remove the
+        * least prioritized connection.
+        */
+       if (wpa_s->num_multichan_concurrent < 2) {
+               int freq, num;
+               num = get_shared_radio_freqs(wpa_s, &freq, 1);
+               if (num > 0 && freq > 0 && freq != params.freq) {
+                       wpa_printf(MSG_DEBUG,
+                                  "Conflicting frequency found (%d != %d)",
+                                  freq, params.freq);
+                       if (wpas_p2p_handle_frequency_conflicts(wpa_s,
+                                                               params.freq,
+                                                               ssid) < 0) {
+                               wpas_connection_failed(wpa_s, bss->bssid);
+                               wpa_supplicant_mark_disassoc(wpa_s);
+                               wpabuf_free(resp);
+                               wpas_connect_work_done(wpa_s);
+                               return;
+                       }
+               }
+       }
+#endif /* CONFIG_P2P */
+
        wpa_s->sme.auth_alg = params.auth_alg;
        if (wpa_drv_authenticate(wpa_s, &params) < 0) {
                wpa_msg(wpa_s, MSG_INFO, "SME: Authentication request to the "
index 2cf595f71e727dbfbd744cbf7099f66d77a6b985..af7b847b83a269a50f8fa86e63cce3d8d0334f04 100644 (file)
@@ -1822,9 +1822,11 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit)
         * least prioritized connection.
         */
        if (wpa_s->num_multichan_concurrent < 2) {
-               int freq = wpa_drv_shared_freq(wpa_s);
-               if (freq > 0 && freq != params.freq) {
-                       wpa_printf(MSG_DEBUG, "Shared interface with conflicting frequency found (%d != %d)",
+               int freq, num;
+               num = get_shared_radio_freqs(wpa_s, &freq, 1);
+               if (num > 0 && freq > 0 && freq != params.freq) {
+                       wpa_printf(MSG_DEBUG,
+                                  "Assoc conflicting freq found (%d != %d)",
                                   freq, params.freq);
                        if (wpas_p2p_handle_frequency_conflicts(wpa_s,
                                                                params.freq,