]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Update GO operating frequency after interface setup is completed
authorSunil Ravi <sunilravi@google.com>
Tue, 29 Jun 2021 18:18:20 +0000 (11:18 -0700)
committerJouni Malinen <j@w1.fi>
Wed, 2 Feb 2022 22:35:49 +0000 (00:35 +0200)
Once the GO/AP interface initialization is completed, check if the
operating frequency set in the wpa_supplicant group interface structure
is different than the one set in the hostapd interface structure
associated with the group interface. If yes, update the frequency in the
wpa_supplicant group interface and network configuration to the
frequency set in the hostapd interface structure.

The frequency set in the hostapd interface is the correct/final
frequency wpa_supplicant configured in the kernel/driver. This is done
because wpa_supplicant may switch the initially requested primary and
secondary frequencies to get a secondary frequency with no beacons (to
avoid interference or 20/40 MHz coex logic). And the updated frequency
is informed by the driver only after the interface setup is completed
through the channel switch event - EVENT_CH_SWITCH. But wpa_supplicant
updates the frequency to applications through the P2P_GROUP_STARTED
event which is triggered before the EVENT_CH_SWITCH event. To send the
correct frequency to applications the frequency must be updated before
sending the P2P_GROUP_STARTED event.

Bug: 191272346
Test: Manual - Verified that GO frequency is updated and reported
correctly to Nearby application.

Signed-off-by: Sunil Ravi <sunilravi@google.com>
wpa_supplicant/ap.c

index ad2cf5f1123048f7263ba94aead94327d4842e35..0559822cb8746f76b75fa6b9c0d8698a01287174 100644 (file)
@@ -903,12 +903,18 @@ static void wpas_ap_configured_cb(void *ctx)
                return;
        }
 
+       if (wpa_s->current_ssid) {
+               int acs = 0;
+
 #ifdef CONFIG_ACS
-       if (wpa_s->current_ssid && wpa_s->current_ssid->acs) {
-               wpa_s->assoc_freq = wpa_s->ap_iface->freq;
-               wpa_s->current_ssid->frequency = wpa_s->ap_iface->freq;
-       }
+               acs = wpa_s->current_ssid->acs;
 #endif /* CONFIG_ACS */
+               if (acs || (wpa_s->assoc_freq && wpa_s->ap_iface->freq &&
+                           (int) wpa_s->assoc_freq != wpa_s->ap_iface->freq)) {
+                       wpa_s->assoc_freq = wpa_s->ap_iface->freq;
+                       wpa_s->current_ssid->frequency = wpa_s->ap_iface->freq;
+               }
+       }
 
        wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);