Skip to contentSkip to conversation

mini-snmpd: bump and housekeeping

PATCH Applied Joachim Wiberg 3 participants 7 messages Jul 6 – Aug 14

lore
Share & tools
lore
#0 lore raw

cover mini-snmpd: bump and housekeeping

This is a major update of mini-snmpd, see below for links to upstream relase notes. The intermediate v1.7 release turned out to be buggy, so we update to v2.0 directly.

For buildroot, integration with libconfuse and ethtool, as well as an init script was added, with the benefit of also fixing use in systemd based systems.

Best regards
/Joachim

Joachim Wiberg (3):
package/mini-snmpd: bump to version 2.0 package/mini-snmpd: add sysv init script package/mini-snmpd: enable optional .conf and ethtool support

 .../0001-linux.c-fix-musl-build.patch         | 46 ----------------
 package/mini-snmpd/Config.in                  | 17 +++++-
 package/mini-snmpd/S60mini-snmpd              | 52 +++++++++++++++++++
 package/mini-snmpd/mini-snmpd                 |  2 +-
 package/mini-snmpd/mini-snmpd.conf            | 36 +++++++++++++
 package/mini-snmpd/mini-snmpd.hash            |  3 +-
 package/mini-snmpd/mini-snmpd.mk              | 29 +++++++++--
 7 files changed, 133 insertions(+), 52 deletions(-)
 delete mode 100644 package/mini-snmpd/0001-linux.c-fix-musl-build.patch
 create mode 100644 package/mini-snmpd/S60mini-snmpd
 create mode 100644 package/mini-snmpd/mini-snmpd.conf
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 1/3 package/mini-snmpd: bump to version 2.0

This bumps from v1.6 directly to v2.0, for details, please see:

- https://github.com/troglobit/mini-snmpd/releases/tag/v1.7
- https://github.com/troglobit/mini-snmpd/releases/tag/v2.0

The release tarball is the canonical supported source for the project and also ships a pre-generated configure script, hence the switch.

---
 .../0001-linux.c-fix-musl-build.patch         | 46 -------------------
 package/mini-snmpd/mini-snmpd.hash            |  3 +-
 package/mini-snmpd/mini-snmpd.mk              |  5 +-
 3 files changed, 4 insertions(+), 50 deletions(-)
 delete mode 100644 package/mini-snmpd/0001-linux.c-fix-musl-build.patch
package/mini-snmpd/0001-linux.c-fix-musl-build.patch deleted +0 -46
deleted file mode 100644
index 8e8bb090fd..0000000000
@@ -1,46 +0,0 @@
-From 73fa408f51ec25121075aaccac9c9db1c68567cd Mon Sep 17 00:00:00 2001
-From: Fabrice Fontaine <[email protected]>
-Date: Thu, 12 Mar 2020 10:02:18 +0100
-Subject: [PATCH] linux.c: fix musl build
-
-Remove include on linux/if_link.h to avoid the following build failure
-with musl:
-
-In file included from /home/buildroot/autobuild/instance-2/output-1/host/i586-buildroot-linux-musl/sysroot/usr/include/linux/kernel.h:4,
-                 from /home/buildroot/autobuild/instance-2/output-1/host/i586-buildroot-linux-musl/sysroot/usr/include/linux/netlink.h:4,
-                 from /home/buildroot/autobuild/instance-2/output-1/host/i586-buildroot-linux-musl/sysroot/usr/include/linux/if_link.h:5,
-                 from linux.c:21:
-/home/buildroot/autobuild/instance-2/output-1/host/i586-buildroot-linux-musl/sysroot/usr/include/linux/sysinfo.h:7:8: error: redefinition of 'struct sysinfo'
- struct sysinfo {
-        ^~~~~~~
-In file included from linux.c:19:
-/home/buildroot/autobuild/instance-2/output-1/host/i586-buildroot-linux-musl/sysroot/usr/include/sys/sysinfo.h:10:8: note: originally defined here
- struct sysinfo {
-        ^~~~~~~
-  CC       mini_snmpd-globals.o
-
-Fixes:
- - http://autobuild.buildroot.org/results/6903a0f685076b4a2c2824de6158da40e9e712d8
-
-Signed-off-by: Fabrice Fontaine <[email protected]>
-[Retrieved from:
-https://github.com/troglobit/mini-snmpd/commit/73fa408f51ec25121075aaccac9c9db1c68567cd]
----
- linux.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/linux.c b/linux.c
-index a657912..86a7085 100644
---- a/linux.c
-+++ b/linux.c
-@@ -18,7 +18,6 @@
- #include <netpacket/packet.h>
- #include <sys/sysinfo.h>
- #include <sys/socket.h>
--#include <linux/if_link.h>
- #include <sys/ioctl.h>
- #include <sys/types.h>
- #include <sys/time.h>
--- 
-2.25.1
-
package/mini-snmpd/mini-snmpd.hash +2 -1
index fee76c07a3..d1e8f51f8e 100644
@@ -1,3 +1,4 @@
+# sha256 from https://github.com/troglobit/mini-snmpd/releases/tag/v2.0
+sha256  851acf49a1a36356664af0a7a040fa31f75403eb26e03627eba188ee15d4854c  mini-snmpd-2.0.tar.gz
 # Locally calculated
-sha256  de00c475a3c70c56f3ee97cd683cb71009d3521d60b1f589c5a91b4671ede9f3  mini-snmpd-1.6.tar.gz
 sha256  8a43b895972a24567297f44f35dab0f5f9ed3b7db6dac0bf6094075b27ab9d56  COPYING
package/mini-snmpd/mini-snmpd.mk +2 -3
index 1f6e5c1919..89eca4ce79 100644
@@ -4,13 +4,12 @@
 #
 ################################################################################
 
-MINI_SNMPD_VERSION = 1.6
-MINI_SNMPD_SITE = $(call github,troglobit,mini-snmpd,v$(MINI_SNMPD_VERSION))
+MINI_SNMPD_VERSION = 2.0
+MINI_SNMPD_SITE = https://github.com/troglobit/mini-snmpd/releases/download/v$(MINI_SNMPD_VERSION)
 MINI_SNMPD_LICENSE = GPL-2.0
 MINI_SNMPD_LICENSE_FILES = COPYING
 MINI_SNMPD_CPE_ID_VENDOR = minisnmpd_project
 MINI_SNMPD_CPE_ID_PRODUCT = minisnmpd
-MINI_SNMPD_AUTORECONF = YES
 MINI_SNMPD_DEPENDENCIES = host-pkgconf
 
 define MINI_SNMPD_INSTALL_ETC_DEFAULT
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 1/3] package/mini-snmpd: bump to version 2.0

Quoted 9 lines · Joachim Wiberg

This bumps from v1.6 directly to v2.0, for details, please see:

- https://github.com/troglobit/mini-snmpd/releases/tag/v1.7
- https://github.com/troglobit/mini-snmpd/releases/tag/v2.0

The release tarball is the canonical supported source for the project and also ships a pre-generated configure script, hence the switch.

Series applied to master, thanks.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

PATCH 2/3 package/mini-snmpd: add sysv init script

In reply to Joachim Wiberg

A start script has been missing since the package was added, so the daemon was not started automatically on sysv/busybox systems.

This also fixes a regression in systemd builds introduced in fccdc6bd, when the package switched from local unit file to upstream.

---
 package/mini-snmpd/S60mini-snmpd | 52 ++++++++++++++++++++++++++++++++
 package/mini-snmpd/mini-snmpd    |  2 +-
 package/mini-snmpd/mini-snmpd.mk |  5 +++
 3 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100644 package/mini-snmpd/S60mini-snmpd
package/mini-snmpd/S60mini-snmpd new file +52 -0
new file mode 100644
index 0000000000..e7c61d7a85
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+DAEMON="mini-snmpd"
+PIDFILE="/var/run/$DAEMON.pid"
+
+DAEMON_OPTS=""
+
+# shellcheck source=/dev/null
+[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
+
+start() {
+	printf 'Starting %s: ' "$DAEMON"
+	# shellcheck disable=SC2086 # we need the word splitting
+	start-stop-daemon --start --quiet --pidfile "$PIDFILE" \
+		--exec "/usr/sbin/$DAEMON" -- $DAEMON_OPTS
+	status=$?
+	if [ "$status" -eq 0 ]; then
+		echo "OK"
+	else
+		echo "FAIL"
+	fi
+	return "$status"
+}
+
+stop() {
+	printf 'Stopping %s: ' "$DAEMON"
+	start-stop-daemon --stop --quiet --pidfile "$PIDFILE" \
+		--exec "/usr/sbin/$DAEMON"
+	status=$?
+	if [ "$status" -eq 0 ]; then
+		echo "OK"
+	else
+		echo "FAIL"
+	fi
+	return "$status"
+}
+
+restart() {
+	stop
+	start
+}
+
+case "$1" in
+	start|stop|restart)
+		"$1";;
+	reload)
+		# Restart, since there is no true "reload" feature.
+		restart;;
+	*)
+		echo "Usage: $0 {start|stop|restart|reload}"
+		exit 1
+esac
package/mini-snmpd/mini-snmpd +1 -1
index 0ca9901d58..371f57f15f 100644
@@ -1,2 +1,2 @@
 # Require client authentication, thus SNMP version 2c
-EXTRA_PARAMS=-a
+DAEMON_OPTS="-a -c public -s"
package/mini-snmpd/mini-snmpd.mk +5 -0
index 89eca4ce79..99bef47477 100644
@@ -19,4 +19,9 @@ endef
 
 MINI_SNMPD_POST_INSTALL_TARGET_HOOKS += MINI_SNMPD_INSTALL_ETC_DEFAULT
 
+define MINI_SNMPD_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 0755 package/mini-snmpd/S60mini-snmpd \
+		$(TARGET_DIR)/etc/init.d/S60mini-snmpd
+endef
+
 $(eval $(autotools-package))
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

Re: [Buildroot] [PATCH 2/3] package/mini-snmpd: add sysv init script

Quoted 7 lines · Joachim Wiberg

A start script has been missing since the package was added, so the daemon was not started automatically on sysv/busybox systems.

This also fixes a regression in systemd builds introduced in fccdc6bd, when the package switched from local unit file to upstream.

Applied to 2025.02.x and 2026.05.x, thanks !

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw

PATCH 3/3 package/mini-snmpd: enable optional .conf and ethtool support

In reply to Joachim Wiberg

Both libConfuse and ethtool support is relatively new features. Enable optional support for them, including an example /etc/mini-snmpd.conf

---
 package/mini-snmpd/Config.in       | 17 +++++++++++++-
 package/mini-snmpd/mini-snmpd.conf | 36 ++++++++++++++++++++++++++++++
 package/mini-snmpd/mini-snmpd.mk   | 19 ++++++++++++++++
 3 files changed, 71 insertions(+), 1 deletion(-)
 create mode 100644 package/mini-snmpd/mini-snmpd.conf
package/mini-snmpd/Config.in +16 -1
index 1f61cddbcf..de83944528 100644
@@ -4,4 +4,19 @@ config BR2_PACKAGE_MINI_SNMPD
 	  Mini SNMPd is a minimal implementation targeted at small or
 	  embedded UNIX systems with limited resources
 
-	  http://troglobit.com/mini-snmpd.html
+	  Enable BR2_PACKAGE_LIBCONFUSE for /etc/mini-snmpd.conf support
+	  with an example file.  Also enabling BR2_PACKAGE_ETHTOOL adds
+	  ethtool-based interface statistics.
+
+	  https://troglobit.com/mini-snmpd.html
+
+if BR2_PACKAGE_MINI_SNMPD
+
+config BR2_PACKAGE_MINI_SNMPD_INTERFACES
+	int "Number of network interfaces"
+	default 8
+	range 1 256
+	help
+	  Max number of network interfaces exposed in IF-MIB::ifTable
+
+endif
package/mini-snmpd/mini-snmpd.conf new file +36 -0
new file mode 100644
index 0000000000..4679a8e43d
@@ -0,0 +1,36 @@
+# Require client authentication (SNMP v2c)
+authentication = true
+community      = "public"
+
+# Descriptive MIB-II system.* values, shown by snmpwalk
+#location      = "Server room, rack 4"
+#contact       = "[email protected]"
+#description   = "Acme Gateway 3000"
+
+# Vendor OID tree (enterprises.*)
+#vendor        = ".1.3.6.1.4.1"
+
+# MIB poll timeout, seconds
+#timeout       = 1
+
+# Mount points to expose in UCD-SNMP-MIB::dskTable
+#disk-table    = { "/", "/var" }
+
+# Interfaces to expose in IF-MIB::ifTable
+#iface-table   = { "eth0", "eth1" }
+
+# SNMPv2 trap sinks
+#trap-table    = { "192.0.2.1", "[2001:db8::1]:1620" }
+
+# Emulate the respons of another device
+# custom ".1.3.6.1.4.1.11.2.3.9.1.1.7.0" {
+#    value = "MFG:Hewlett-Packard;MDL:HP LaserJet 1020;CLS:PRINTER;"
+#}
+
+# Map ethtool stats to IF-MIB counters:
+#ethtool "eth*" {
+#    rx_bytes   = ifInOctets
+#    rx_packets = ifInUcastPkts
+#    tx_bytes   = ifOutOctets
+#    tx_packets = ifOutUcastPkts
+#}
package/mini-snmpd/mini-snmpd.mk +19 -0
index 99bef47477..9873ad2dee 100644
@@ -11,6 +11,25 @@ MINI_SNMPD_LICENSE_FILES = COPYING
 MINI_SNMPD_CPE_ID_VENDOR = minisnmpd_project
 MINI_SNMPD_CPE_ID_PRODUCT = minisnmpd
 MINI_SNMPD_DEPENDENCIES = host-pkgconf
+MINI_SNMPD_CONF_OPTS = --with-interfaces=$(BR2_PACKAGE_MINI_SNMPD_INTERFACES)
+
+ifeq ($(BR2_PACKAGE_LIBCONFUSE),y)
+MINI_SNMPD_DEPENDENCIES += libconfuse
+MINI_SNMPD_CONF_OPTS += --with-config
+# ethtool interface stats live in linux_ethtool.c, only built with libConfuse
+ifeq ($(BR2_PACKAGE_ETHTOOL),y)
+MINI_SNMPD_CONF_OPTS += --enable-ethtool
+else
+MINI_SNMPD_CONF_OPTS += --disable-ethtool
+endif
+define MINI_SNMPD_INSTALL_CONFIG
+	$(INSTALL) -D -m 644 package/mini-snmpd/mini-snmpd.conf \
+		$(TARGET_DIR)/etc/mini-snmpd.conf
+endef
+MINI_SNMPD_POST_INSTALL_TARGET_HOOKS += MINI_SNMPD_INSTALL_CONFIG
+else
+MINI_SNMPD_CONF_OPTS += --without-config
+endif
 
 define MINI_SNMPD_INSTALL_ETC_DEFAULT
 	$(INSTALL) -D -m 644 package/mini-snmpd/mini-snmpd \
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Acked-by on the v1 series
#6 lore raw
In reply to Joachim Wiberg

Hi Joachim,

Quoted 7 lines · Joachim Wiberg

This is a major update of mini-snmpd, see below for links to upstream relase notes.  The intermediate v1.7 release turned out to be buggy, so we update to v2.0 directly.

For buildroot, integration with libconfuse and ethtool, as well as an init script was added, with the benefit of also fixing use in systemd based systems.

thanks a lot for this update!

Quoted 16 lines

Joachim Wiberg (3):
  package/mini-snmpd: bump to version 2.0 package/mini-snmpd: add sysv init script package/mini-snmpd: enable optional .conf and ethtool support

 .../0001-linux.c-fix-musl-build.patch         | 46 ---------------- package/mini-snmpd/Config.in                  | 17 +++++- package/mini-snmpd/S60mini-snmpd              | 52 +++++++++++++++++++ package/mini-snmpd/mini-snmpd                 |  2 +- package/mini-snmpd/mini-snmpd.conf            | 36 +++++++++++++ package/mini-snmpd/mini-snmpd.hash            |  3 +- package/mini-snmpd/mini-snmpd.mk              | 29 +++++++++--

 7 files changed, 133 insertions(+), 52 deletions(-)

 delete mode 100644 package/mini-snmpd/0001-linux.c-fix-musl-build.patch create mode 100644 package/mini-snmpd/S60mini-snmpd
 create mode 100644 package/mini-snmpd/mini-snmpd.conf

Signature · 5 lines
Alexander Sverdlin.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot