summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksander Jan Bajkowski2025-05-17 08:01:27 +0000
committerHauke Mehrtens2025-10-19 22:38:50 +0000
commit10356157316b7a183ba7d4f17250dbd2211bfbaf (patch)
treeac544c4397f1157f02a4f9e7fc75a21917fa348f
parentc2e5bded8d0654ba6f696957cb493d607e36a8a6 (diff)
downloadopenwrt-10356157316b7a183ba7d4f17250dbd2211bfbaf.tar.gz
wifi-scripts: ucode: export HE and EHT operation in scan results
Export WiFi 6E (HE) and WiFi 7 (EHT) operation data in scan results. These additional data can be useful to check wifi channel utilization by nearby stations. Example: Cell 32 - Address: xx:xx:xx:xx:xx:xx Mode: Master Frequency: 6.115 GHz Band: 6 GHz Channel: 33 Signal: -14 dBm Quality: 70/70 Encryption: SAE (CCMP) HE Operation: Center Frequency 1: 39 Center Frequency 2: 47 Channel Width: 160 MHz EHT Operation: Center Frequency 1: 47 Center Frequency 2: 63 Channel Width: 320 MHz Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl> Link: https://github.com/openwrt/openwrt/pull/19208 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rwxr-xr-xpackage/network/config/wifi-scripts/files-ucode/usr/bin/iwinfo14
-rw-r--r--package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc40
2 files changed, 54 insertions, 0 deletions
diff --git a/package/network/config/wifi-scripts/files-ucode/usr/bin/iwinfo b/package/network/config/wifi-scripts/files-ucode/usr/bin/iwinfo
index 5b492d6cfa..204a6e5b30 100755
--- a/package/network/config/wifi-scripts/files-ucode/usr/bin/iwinfo
+++ b/package/network/config/wifi-scripts/files-ucode/usr/bin/iwinfo
@@ -91,6 +91,20 @@ function print_scan(cells) {
printf('\t\tChannel Width: %s\n', cell.vht.chan_width);
}
+ if (cell.he) {
+ printf('\t HE Operation:\n');
+ printf('\t\tCenter Frequency 1: %d\n', cell.he.center_chan_1);
+ printf('\t\tCenter Frequency 2: %s\n', cell.he.center_chan_2);
+ printf('\t\tChannel Width: %s\n', cell.he.chan_width);
+ }
+
+ if (cell.eht) {
+ printf('\t EHT Operation:\n');
+ printf('\t\tCenter Frequency 1: %d\n', cell.eht.center_chan_1);
+ printf('\t\tCenter Frequency 2: %s\n', cell.eht.center_chan_2);
+ printf('\t\tChannel Width: %s\n', cell.eht.chan_width);
+ }
+
printf('\n');
}
}
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 29d75b4130..73bd9515a0 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
@@ -481,6 +481,42 @@ export function countrylist(dev) {
return list;
};
+function scan_extension(ext, cell) {
+ const eht_chan_width = [ '20 MHz', '40 MHz', '80 MHz', '160 MHz', '320 MHz'];
+
+ 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),
+ };
+ break;
+
+ case 106:
+ if (!(ord(ext, 1) & 0x1))
+ break;
+
+ cell.eht = {
+ chan_width: eht_chan_width[ord(ext, 6) & 0x7],
+ center_chan_1: ord(ext, 7),
+ center_chan_2: ord(ext, 8),
+ };
+ break;
+ }
+};
+
export function scan(dev) {
const rsn_cipher = [ 'NONE', 'WEP-40', 'TKIP', 'WRAP', 'CCMP', 'WEP-104', 'AES-OCB', 'CKIP', 'GCMP', 'GCMP-256', 'CCMP-256' ];
const ht_chan_offset = [ 'no secondary', 'above', '[reserved]', 'below' ];
@@ -591,6 +627,10 @@ export function scan(dev) {
center_chan_2: ord(ie.data, 2),
};
break;
+
+ case 255:
+ scan_extension(ie.data, cell);
+ break;
};