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 <john@phrozen.org>
This commit is contained in:
John Crispin
2026-03-17 11:37:00 +01:00
committed by Felix Fietkau
parent c32059b383
commit d9c765286d
@@ -533,22 +533,27 @@ function scan_extension(ext, cell) {
switch(ord(ext, 0)) {
case 36:
let offset = 7;
cell.he = {};
if (!(ord(ext, 3) & 0x2))
break;
if (cell.band == '6') {
let offset = 7;
if (ord(ext, 2) & 0x40)
offset += 3;
if (ord(ext, 2) & 0x40)
offset += 3;
if (ord(ext, 2) & 0x80)
offset += 1;
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.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: