From 7bdd3f2aa6dc85340b36acf60e5e890a40386195 Mon Sep 17 00:00:00 2001 From: Sunil Date: Tue, 19 Jul 2022 22:04:39 +0000 Subject: [PATCH] P2P: Allow P2P CSA from 5 GHz to 2.4 GHz band IEEE Std 802.11-2020, 11.8.8 (Selecting and advertising a new channel) doesn't restrict switching to a channel which is not in the same band as the current band. But at the same time, there are some issues in switching between the 2.4/5 GHz bands and the 6 GHz band. So limit the check to consider the critical use case of switching from a 5 GHz channel to a 2.4 GHz channel. Signed-off-by: Sunil Ravi --- wpa_supplicant/p2p_supplicant.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index cb78a30d9..f6252b1aa 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -9667,9 +9667,15 @@ static int wpas_p2p_move_go_csa(struct wpa_supplicant *wpa_s) goto out; } - if (conf->hw_mode != wpa_s->ap_iface->current_mode->mode) { - wpa_dbg(wpa_s, MSG_DEBUG, - "P2P CSA: CSA to a different band is not supported"); + if (conf->hw_mode != wpa_s->ap_iface->current_mode->mode && + (wpa_s->ap_iface->current_mode->mode != HOSTAPD_MODE_IEEE80211A || + is_6ghz_freq(wpa_s->ap_iface->freq) || + conf->hw_mode != HOSTAPD_MODE_IEEE80211G)) { + wpa_dbg(wpa_s, MSG_INFO, + "P2P CSA: CSA from hardware mode %d%s to %d is not supported", + wpa_s->ap_iface->current_mode->mode, + is_6ghz_freq(wpa_s->ap_iface->freq) ? " (6 GHz)" : "", + conf->hw_mode); ret = -1; goto out; }