Update correct VHT/HE/EHT mode in channel switch event

Currently if ch_switch_vht_config is present, only ieee80211ac config
will be updated in hostapd_config and ieee80211ax/ieee80211be config may
be wrong. Fix this by adding handlings for ch_switch_he_config and
ch_switch_eht_config as well.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Xinyue Ling 2023-06-08 13:45:13 +08:00 committed by Jouni Malinen
parent c860647160
commit a6440b57cf

View file

@ -1115,9 +1115,9 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
hapd->iconf->channel = channel; hapd->iconf->channel = channel;
hapd->iconf->ieee80211n = ht; hapd->iconf->ieee80211n = ht;
if (!ht) { if (!ht)
hapd->iconf->ieee80211ac = 0; hapd->iconf->ieee80211ac = 0;
} else if (hapd->iconf->ch_switch_vht_config) { if (hapd->iconf->ch_switch_vht_config) {
/* CHAN_SWITCH VHT config */ /* CHAN_SWITCH VHT config */
if (hapd->iconf->ch_switch_vht_config & if (hapd->iconf->ch_switch_vht_config &
CH_SWITCH_VHT_ENABLED) CH_SWITCH_VHT_ENABLED)
@ -1125,28 +1125,35 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
else if (hapd->iconf->ch_switch_vht_config & else if (hapd->iconf->ch_switch_vht_config &
CH_SWITCH_VHT_DISABLED) CH_SWITCH_VHT_DISABLED)
hapd->iconf->ieee80211ac = 0; hapd->iconf->ieee80211ac = 0;
} else if (hapd->iconf->ch_switch_he_config) { }
if (hapd->iconf->ch_switch_he_config) {
/* CHAN_SWITCH HE config */ /* CHAN_SWITCH HE config */
if (hapd->iconf->ch_switch_he_config & if (hapd->iconf->ch_switch_he_config &
CH_SWITCH_HE_ENABLED) CH_SWITCH_HE_ENABLED) {
hapd->iconf->ieee80211ax = 1; hapd->iconf->ieee80211ax = 1;
if (hapd->iface->freq > 4000 &&
hapd->iface->freq < 5895)
hapd->iconf->ieee80211ac = 1;
}
else if (hapd->iconf->ch_switch_he_config & else if (hapd->iconf->ch_switch_he_config &
CH_SWITCH_HE_DISABLED) CH_SWITCH_HE_DISABLED)
hapd->iconf->ieee80211ax = 0; hapd->iconf->ieee80211ax = 0;
}
#ifdef CONFIG_IEEE80211BE #ifdef CONFIG_IEEE80211BE
} else if (hapd->iconf->ch_switch_eht_config) { if (hapd->iconf->ch_switch_eht_config) {
/* CHAN_SWITCH EHT config */ /* CHAN_SWITCH EHT config */
if (hapd->iconf->ch_switch_eht_config & if (hapd->iconf->ch_switch_eht_config &
CH_SWITCH_EHT_ENABLED) { CH_SWITCH_EHT_ENABLED) {
hapd->iconf->ieee80211be = 1; hapd->iconf->ieee80211be = 1;
hapd->iconf->ieee80211ax = 1; hapd->iconf->ieee80211ax = 1;
if (!is_6ghz_freq(hapd->iface->freq)) if (!is_6ghz_freq(hapd->iface->freq) &&
hapd->iface->freq > 4000)
hapd->iconf->ieee80211ac = 1; hapd->iconf->ieee80211ac = 1;
} else if (hapd->iconf->ch_switch_eht_config & } else if (hapd->iconf->ch_switch_eht_config &
CH_SWITCH_EHT_DISABLED) CH_SWITCH_EHT_DISABLED)
hapd->iconf->ieee80211be = 0; hapd->iconf->ieee80211be = 0;
#endif /* CONFIG_IEEE80211BE */
} }
#endif /* CONFIG_IEEE80211BE */
hapd->iconf->ch_switch_vht_config = 0; hapd->iconf->ch_switch_vht_config = 0;
hapd->iconf->ch_switch_he_config = 0; hapd->iconf->ch_switch_he_config = 0;
hapd->iconf->ch_switch_eht_config = 0; hapd->iconf->ch_switch_eht_config = 0;