Repository navigation
lanstat: add new package #31466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
wbpluto
wants to merge
1
commit into
openwrt:master
Choose a base branch
from
wbpluto:lanstat
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+106
−0
Open
lanstat: add new package #31466
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # SPDX-License-Identifier: MIT | ||
|
|
||
| include $(TOPDIR)/rules.mk | ||
|
|
||
| PKG_NAME:=lanstat | ||
| PKG_VERSION:=1.0.1 | ||
| PKG_RELEASE:=1 | ||
|
|
||
| PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz | ||
| PKG_SOURCE_URL:=https://codeload.github.com/wbpluto/lanstat/tar.gz/v$(PKG_VERSION)? | ||
| PKG_HASH:=5bd75ec0ca1c0217885337919e989e63f945b0c4c37b7a37224a23dac6c27174 | ||
|
|
||
| PKG_MAINTAINER:=Junwei Huang <hjw@live.cn> | ||
| PKG_LICENSE:=MIT | ||
| PKG_LICENSE_FILES:=LICENSE | ||
|
|
||
| PKG_BUILD_PARALLEL:=1 | ||
|
|
||
| include $(INCLUDE_DIR)/package.mk | ||
|
|
||
| define Package/lanstat | ||
| SECTION:=net | ||
| CATEGORY:=Network | ||
| SUBMENU:=Monitoring | ||
| TITLE:=Lightweight native LAN bandwidth monitor with modern Web UI | ||
| URL:=https://github.com/wbpluto/lanstat | ||
| endef | ||
|
|
||
| define Package/lanstat/description | ||
| A lightweight, single-binary C11 packet & bandwidth monitor for OpenWrt. | ||
| Uses AF_PACKET + TPACKET_V2 zero-copy ring buffer and serves a built-in | ||
| gzip-compressed real-time Mbps dashboard with offline IEEE OUI vendor lookup | ||
| and multi-language UI without external runtime dependencies. | ||
| endef | ||
|
|
||
| define Package/lanstat/conffiles | ||
| /etc/config/lanstat | ||
| endef | ||
|
|
||
| define Build/Compile | ||
| $(TARGET_CC) $(TARGET_CFLAGS) -std=c11 -Wall -Wextra -I$(PKG_BUILD_DIR)/src \ | ||
| $(PKG_BUILD_DIR)/src/main.c \ | ||
| $(PKG_BUILD_DIR)/src/hosts.c \ | ||
| $(PKG_BUILD_DIR)/src/capture.c \ | ||
| $(PKG_BUILD_DIR)/src/http.c \ | ||
| -o $(PKG_BUILD_DIR)/lanstat $(TARGET_LDFLAGS) | ||
| endef | ||
|
|
||
| define Package/lanstat/install | ||
| $(INSTALL_DIR) $(1)/usr/sbin | ||
| $(INSTALL_BIN) $(PKG_BUILD_DIR)/lanstat $(1)/usr/sbin/lanstat | ||
| $(INSTALL_DIR) $(1)/etc/config | ||
| $(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 | ||
|
|
||
| $(eval $(call BuildPackage,lanstat)) | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| config lanstat 'main' | ||
| option enabled '1' | ||
| option interface 'lan' | ||
| option bind '0.0.0.0' | ||
| option port '6670' | ||
| option promisc '1' | ||
| option track_external '0' | ||
| option max_hosts '512' | ||
| option ring_kb '1024' |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #!/bin/sh /etc/rc.common | ||
|
|
||
| START=95 | ||
| STOP=10 | ||
| USE_PROCD=1 | ||
|
|
||
| PROG=/usr/sbin/lanstat | ||
|
|
||
| start_service() { | ||
| local enabled iface dev bind port promisc track_ext max_hosts ring_kb | ||
|
|
||
| . /lib/functions/network.sh | ||
| config_load lanstat | ||
| config_get_bool enabled main enabled 1 | ||
| [ "$enabled" -eq 1 ] || return 0 | ||
|
|
||
| config_get iface main interface "lan" | ||
| network_get_device dev "$iface" || dev="$iface" | ||
| [ -n "$dev" ] || dev="$iface" | ||
| config_get bind main bind "0.0.0.0" | ||
| config_get port main port "6670" | ||
| config_get_bool promisc main promisc 1 | ||
| config_get_bool track_ext main track_external 0 | ||
| config_get max_hosts main max_hosts "512" | ||
| config_get ring_kb main ring_kb "1024" | ||
|
|
||
| procd_open_instance | ||
| procd_set_param command "$PROG" -i "$dev" -b "$bind" -p "$port" -m "$max_hosts" -r "$ring_kb" | ||
| [ "$promisc" -eq 0 ] && procd_append_param command -n | ||
| [ "$track_ext" -eq 1 ] && procd_append_param command -e | ||
| procd_set_param respawn 3600 5 5 | ||
| procd_set_param stdout 1 | ||
| procd_set_param stderr 1 | ||
| procd_close_instance | ||
| } | ||
|
|
||
| service_triggers() { | ||
| procd_add_reload_trigger "lanstat" | ||
| } |
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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