net: mini_snmpd: Enable ethtool statistics
authorBjørn Mork <[email protected]>
Sat, 1 Mar 2025 12:33:41 +0000 (13:33 +0100)
committerHannu Nyman <[email protected]>
Sun, 8 Jun 2025 08:52:57 +0000 (11:52 +0300)
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 <[email protected]>
net/mini_snmpd/Makefile
net/mini_snmpd/patches/0001-make-MAX_NR_INTERFACES-configurable.patch

index 852280c54aab1d40cba9f3fb9e223e014c38d17b..9d1a8b9058447a940283569adb29b6a2f99c901b 100644 (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 <[email protected]>
 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 \
index fb85060e84443da26c0b33dbf1ce1137bc1a02fc..c7cc31f9f69d83803aa70790c688fedfc175c4e3 100644 (file)
@@ -25,15 +25,15 @@ Signed-off-by: Bjørn Mork <[email protected]>
  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 <[email protected]>
  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 @@