P2P: Update GO operating frequency after interface setup is completed

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>
This commit is contained in:
Sunil Ravi 2021-06-29 11:18:20 -07:00 committed by Jouni Malinen
parent 263daa30b5
commit 9aaf3e1d13

View 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);