commit 5081551ae8700cc61ff3d92d0ea830530597646d
parent 29dcb9c897619d62b093fb41447be375b25e49c6
Author: Stijn Tintel <stijn@linux-ipv6.be>
Date: Tue, 14 Feb 2017 14:46:23 +0100
net-snmp: add engineID config options
According to the snmpd.conf man page, the engineID of an snmp agent
should be consistent through time. However, it seems that the engineID
changes every reboot. Add options to configure how the engineID is
generated. The default setting generates it based on the MAC address of
the eth0 interface.
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Diffstat:
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/net/net-snmp/Makefile b/net/net-snmp/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=net-snmp
PKG_VERSION:=5.7.3
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/net-snmp
diff --git a/net/net-snmp/files/snmpd.conf b/net/net-snmp/files/snmpd.conf
@@ -83,3 +83,7 @@ config exec
option args /proc/sys/fs/file-nr
# option miboid 1.2.3.4
+config engineid
+# option engineid 'LEDE'
+ option engineidtype '3'
+ option engineidnic 'eth0'
diff --git a/net/net-snmp/files/snmpd.init b/net/net-snmp/files/snmpd.init
@@ -198,6 +198,18 @@ snmpd_disk_add() {
echo "$disk $partition $size" >> $CONFIGFILE
}
+snmpd_engineid_add() {
+ local cfg="$1"
+
+ config_get engineid "$cfg" engineid
+ [ -n "$engineid" ] && echo "engineID $engineid" >> $CONFIGFILE
+ config_get engineidtype "$cfg" engineidtype
+ [ "$engineidtype" -ge 1 -a "$engineidtype" -le 3 ] && \
+ echo "engineIDType $engineidtype" >> $CONFIGFILE
+ config_get engineidnic "$cfg" engineidnic
+ [ -n "$engineidnic" ] && echo "engineIDNic $engineidnic" >> $CONFIGFILE
+}
+
start_service() {
[ -f "$CONFIGFILE" ] && rm -f "$CONFIGFILE"
@@ -221,6 +233,7 @@ start_service() {
config_foreach snmpd_pass_add pass
config_foreach snmpd_exec_add exec
config_foreach snmpd_disk_add disk
+ config_foreach snmpd_engineid_add engineid
procd_set_param command $PROG -Lf /dev/null -f
procd_set_param file $CONFIGFILE