]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Fix pri/sec channel switch skipping for GO
authorJouni Malinen <j@w1.fi>
Sat, 2 Mar 2024 19:04:30 +0000 (21:04 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 2 Mar 2024 19:04:30 +0000 (21:04 +0200)
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: b18d95759375 ("P2P: Disable pri/sec channel switch for GO with forced frequency")
Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/ap.c
wpa_supplicant/p2p_supplicant.c

index 11bf53900816d32d0bbfb00709b693ded7bd9dd1..69a0e5ee16af866f8513507a36038aafcc92c294 100644 (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)
index f8e903362d088dec3cc958251ec2b5fcf31dd6d5..cfa4f4c88dc97369203b8ea9be5de1855d5294c3 100644 (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;
 }