net: mini_snmpd: Enable ethtool statistics

Been waiting more than 4 years for a release with this..  Let's stop
waiting and switch to the now 4 year old HEAD of the main branch.

Many DSA switches will not produce useful statistics in the
/proc/net/dev file used by default. It contains interfaces counters
associated with the DSA slave ports, which counts traffic between the
external ports and the CPU port. The usual expectation from snmp
on a switch is that it returns the actual switched traffic per port.
This is often exported using driver specific or phy specific ethtool
counters.

This update brings the ability to pull the per port snmp counters from
configurable ethtool counters.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
This commit is contained in:
Bjørn Mork
2025-03-01 13:33:41 +01:00
committed by Hannu Nyman
parent 21ffe88c57
commit a73fbd3478
2 changed files with 18 additions and 15 deletions

View File

@@ -9,16 +9,18 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=mini_snmpd
PKG_VERSION:=1.6
PKG_RELEASE:=4
PKG_RELEASE:=5
PKG_MAINTAINER:=Marcin Jurkowski <marcin1j@gmail.com>
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING
PKG_CPE_ID:=cpe:/a:minisnmpd_project:minisnmpd
PKG_SOURCE:=mini-snmpd-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/troglobit/mini-snmpd/tar.gz/v$(PKG_VERSION)?
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/troglobit/mini-snmpd
PKG_SOURCE_SUBDIR:=mini-snmpd-$(PKG_VERSION)
PKG_SOURCE_VERSION:=45765e39d52469fd2b5ec5cfb78e042f437c0df4
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/mini-snmpd-$(PKG_VERSION)
PKG_HASH:=de00c475a3c70c56f3ee97cd683cb71009d3521d60b1f589c5a91b4671ede9f3
PKG_MIRROR_HASH:=580eb4bc45a86d9827df505813ec0cf47ba836261d27e8e4b5ca5e0e1581c255
PKG_FIXUP:=autoreconf
PKG_BUILD_PARALLEL:=1
@@ -39,7 +41,7 @@ define Package/mini_snmpd
# uncomment if you just want the binary, not the init script
# openwrt requires init script runtime dependencies be defined for make menuconfig
# (e.g busybox sysntpd)
DEPENDS:=+jsonfilter +ubus +procd +ubox
DEPENDS:=+jsonfilter +ubus +procd +ubox +confuse
VARIANT:=default
CONFLICTS:=mini_snmpd-16 mini_snmpd-52
endef
@@ -61,7 +63,8 @@ define Package/mini_snmpd-52
endef
CONFIGURE_ARGS+= \
$(if $(CONFIG_IPV6),,--disable-ipv6)
$(if $(CONFIG_IPV6),,--disable-ipv6) \
--with-config --enable-ethtool
# Configure weirdness - Disabled by default, explicitately disabling turns feature on!
# --disable-debug \

View File

@@ -25,15 +25,15 @@ Signed-off-by: Bjørn Mork <bjorn@mork.no>
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug], [Enable developer debug mode, disabled by default]),
[enable_debug=$enableval], [enable_debug=no])
@@ -52,6 +56,7 @@ AC_ARG_ENABLE(ipv6,
AS_HELP_STRING([--disable-ipv6], [Disable IPv6 support, enabled by default]),
[enable_ipv6=$enableval], [enable_ipv6=yes])
@@ -56,6 +60,7 @@ AC_ARG_ENABLE(ethtool,
AS_HELP_STRING([--enable-ethtool], [Enable ethtool interface stats, disabled by default]),
[enable_ethtool=$enableval], [enable_ethtool=no])
+
### Enable features ###########################################################################
AS_IF([test "x$with_vendor" != "xno"],[
AS_IF([test "x$vendor" = "xyes"],[
@@ -65,6 +70,8 @@ AS_IF([test "x$with_config" != "xno"], [
@@ -69,6 +74,8 @@ AS_IF([test "x$with_config" != "xno"], [
PKG_CHECK_MODULES([confuse], [libconfuse >= 2.7])])
AM_CONDITIONAL([HAVE_CONFUSE], [test "x$with_config" != "xno"])
@@ -42,22 +42,22 @@ Signed-off-by: Bjørn Mork <bjorn@mork.no>
AS_IF([test "x$enable_debug" = "xyes"],[
AC_DEFINE(DEBUG, 1, [Define to enable debug mode.])])
@@ -74,6 +81,7 @@ AS_IF([test "x$enable_demo" = "xyes"],[
AS_IF([test "x$enable_ipv6" != "xno"],[
AC_DEFINE(CONFIG_ENABLE_IPV6, 1, [Define to enable IPv6 support.])])
@@ -81,6 +88,7 @@ AS_IF([test "x$enable_ipv6" != "xno"],[
AS_IF([test "x$enable_ethtool" != "xno"],[
AC_DEFINE(CONFIG_ENABLE_ETHTOOL, 1, [Define to enable ethtool stats.])])
+
# Check where to install the systemd .service file
AS_IF([test "x$with_systemd" = "xyes" -o "x$with_systemd" = "xauto"], [
def_systemd=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
@@ -122,6 +130,7 @@ cat <<EOF
@@ -129,6 +137,7 @@ cat <<EOF
vendor OID........: $vendor
ipv6..............: $enable_ipv6
mini-snmpd.conf...: $with_config
+ max interfaces....: $with_interfaces
demo mode.........: $enable_demo
systemd...........: $with_systemd
ethtool stats.....: $enable_ethtool
--- a/mini-snmpd.h
+++ b/mini-snmpd.h
@@ -38,7 +38,6 @@