From: John Crispin Date: Tue, 17 Mar 2026 10:37:00 +0000 (+0100) Subject: wifi-scripts: fix HE Operation IE parsing in iwinfo scan X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d9c765286d9c77feca9be0eb9988df6c6acab96a;p=thirdparty%2Fopenwrt.git wifi-scripts: fix HE Operation IE parsing in iwinfo scan cell.he was only populated when the 6 GHz Operation Information sub-element was parsed, making HE invisible to scan results on 2.4/5 GHz bands. Fix this by setting cell.he unconditionally when HE Operation IE (Extension Element 36) is seen. Gate 6 GHz channel width parsing on cell.band rather than the HE Operation Parameters bit field, which proved unreliable on MediaTek firmware. Fix flag byte offsets in the 6 GHz path: VHT Oper Info Present (BIT 14) and Co-Hosted BSS (BIT 15) are in byte 1 of he_oper_params which maps to ext[2], not ext[1]. For non-6GHz bands, derive channel width from the already-parsed VHT/HT Operation IEs instead of leaving cell.he empty. Signed-off-by: John Crispin --- diff --git a/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc b/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc index c56026f1045..2cea4c54300 100644 --- a/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc +++ b/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc @@ -533,22 +533,27 @@ function scan_extension(ext, cell) { switch(ord(ext, 0)) { case 36: - let offset = 7; - - if (!(ord(ext, 3) & 0x2)) - break; - - if (ord(ext, 2) & 0x40) - offset += 3; - - if (ord(ext, 2) & 0x80) - offset += 1; - - cell.he = { - chan_width: eht_chan_width[ord(ext, offset + 1) & 0x3], - center_chan_1: ord(ext, offset + 2), - center_chan_2: ord(ext, offset + 3), - }; + cell.he = {}; + + if (cell.band == '6') { + let offset = 7; + + if (ord(ext, 2) & 0x40) + offset += 3; + + if (ord(ext, 2) & 0x80) + offset += 1; + + cell.he.chan_width = eht_chan_width[ord(ext, offset + 1) & 0x3]; + cell.he.center_chan_1 = ord(ext, offset + 2); + cell.he.center_chan_2 = ord(ext, offset + 3); + } else if (cell.vht) { + cell.he.chan_width = cell.vht.chan_width; + cell.he.center_chan_1 = cell.vht.center_chan_1; + cell.he.center_chan_2 = cell.vht.center_chan_2; + } else if (cell.ht) { + cell.he.chan_width = cell.ht.chan_width; + } break; case 106: