Hello Joe.

On 27 April 2010 17:58, Joseph Mack NA3T <[email protected]> wrote:
> On Tue, 27 Apr 2010, Mark Brooks wrote:
>> Does anyone still maintain the LVS SNMP module
> I forget the original author, and the code has been passed
> from one person to another. If it needs fixing, you'll
> probably have to do it yourself. If you do make changes, can
> you pass them along to at least me, so that they're
> available for the next person?

Attached is a patch for the LVS net-snmp module which appears to fix
the memory leak we were seeing. It's still under test, but results
look good so far.

It's a very simple fix, but in testing we were seeing 400 bytes lost
per snmpwalk.

There's another memory leak in net-snmp v5.5 itself - that's fixed by
applying this patch:
   
http://sourceforge.net/tracker/index.php?func=detail&aid=2871747&group_id=12694&atid=312694

Nick.

-- 
Nick Chalk.

Loadbalancer.org Ltd.
Phone: +44 (0)870 443 8779
http://www.loadbalancer.org/
diff -ur --exclude=libipvs net-snmp-lvs-module-0.0.4/lvs.c net-snmp-lvs-module-0.0.4-leak_fix/lvs.c
--- net-snmp-lvs-module-0.0.4/lvs.c	2006-01-02 14:31:54.000000000 +0000
+++ net-snmp-lvs-module-0.0.4-leak_fix/lvs.c	2010-05-13 13:54:00.000000000 +0100
@@ -37,6 +37,7 @@
 static struct ip_vs_daemon_user* ipvs_daemon;
 static struct Destination* ipvs_destination;
 static time_t last_setup;
+static struct ip_vs_get_dests* sentry;
 
 static
 void setup_snmp_ipvs(void)
@@ -44,7 +45,6 @@
 	int s, d;
 	struct Destination* mydestprev = NULL;
 	struct Destination* mydest = ipvs_destination;
-	struct ip_vs_get_dests* sentry;
 	
 	time(&last_setup);
 	if (ipvs_services) {
@@ -70,6 +70,11 @@
 		SNMP_FREE(mydestprev);
 	}
 	mydestprev = NULL;
+
+	/* NRC, 2010-05-13: Free old sentry structure... */
+	if (sentry)
+		free(sentry);
+
 	for (s = 0; s<ipvs_services->num_services; s++) {
 		sentry = ipvs_get_dests(&ipvs_services->entrytable[s]);
 		for (d = 0; d<sentry->num_dests; d++) {
diff -ur --exclude=libipvs net-snmp-lvs-module-0.0.4/Makefile net-snmp-lvs-module-0.0.4-leak_fix/Makefile
--- net-snmp-lvs-module-0.0.4/Makefile	2006-03-02 09:14:56.000000000 +0000
+++ net-snmp-lvs-module-0.0.4-leak_fix/Makefile	2010-05-07 10:37:12.000000000 +0100
@@ -3,7 +3,7 @@
 VERSDIR := $(NAME)-$(VERSION)
 TARFILE := $(NAME)-$(VERSION).tar.gz
 CC := gcc 
-CFLAGS := `net-snmp-config --cflags` -Ilibipvs -I/usr/src/linux/include -Wall -g
+CFLAGS := `net-snmp-config --cflags` -Ilibipvs -I/usr/src/linux/include -Wall -g -fPIC
 DEFINES := -DHAVE_NET_IP_VS_H
 DLFLAGS := -fPIC -shared -g
 LIBS := `net-snmp-config --netsnmp-libs`
_______________________________________________
Please read the documentation before posting - it's available at:
http://www.linuxvirtualserver.org/

LinuxVirtualServer.org mailing list - [email protected]
Send requests to [email protected]
or go to http://lists.graemef.net/mailman/listinfo/lvs-users

Reply via email to