From: Aloka Dixit Date: Thu, 6 Mar 2025 21:09:49 +0000 (-0800) Subject: hostapd: Use EHT params for punct_update_legacy_bw() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=706a528f2e104cf4c49a294b83e579f2c306ea71;p=thirdparty%2Fhostap.git hostapd: Use EHT params for punct_update_legacy_bw() Puncturing is supported from EHT onwards hence legacy bandwidths need to be downgraded in case of a non-zero puncturing bitmap. hostapd_eid_vht_operation() passes VHT bandwidth, seg0, and seg1 while calling punct_update_legacy_bw() but puncturing bitmap is from EHT. This may result in incorrect calculations. Issue is more obvious in case of 320 MHz where starting VHT bandwidth can be 160 MHz as 320 MHz is not supported. Value for EHT 'bitmap' can have 16 valid bits but punct_update_legacy_bw() considers only lower 8 bits as VHT 'width' is passed which is is 160 MHz. It may still work if the primary channel is in the lower 160 MHz because then VHT bandwidth spans only lower 8 bits of the bitmap. But if the primary channel is in higher 160 MHz, and if the bitmap has any of the higher 8 bits set to 1, expectation is VHT bandwidth should be downgraded even further to 80 MHz. But punct_update_legacy_bw() returns without taking any action as the higher 8 bits of the bitmap get completely ignored. Use all EHT parameters instead of VHT to calculate legacy bandwidths. Signed-off-by: Aloka Dixit --- diff --git a/src/ap/ieee802_11_vht.c b/src/ap/ieee802_11_vht.c index 4dc325ce8..df5f8cf76 100644 --- a/src/ap/ieee802_11_vht.c +++ b/src/ap/ieee802_11_vht.c @@ -95,6 +95,9 @@ u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid) #ifdef CONFIG_IEEE80211BE if (punct_bitmap) { + oper_chwidth = hostapd_get_oper_chwidth(hapd->iconf); + seg0 = hostapd_get_oper_centr_freq_seg0_idx(hapd->iconf); + seg1 = hostapd_get_oper_centr_freq_seg1_idx(hapd->iconf); punct_update_legacy_bw(punct_bitmap, hapd->iconf->channel, &oper_chwidth, &seg0, &seg1);