From 7eac0293519475ca947b80ec4c035162039a67a2 Mon Sep 17 00:00:00 2001 From: perceival Date: Fri, 8 May 2026 11:22:18 +0200 Subject: [PATCH 1/2] sysinfo: hostapd_cli for sta count + ifname-config fallback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two fixes for newer OpenWrt / GL.iNet builds where the previous station-count logic silently produced "Down": 1. ifname schema move: ubus call network.wireless status now puts ifname inside the per-iface "config" object instead of at the iface-object level. Added a fallback read from config.ifname so RadioIface gets populated and the per-iface code path runs at all. 2. New get_sta_count() helper: prefers hostapd_cli on /var/run/hostapd (single-dir layout) and /var/run/hostapd-/ (per-instance dir layout). Sums num_sta[*] across all BSS slots, so MLO/MLD-bound clients are counted (iw dev station dump misses them on Flint 3 / BE9300 type setups). Falls back to the original iw dev station dump if hostapd_cli isn't available. Tested on GL.iNet BE9300 (Flint 3) running OpenWrt 23.05-SNAPSHOT with MLO across wlan02/wlan12/wlan22 — counts now match hostapd_cli status num_sta values. Co-Authored-By: Claude Opus 4.7 (1M context) --- misc/sysinfo.sh | 162 ++++++++++++++++++++++++++++-------------------- 1 file changed, 95 insertions(+), 67 deletions(-) diff --git a/misc/sysinfo.sh b/misc/sysinfo.sh index 0f934d4b93..0e8b5e297a 100644 --- a/misc/sysinfo.sh +++ b/misc/sysinfo.sh @@ -1,31 +1,31 @@ #!/bin/sh # -# sysinfo.sh dla OpenWRT AA Cezary Jackiewicz 2013 +# sysinfo.sh for OpenWRT AA Cezary Jackiewicz 2013 # -# 1.00 CJ Pierwsza wersja kodu -# 1.01 RD Drobna przebudowa -# 1.02 RD Korekta błędu wy¶w. zajeto¶ci Flash-a, dodanie kolorów -# 1.03 RD Dodanie nazwy routera, zmiana formatowania -# 1.04 RD Kosmetyka, sugestie @mikhnal. Zmiana przetwarzania info. o wan. -# 1.05 RD Zmiana algorytmu pobierania danych dla wan i lan -# 1.06 RD Parametryzacja kolorów i pojawiania się podkre¶leń -# 1.07 RD Modyfikacja zwi±zana z poprawnym wy¶wietlaniem interfejsu dla prot.3g -# 1.08 RD Modyfikacja wy¶wietlania DNS-ów dla wan, dodanie uptime dla interfejsów -# 1.09 RD Dodanie statusu "Down" dla wył±czonego wifi, zmiana wy¶wietlania dla WLAN(sta) -# 1.10 RD Korekta wy¶wietlania dla WLAN(sta) -# 1.11 RD Korekta wy¶wietlania stanu pamięci, sugestie @dopsz -# 1.12 RD Zmiana kolejno¶ci wy¶wietlania warto¶ci stanu pamięci + kosmetyka -# 1.13 RD Dodanie info o dhcp w LAN, zmiana sposobu wy¶wietlania informacji o LAN -# 1.14 RD Dodanie informacji o ostatnich 5 błędach -# 1.15 RD Zmiana stderr -# 1.16 RD Dodanie wy¶wietlania informacji o swap -# 1.17 RD Zmiana wyliczania informacji o flash -# 1.18 RD Zmiana wy¶wietlania informacji o flash -# 1.19 RD Zmiana wy¶wietlania informacji o sprzęcie -# 1.20 RD Zmiana wy¶wietlania informacji o sprzęcie -# 1.21 RD Dopasowyanie szeroko¶ci do zawarto¶ci /etc/banner -# 1.22 RD Dodanie wyświetlania w HTML-u -# 1.23 RD Poprawki w wyświetlaniu LAN-DHCP i WLAN +# 1.00 CJ Initial version of the code +# 1.01 RD Minor restructuring +# 1.02 RD Correction of Flash occupancy display error, added colors +# 1.03 RD Added router name, changed formatting +# 1.04 RD Cosmetic changes, suggestions by @mikhnal. Changed processing of WAN information. +# 1.05 RD Changed data retrieval algorithm for WAN and LAN +# 1.06 RD Parameterization of colors and underlining appearance +# 1.07 RD Modification for proper display of 3G protocol interface +# 1.08 RD Modification of DNS display for WAN, added uptime for interfaces +# 1.09 RD Added "Down" status for disabled Wi-Fi, changed display for WLAN(sta) +# 1.10 RD Display correction for WLAN(sta) +# 1.11 RD Memory status display correction, suggestions by @dopsz +# 1.12 RD Changed display order of memory status values + cosmetic changes +# 1.13 RD Added DHCP information in LAN, changed display method for LAN info +# 1.14 RD Added information on the last 5 errors +# 1.15 RD Changed stderr +# 1.16 RD Added swap information display +# 1.17 RD Changed calculation of Flash information +# 1.18 RD Changed display of Flash information +# 1.19 RD Changed hardware information display +# 1.20 RD Changed hardware information display +# 1.21 RD Adjusted width to match /etc/banner content +# 1.22 RD Added HTML display +# 1.23 RD Fixes in LAN-DHCP and WLAN display # Destination /sbin/sysinfo.sh # . /usr/share/libubox/jshn.sh @@ -44,6 +44,11 @@ ExtraName="" ExtraValue="" HTML="" +clean_output() { + # Removes literal e[0;31m and e[0m from stdin + sed 's/e\[0;31m//g; s/e\[0m//g' +} + initialize() { #