sysinfo.sh: MLO sta count via hostapd_cli + ifname-in-config fallback#5
Open
perceival wants to merge 2 commits into
Open
sysinfo.sh: MLO sta count via hostapd_cli + ifname-in-config fallback#5perceival wants to merge 2 commits into
perceival wants to merge 2 commits into
Conversation
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-<iface>/<iface> (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) <noreply@anthropic.com>
…on path - Bring back the original Polish revision-log entries from the upstream header and keep the English translations side-by-side (one line per revision, `PL / EN`, with overflow wrapped on the next line). - File re-encoded as UTF-8 so both `ś/ł/ą/ę/ó/ż/ź/ć/ń` and ASCII fit cleanly (the upstream file mixed ISO-8859-2 and CP1250 bytes). - Update the `# Destination` hint from `/sbin/sysinfo.sh` to `/etc/profile.d/99-sysinfo.sh` — that's where the script naturally belongs on modern OpenWrt: dropping it into `profile.d/` makes it fire automatically on each shell login (mirrors how OpenWrt's stock banner / motd is delivered) and survives sysupgrade when listed in `/etc/sysupgrade.conf`. No code changes in this commit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two real fixes for
misc/sysinfo.shon modern OpenWrt / GL.iNet builds, plus someheader cleanup. Tested on GL.iNet BE9300 (Flint 3) running OpenWrt 23.05-SNAPSHOT
with MLO across
wlan02 / wlan12 / wlan22, and on two older APs(Netgear R7800 and Linksys E8450) running vanilla OpenWrt.
1.
ubus network.wireless statusschema move —ifnamenow lives insideconfigOn newer OpenWrt,
ubus call network.wireless statusno longer exposesifnameat the per-interface object level — it has moved into the innerconfigobject. The current code only reads the top-level value, so$RadioIfaceends up empty, the per-iface code path is skipped, and theoutput silently degrades to
conn: Downfor every radio.Fix: read the top-level first (back-compat with older builds), then fall
back to
config.ifnameif it's empty.2.
iw dev <ifname> station dumpmisses MLO/MLD-bound stationsOn Wi-Fi 7 hardware with MLO enabled, clients associated through an MLD
do not show up in
iw dev <radio> station dump— the kernel reportsthem per-link only via hostapd's control socket. As a result, the
station counter shows 0 / wrong values on Flint 3 etc.
Added
get_sta_count()helper that prefershostapd_cli ... statusandsums
num_sta[*]across BSS slots:hostapd_cli -p /var/run/hostapd -i $iface status(single-dir layout, stock OpenWrt)hostapd_cli -p /var/run/hostapd-$iface -i $iface status(per-instance dir layout)iw dev $iface station dump | grep -c '^Station'Counts now match
hostapd_cli status num_staand the LuCI overview.3. Header cleanup (commit 2)
kept English translations side-by-side (
PL / ENper line). The fileis now valid UTF-8 — the original had mixed ISO-8859-2 / CP1250 bytes
so
śrendered as¶/œdepending on terminal.# Destinationhint from/sbin/sysinfo.shto/etc/profile.d/99-sysinfo.sh, which is where the script naturallyfires on modern OpenWrt (runs on each shell login, survives sysupgrade
when listed in
/etc/sysupgrade.conf).Other changes already in
perceival:masterTwo smaller pre-existing changes from my fork's master also flow into this PR
because they sit on the same path; flagging them so they aren't lost in review:
clean_output()filter that strips literale[0;31m/e[0mstrings thatsome
logreadoutputs leak when not on a TTY (applied viaprint_error | clean_output).print_lan()now skips zones that have no DHCP pool configured(
uci get dhcp.$Device.startempty) — previously they printed an emptydhcp: n/arow. Also referencesdhcp.$Device.{start,limit}directlyinstead of the
dhcp.@dhcp[*].interface=$Devicelookup, since the latterdoesn't match named DHCP sections on current OpenWrt configs.
Happy to split these out into a separate PR if you'd prefer.
Test plan
conn:now matcheshostapd_cli status num_staand LuCI client countconn:still matchesiw devfallbacksh -n misc/sysinfo.shcleanREQUEST_METHOD=GET sysinfo.sh) still renders🤖 Generated with Claude Code