net-snmp: fix service not restarting on config change
authorMichael Pfeifroth <redacted>
Thu, 28 May 2026 09:10:11 +0000 (11:10 +0200)
committerStijn Tintel <redacted>
Tue, 16 Jun 2026 08:36:52 +0000 (11:36 +0300)
snmpd generates its runtime configuration in /var/run/snmpd.conf from
UCI during start_service(). However, since the procd instance command
line never changes, procd does not detect that a restart is needed when
the UCI config is modified.

Add 'procd_set_param file /etc/config/snmpd' so procd tracks the config
file and restarts snmpd when it changes. Without this, 'reload_service'
(triggered by procd_add_reload_trigger) re-creates an identical instance
definition and procd skips the restart, leaving stale configuration
active.

This also fixes a usability issue with SNMPv3: when changing a user's
authentication or privacy algorithm, net-snmp must restart to re-derive
localized keys via createUser. Without the restart, the daemon keeps
using cached key material and authentication fails.

Tested with net-snmp 5.9.4 on OpenWrt (aarch64 and ppc64).

Signed-off-by: Michael Pfeifroth <redacted>
net/net-snmp/Makefile
net/net-snmp/files/snmpd.init

index 319c5d065dce0349116df62d78c104c4d47eef1b..cc421d1072ecbaba6bb0a8fbb150af6b13caec80 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=net-snmp
 PKG_VERSION:=5.9.4
-PKG_RELEASE:=9
+PKG_RELEASE:=10
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@SF/net-snmp
index 78a62a5603fa127f5e5ef825342b96a144933752..4e3db12effca0485815d09f2631e121f9b287522 100644 (file)
@@ -455,6 +455,7 @@ start_service() {
        procd_append_param command -C -c "$CONFIGFILE"
        config_foreach snmpd_configure_logging log
        procd_set_param respawn
+       procd_set_param file /etc/config/snmpd
 
        for iface in $(ls /sys/class/net 2>/dev/null); do
                procd_append_param netdev "$iface"
git clone https://git.99rst.org/PROJECT