[Buildroot] [git commit] package/mini-snmpd: enable optional .conf and ethtool support

Julien Olivain via buildroot <[email protected]>
Newsgroups net.busybox.buildroot
Message-ID <[email protected]>
commit: https://gitlab.com/buildroot.org/buildroot/-/commit/8aca1f26c103043e5a542eb5713235e760ef320c
branch: https://gitlab.com/buildroot.org/buildroot/-/tree/master

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

Signed-off-by: Joachim Wiberg <[email protected]>
Signed-off-by: Julien Olivain <[email protected]>
---
 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(-)

diff --git a/package/mini-snmpd/Config.in b/package/mini-snmpd/Config.in
index 1f61cddbcf..de83944528 100644
--- a/package/mini-snmpd/Config.in
+++ b/package/mini-snmpd/Config.in
@@ -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
diff --git a/package/mini-snmpd/mini-snmpd.conf b/package/mini-snmpd/mini-snmpd.conf
new file mode 100644
index 0000000000..4679a8e43d
--- /dev/null
+++ b/package/mini-snmpd/mini-snmpd.conf
@@ -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
+#}
diff --git a/package/mini-snmpd/mini-snmpd.mk b/package/mini-snmpd/mini-snmpd.mk
index 99bef47477..9873ad2dee 100644
--- a/package/mini-snmpd/mini-snmpd.mk
+++ b/package/mini-snmpd/mini-snmpd.mk
@@ -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 \
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.