I'm working on a subagent snmp application here, and found that the standard 
build of
net-snmp's snmpd (not the mini-snmpd) doesn't include agentx support at all, 
nor TCP.

I'd really like to see this enabled across the board, if I wanted to have a 
really small
snmpd, I could use mini-snmpd, but if I've chosen the full net-snmp package, 
I'd like to
have it mostly functional :)

Of course, this does make it marginally bigger, but is that really a problem?
Also, should the agentx support be enabled by default or not?

Cheers,
Karl Palsson



>From 5620f5c1b42bfdf408f57acd1ddf5e46a0e5394e Mon Sep 17 00:00:00 2001
From: Karl Palsson <ka...@remake.is>
Date: Thu, 3 Apr 2014 21:21:46 +0000
Subject: [PATCH] net-snmp: Include support for agentx

agentx is the recommended method for operating sub-agents, but was not
enabled in the default build.  agentx also requires TCP support to be
enabled.

Included updates to the init script to handle agentx config and turned
it on by default.
Included the snmptable utility as well.

Signed-off-by: Karl Palsson <ka...@remake.is>
---
 net/net-snmp/Makefile         | 10 ++++------
 net/net-snmp/files/snmpd.conf |  3 +++
 net/net-snmp/files/snmpd.init | 10 ++++++++++
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/net/net-snmp/Makefile b/net/net-snmp/Makefile
index 551180a..78d20b4 100644
--- a/net/net-snmp/Makefile
+++ b/net/net-snmp/Makefile
@@ -128,8 +128,6 @@ SNMP_MIB_MODULES_INCLUDED = \
        utilities/execute \
 
 SNMP_MIB_MODULES_EXCLUDED = \
-       agent_mibs \
-       agentx \
        disman/event \
        disman/schedule \
        hardware \
@@ -145,9 +143,9 @@ SNMP_MIB_MODULES_EXCLUDED = \
        udp-mib \
        utilities \
 
-SNMP_TRANSPORTS_INCLUDED = Callback UDP
+SNMP_TRANSPORTS_INCLUDED = Callback UDP TCP
 
-SNMP_TRANSPORTS_EXCLUDED = TCP TCPIPv6 Unix
+SNMP_TRANSPORTS_EXCLUDED = Unix
 
 TARGET_CFLAGS += $(FPIC)
 
@@ -177,7 +175,7 @@ CONFIGURE_ARGS += \
         $(call autoconf_bool,CONFIG_IPV6,ipv6) \
 
 ifeq ($(CONFIG_IPV6),y)
-SNMP_TRANSPORTS_INCLUDED+= UDPIPv6
+SNMP_TRANSPORTS_INCLUDED+= UDPIPv6 TCPIPv6
 endif
 
 TARGET_LDFLAGS += -L$(TOOLCHAIN_DIR)/usr/lib
@@ -253,7 +251,7 @@ endef
 
 define Package/snmp-utils/install
        $(INSTALL_DIR) $(1)/usr/bin
-       $(INSTALL_BIN) 
$(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/
+       $(INSTALL_BIN) 
$(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,table,test,trap,walk} 
$(1)/usr/bin/
 endef
 
 $(eval $(call BuildPackage,libnetsnmp))
diff --git a/net/net-snmp/files/snmpd.conf b/net/net-snmp/files/snmpd.conf
index 4bdc3d4..70eac11 100644
--- a/net/net-snmp/files/snmpd.conf
+++ b/net/net-snmp/files/snmpd.conf
@@ -1,6 +1,9 @@
 config agent
        option agentaddress UDP:161
 
+config agentx
+        option agentxsocket tcp:705
+
 config com2sec public
        option secname ro
        option source default
diff --git a/net/net-snmp/files/snmpd.init b/net/net-snmp/files/snmpd.init
index a89d082..e6b5dbf 100644
--- a/net/net-snmp/files/snmpd.init
+++ b/net/net-snmp/files/snmpd.init
@@ -16,6 +16,15 @@ snmpd_agent_add() {
        [ -n "$agentaddress" ] || return 0
        echo "agentaddress $agentaddress" >> $RUN_C
 }
+
+snmpd_agentx_add() {
+        local cfg="$1"
+        config_get agentxsocket "$cfg" agentxsocket
+        [ -n "$agentxsocket" ] || return 0
+        echo "master agentx" >> $RUN_C
+        echo "agentxsocket $agentxsocket" >> $RUN_C
+}
+
 snmpd_system_add() {
        local cfg="$1"
        config_get syslocation "$cfg" sysLocation
@@ -128,6 +137,7 @@ start() {
        config_load snmpd
 
        config_foreach snmpd_agent_add agent
+       config_foreach snmpd_agentx_add agentx
        config_foreach snmpd_system_add system
        config_foreach snmpd_com2sec_add com2sec
        config_foreach snmpd_com2sec6_add com2sec6
-- 
1.8.3.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to