Skip to content

lanstat: add new package - #31466

Open
wbpluto wants to merge 1 commit into
openwrt:masterfrom
wbpluto:lanstat
Open

wbpluto wants to merge 1 commit into
openwrt:masterfrom
wbpluto:lanstat

Conversation

@wbpluto

@wbpluto wbpluto commented Nov 26, 2026 •

Copy link
Copy Markdown

📦 Package Details

Maintainer: @wbpluto

Description:
Add lanstat 1.0.1, a lightweight, single-binary C11 LAN bandwidth monitor for OpenWrt with zero external runtime dependencies.

  • Captures per-host IPv4/IPv6 traffic on the LAN bridge via Linux AF_PACKET + TPACKET_V2 zero-copy ring buffer (~1.8 MB RSS).
  • Serves a built-in gzip-compressed real-time Mbps Web UI (default port 6670) with multi-window history (60s / 60m / 24h / 31d), offline IEEE OUI vendor lookup, privacy masking mode, and bilingual CN/EN support.
  • Optional LuCI integration is packaged separately in luci-app-lanstat: add new package luci#9325.
  • Verified builds across OpenWrt 24.10 (.ipk) and 25.12 (.apk) SDKs for x86_64, aarch64_cortex-a53, aarch64_generic, mipsel_24kc, arm_cortex-a7_neon-vfpv4, and mips_24kc.

🔬 Run Testing Details

  • OpenWrt Version: 24.10 / 25.12
  • OpenWrt Target/Subtarget: mediatek/filogic (aarch64_cortex-a53)
  • OpenWrt Device: MT7981 (aarch64_cortex-a53)

✅ Formalities

  • I have reviewed the contributing guidelines.
  • I have reviewed the AI policy.
    • I have used AI or LLM in my pull request, description, or commit
      messages, and the description says what it was used for.

AI assistance was used for packaging, commit messages and the PR description.

Comment thread net/lanstat/Makefile Outdated
Comment on lines +56 to +64
$(INSTALL_DIR) $(1)/usr/share/luci/menu.d
$(INSTALL_DATA) $(PKG_BUILD_DIR)/openwrt/usr/share/luci/menu.d/lanstat.json $(1)/usr/share/luci/menu.d/lanstat.json
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
$(INSTALL_DATA) $(PKG_BUILD_DIR)/openwrt/usr/share/rpcd/acl.d/lanstat.json $(1)/usr/share/rpcd/acl.d/lanstat.json
$(INSTALL_DIR) $(1)/www/luci-static/resources/view
$(INSTALL_DATA) $(PKG_BUILD_DIR)/openwrt/www/luci-static/resources/view/lanstat.js $(1)/www/luci-static/resources/view/lanstat.js
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
$(INSTALL_DATA) $(PKG_BUILD_DIR)/openwrt/usr/lib/lua/luci/i18n/lanstat.zh-cn.lmo $(1)/usr/lib/lua/luci/i18n/lanstat.zh-cn.lmo
$(INSTALL_DATA) $(PKG_BUILD_DIR)/openwrt/usr/lib/lua/luci/i18n/lanstat.zh-tw.lmo $(1)/usr/lib/lua/luci/i18n/lanstat.zh-tw.lmo

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines install the LuCI menu, ACL and view, plus prebuilt .lmo binaries, directly from the upstream archive's openwrt/ directory. LuCI integration usually goes to openwrt/luci as a separate luci-app-lanstat, where the translations are built from .po sources by LuciTranslation in luci.mk:371-399. If you drop these lines here, the LuCI cache and rpcd handling in postinst/postrm can go too.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

Comment thread net/lanstat/files/lanstat.config Outdated
@@ -0,0 +1,9 @@
config lanstat 'main'
option enabled '1'
option interface 'br-lan'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

network_get_device in the init script expects a logical interface name, so with br-lan the lookup always fails and the init script falls back to the raw device name. On boards whose LAN is not a bridge called br-lan, that fallback picks the wrong device. Default to the logical lan here, and also change the "br-lan" fallback at lanstat.init line 17.

Suggested change
option interface 'br-lan'
option interface 'lan'

Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit checks

  • 2129405 "lanstat: remove LuCI integration and default interface to lan": this only undoes and fixes parts of 26b7816, which still says it adds an "optional LuCI menu entry". Squash both into one "lanstat: add new package" commit and drop the LuCI wording from its message.

Generated by Claude Code

Comment thread net/lanstat/Makefile
$(INSTALL_CONF) ./files/lanstat.config $(1)/etc/config/lanstat
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/lanstat.init $(1)/etc/init.d/lanstat
endef

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The PR body still lists "optional static LuCI menu entry (Status -> Bandwidth Monitor)", but this package no longer ships one. Please update the description to point to the separate luci-app-lanstat PR.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

wbpluto added a commit to wbpluto/luci that referenced this pull request Nov 29, 2026
Add LuCI web interface for lanstat real-time LAN client bandwidth
monitoring.

Provides a LuCI status view and ubus/rpcd ACL integration for the
lanstat daemon (openwrt/packages#31466).

Signed-off-by: Junwei Huang <hjw@live.cn>
@wbpluto

wbpluto commented Nov 30, 2026

Copy link
Copy Markdown
Author

Packaging and device-test update for this PR: the upstream v1.0.1 GitHub Release workflow merged six SDK artifacts with the same APK filename, leaving only one APK on the release page. On a WR30U (mediatek/filogic), a locally installed aarch64_generic build pinned by checksum in APK's world caused even apk upgrade --simulate tailscale to fail architecture selection.

I fixed the upstream release workflow to include the SDK architecture in each APK asset name for future releases: wbpluto/lanstat@0f4877b. The existing v1.0.1 release asset predates this change. The collision occurred when publishing standalone GitHub assets, outside the OpenWrt feed build.

On the WR30U running ImmortalWrt, I redeployed v1.0.1 using the Cortex-A53 SDK binary in a locally indexed, signed feed and installed by package name. The existing LuCI package and configuration were preserved. The dashboard returned HTTP 200, packet capture was active on br-lan, and the same Tailscale upgrade simulation completed successfully.

Add lanstat 1.0.1 to monitor per-host LAN bandwidth and display live
traffic in its embedded web dashboard.

Signed-off-by: Junwei Huang <hjw@live.cn>

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commits; no new issues found.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants