[PATCH] Read SNMP config

Serj Kalichev <[email protected]>
Newsgroups gmane.linux.keepalived.devel
Message-ID <[email protected]>
Current keepalive version set NETSNMP_DS_LIB_DONT_PERSIST_STATE flag
for SNMP subagent. It disables persistent state read, write and config
file read. It's not good.

I use /etc/snmp/VRRP.conf config file to set agentXSocket option. I use
Unix sockets for agentx connection. But when agentXSocket is not
set then keepalive_vrrp try to connect to net-snmp over TCP socket on
localhost:161. I want to disable it but can't because subagent doesn't
read config file.

This patch removes NETSNMP_DS_LIB_DONT_PERSIST_STATE but adds
NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD and
NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE flags to disable
persistent state but enable config file reading.

Signed-off-by: Serj Kalichev <[email protected]>
---
 keepalived/core/snmp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/keepalived/core/snmp.c b/keepalived/core/snmp.c
index 3299985..ae278c6 100644
--- a/keepalived/core/snmp.c
+++ b/keepalived/core/snmp.c
@@ -215,7 +215,9 @@ snmp_agent_init(oid *myoid, int len, char *name, struct variable *variables,
 
 	/* Do not handle persistent states */
 	netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
-	    NETSNMP_DS_LIB_DONT_PERSIST_STATE, TRUE);
+	    NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD, TRUE);
+	netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
+	    NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE, TRUE);
 	/* Do not load any MIB */
 	setenv("MIBS", "", 1);
 	/* We also register a callback to modify default timeout and
-- 
1.8.1.2


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
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.