Update GO operating frequency after interface setup is completed.
Once the GO/AP interface initialization is completed, check
if the operating frequency set in wpa_supplicant group interface structure is
different than the one set in hostapd interface structure associated
with the group interface. If yes, update frequency in wpa_supplicant group interface
and Network configuration to the frequency set in hostapd interface
structure. The frequency set in hostapd interface is the correct/final
frequency supplicant configured in kernel/driver.
This is done because supplicant may switch the initially
requested primary and seconday frequencies to get secondary frequency with no beacons
(To avoid interference or 20/40 coex logic). And the updated frequency
is informed by driver only after the interface setup is completed
through channel switch event - EVENT_CH_SWITCH. But supplicant
update the frequency to applications through P2P_GROUP_STARTED event
which is triggered before EVENT_CH_SWITCH event. To send the correct
frequency to applications the frequency must be updated before sending
P2P_GROUP_STARTED event.
Bug: 191272346
Test: Manual - Verified that GO frequency is updated and reported
correctly to Nearby application.
Change-Id: I70910365b8acebfbefdd853e7a6cd3f9f6ec6a5c
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index cfefa48..807e36d 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -807,12 +807,17 @@
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
+ if (acs || (wpa_s->assoc_freq && wpa_s->ap_iface->freq &&
+ 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;
+ }
}
-#endif /* CONFIG_ACS */
wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);