From: Rohan Date: Thu, 16 Jul 2020 14:05:14 +0000 (+0530) Subject: Derive seg0_idx and seg1_idx for 6 GHz when processing channel switch X-Git-Tag: hostap_2_10~1005 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0fa274d2bf608a574114f5c051c4c35edc706f7c;p=thirdparty%2Fhostap.git Derive seg0_idx and seg1_idx for 6 GHz when processing channel switch The function hostapd_event_ch_switch() derived the seg0_idx and seg1_idx values only for the 5 GHz and 2.4 GHz bands and the 6 GHz case ended up using incorrect calculation based on the 5 GHz channel definitions. Fix this by adding support for 6 GHz frequencies. Signed-off-by: Rohan --- diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index 36678e7a3..9faac0ddc 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -893,9 +893,18 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht, switch (hapd->iface->current_mode->mode) { case HOSTAPD_MODE_IEEE80211A: - if (cf1 > 5000) + if (cf1 == 5935) + seg0_idx = (cf1 - 5925) / 5; + else if (cf1 > 5950) + seg0_idx = (cf1 - 5950) / 5; + else if (cf1 > 5000) seg0_idx = (cf1 - 5000) / 5; - if (cf2 > 5000) + + if (cf2 == 5935) + seg1_idx = (cf2 - 5925) / 5; + else if (cf2 > 5950) + seg1_idx = (cf2 - 5950) / 5; + else if (cf2 > 5000) seg1_idx = (cf2 - 5000) / 5; break; default: