[openwrt/openwrt] wifi-scripts: iwinfo: add null checks for rx/tx bitrate
LEDE Commits
lede-commits at lists.infradead.org
Tue Feb 18 23:13:39 PST 2025
blogic pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/15013e87cb5415b7462523a2d87e833f3f56995f
commit 15013e87cb5415b7462523a2d87e833f3f56995f
Author: Sean Khan <datapronix at protonmail.com>
AuthorDate: Wed Feb 19 00:28:07 2025 -0500
wifi-scripts: iwinfo: add null checks for rx/tx bitrate
On some devices, the rx/tx bitrate may not always be available
right away, or at all when in mesh mode at plink is blocked causing
the following:
```
Reference error: left-hand side expression is null
In assoclist(), file /usr/share/ucode/iwinfo.uc, line 321, byte 46:
called from function info (/usr/share/ucode/iwinfo.uc:427:33)
called from anonymous function (/usr/bin/iwinfo:108:25)
` bitrate_raw: station.sta_info.tx_bitrate.bitrate,`
Near here -----------------------------------------------^
Reference error: left-hand side expression is null
In assoclist(), file /usr/share/ucode/iwinfo.uc, line 314, byte 54:
called from function info (/usr/share/ucode/iwinfo.uc:427:33)
called from anonymous function (/usr/bin/iwinfo:108:25)
` bitrate: format_rate(station.sta_info.rx_bitrate.bitrate),`
Near here -------------------------------------------------------^
Reference error: left-hand side expression is null
In assoc_flags(), file /usr/share/ucode/iwinfo.uc, line 216, byte 12:
called from function assoclist (/usr/share/ucode/iwinfo.uc:323:51)
called from function info (/usr/share/ucode/iwinfo.uc:427:33)
called from anonymous function (/usr/bin/iwinfo:108:25)
` if (data[k])`
Near here -------^
```
This was seen on Linksys MX5300 in mesh mode (QCA9984).
Signed-off-by: Sean Khan <datapronix at protonmail.com>
Link: https://github.com/openwrt/openwrt/pull/18027
Signed-off-by: John Crispin <john at phrozen.org>
---
.../wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
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 4ce45b21f1..ff878cfebb 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
@@ -311,16 +311,16 @@ export function assoclist(dev) {
snr: station.sta_info.signal_avg - ifaces[dev].noise,
inactive_time: station.sta_info.inactive_time,
rx: {
- bitrate: format_rate(station.sta_info.rx_bitrate.bitrate),
- bitrate_raw: station.sta_info.rx_bitrate.bitrate,
- packets: station.sta_info.rx_packets,
- flags: assoc_flags(station.sta_info.rx_bitrate),
+ bitrate: format_rate(station.sta_info.rx_bitrate?.bitrate ?? 0),
+ bitrate_raw: station.sta_info.rx_bitrate?.bitrate ?? 0,
+ packets: station.sta_info.rx_packets ?? 0,
+ flags: assoc_flags(station.sta_info.rx_bitrate ?? {}),
},
tx: {
- bitrate: format_rate(station.sta_info.tx_bitrate.bitrate),
- bitrate_raw: station.sta_info.tx_bitrate.bitrate,
- packets: station.sta_info.tx_packets,
- flags: assoc_flags(station.sta_info.tx_bitrate),
+ bitrate: format_rate(station.sta_info.tx_bitrate?.bitrate ?? 0),
+ bitrate_raw: station.sta_info.tx_bitrate?.bitrate ?? 0,
+ packets: station.sta_info.tx_packets ?? 0,
+ flags: assoc_flags(station.sta_info.tx_bitrate ?? {}),
},
expected_throughput: station.sta_info.expected_throughput ?? 'unknown',
};
More information about the lede-commits
mailing list