From 21ffe88c57c2e50bc3463cdfe614528f5b85284f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= Date: Fri, 28 Feb 2025 19:20:03 +0100 Subject: [PATCH] net: mini_snmpd: Support more than 8 ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The implementation of mini_snmpd is based on a number of fixed size arrays for simplicity and efficiency. This limits the number of ports which can be monitored. The default is as low as 8, which makes the package unsuitable for many switches. Make the size of these arrays a build time configuration add some package variants for switches or other devices with more than 8 ports Signed-off-by: Bjørn Mork --- net/mini_snmpd/Makefile | 34 ++++++++- ...-make-MAX_NR_INTERFACES-configurable.patch | 70 +++++++++++++++++++ 2 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 net/mini_snmpd/patches/0001-make-MAX_NR_INTERFACES-configurable.patch diff --git a/net/mini_snmpd/Makefile b/net/mini_snmpd/Makefile index 7ee7567b45..852280c54a 100644 --- a/net/mini_snmpd/Makefile +++ b/net/mini_snmpd/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mini_snmpd PKG_VERSION:=1.6 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_MAINTAINER:=Marcin Jurkowski PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING @@ -17,7 +17,7 @@ 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_BUILD_DIR:=$(BUILD_DIR)/mini-snmpd-$(PKG_VERSION) +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/mini-snmpd-$(PKG_VERSION) PKG_HASH:=de00c475a3c70c56f3ee97cd683cb71009d3521d60b1f589c5a91b4671ede9f3 PKG_FIXUP:=autoreconf @@ -40,6 +40,24 @@ define Package/mini_snmpd # openwrt requires init script runtime dependencies be defined for make menuconfig # (e.g busybox sysntpd) DEPENDS:=+jsonfilter +ubus +procd +ubox + VARIANT:=default + CONFLICTS:=mini_snmpd-16 mini_snmpd-52 +endef + +define Package/mini_snmpd-16 + $(call Package/mini_snmpd) + TITLE+= (16 ports) + PROVIDES:=mini_snmpd + VARIANT:=16 + CONFLICTS:=mini_snmpd-52 +endef + +define Package/mini_snmpd-52 + $(call Package/mini_snmpd) + TITLE+= (52 ports) + PROVIDES:=mini_snmpd + VARIANT:=52 + CONFLICTS:= endef CONFIGURE_ARGS+= \ @@ -49,6 +67,10 @@ CONFIGURE_ARGS+= \ # --disable-debug \ # --disable-demo - Upstream Github Issue #4 Fixed 20160707 +ifneq ($(BUILD_VARIANT),default) + CONFIGURE_ARGS += --with-interfaces=$(BUILD_VARIANT) +endif + define Package/mini_snmpd/install $(INSTALL_DIR) $(1)/usr/sbin $(CP) $(PKG_INSTALL_DIR)/usr/sbin/mini-snmpd $(1)/usr/sbin @@ -58,8 +80,16 @@ define Package/mini_snmpd/install $(INSTALL_BIN) ./files/mini_snmpd.init $(1)/etc/init.d/mini_snmpd endef +Package/mini_snmpd-16/install=$(Package/mini_snmpd/install) +Package/mini_snmpd-52/install=$(Package/mini_snmpd/install) + define Package/mini_snmpd/conffiles /etc/config/mini_snmpd endef +Package/mini_snmpd-16/conffiles=$(Package/mini_snmpd/conffiles) +Package/mini_snmpd-52/conffiles=$(Package/mini_snmpd/conffiles) + $(eval $(call BuildPackage,mini_snmpd)) +$(eval $(call BuildPackage,mini_snmpd-16)) +$(eval $(call BuildPackage,mini_snmpd-52)) diff --git a/net/mini_snmpd/patches/0001-make-MAX_NR_INTERFACES-configurable.patch b/net/mini_snmpd/patches/0001-make-MAX_NR_INTERFACES-configurable.patch new file mode 100644 index 0000000000..fb85060e84 --- /dev/null +++ b/net/mini_snmpd/patches/0001-make-MAX_NR_INTERFACES-configurable.patch @@ -0,0 +1,70 @@ +From 60e685bd74bca45a4be9528d97f5a2edcc954e7f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= +Date: Thu, 22 Sep 2022 11:49:42 +0200 +Subject: [PATCH] make MAX_NR_INTERFACES configurable +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Bjørn Mork +--- + configure.ac | 9 +++++++++ + mini-snmpd.h | 1 - + 2 files changed, 9 insertions(+), 1 deletion(-) + +--- a/configure.ac ++++ b/configure.ac +@@ -40,6 +40,10 @@ AC_ARG_WITH(systemd, + [AS_HELP_STRING([--with-systemd=DIR], [Directory for systemd service files])],, + [with_systemd=auto]) + ++AC_ARG_WITH(interfaces, ++ AS_HELP_STRING([--with-interfaces=NUM], [Support NUM interfaces, default: 8]), ++ [with_interfaces=$withval], [with_interfaces="8"]) ++ + 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]) + ++ + ### 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"], [ + PKG_CHECK_MODULES([confuse], [libconfuse >= 2.7])]) + AM_CONDITIONAL([HAVE_CONFUSE], [test "x$with_config" != "xno"]) + ++AC_DEFINE_UNQUOTED(MAX_NR_INTERFACES, $with_interfaces, [Max Number of Interfaces]) ++ + 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.])]) + ++ + # 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 <