P2P: Fix pri/sec channel switch skipping for GO

Use of wpa_s->p2p_go_no_pri_sec_switch needs to be conditional on
CONFIG_P2P being defined for the build to avoid a compilation error and
ssid->p2p_group to avoid using this for non-P2P AP mode case in
wpa_supplicant. Furthermore, it is better to clear this flag when
stopping a P2P GO to reduce risk of this getting used for a separate
instance of starting a GO.

Fixes: b18d957593 ("P2P: Disable pri/sec channel switch for GO with forced frequency")
Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2024-03-02 21:04:30 +02:00
parent e508c070c4
commit 10122e951d
2 changed files with 9 additions and 2 deletions

View file

@ -440,9 +440,14 @@ int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s,
}
}
if (wpa_s->p2p_go_no_pri_sec_switch) {
#ifdef CONFIG_P2P
if (ssid->p2p_group && wpa_s->p2p_go_no_pri_sec_switch) {
conf->no_pri_sec_switch = 1;
} else if (conf->secondary_channel) {
return 0;
}
#endif /* CONFIG_P2P */
if (conf->secondary_channel) {
struct wpa_supplicant *iface;
for (iface = wpa_s->global->ifaces; iface; iface = iface->next)

View file

@ -1100,6 +1100,8 @@ static int wpas_p2p_group_delete(struct wpa_supplicant *wpa_s,
os_memset(wpa_s->go_dev_addr, 0, ETH_ALEN);
wpa_s->p2p_go_no_pri_sec_switch = 0;
return 0;
}