This is a multi-part message in MIME format.


--===============1289978209==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C808C6.BBF7C830"

This is a multi-part message in MIME format.


------_=_NextPart_001_01C808C6.BBF7C830
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hello all=20
=20
I've encounter with memory leak and unclose sockets in the snmp agent
-Net-SNMP version 5.3.1:
=20
scenarios:

* for each HUP signal sent to the agent ( for configuration
update) while in the snmpd.conf include trap directive (
v1 or v2 ). for example "trap2sink 64.103.31.141:162 ggg" there are two
problems :there is memory leak in the agent and new sockets are opened
for each HUP signal. I've succeeded to eliminate opening of the sockets
by simply not register the snmpNotifyTable the problem is cause due to
this code - the open sockets are not closed in the callbacks ( when i've
not register the the snmpNotifyTable the else was operated).

int
add_trap_session(netsnmp_session * ss, int pdutype, int confirm,
int version)
{
if (snmp_callback_available(SNMP_CALLBACK_APPLICATION ,
SNMPD_CALLBACK_REGISTER_NOTIFICATIONS)
=3D=3D
SNMPERR_SUCCESS) {
/*
* something else wants to handle notification registrations=20
*/
struct agent_add_trap_args args;
DEBUGMSGTL(("trap", "adding callback trap sink\n"));
args.ss =3D ss;
args.confirm =3D confirm;
snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
SNMPD_CALLBACK_REGISTER_NOTIFICATIONS,
(void *) &args);
} else {
/*
* no other support exists, handle it ourselves.=20
*/
struct trap_sink *new_sink;
=20
DEBUGMSGTL(("trap", "adding internal trap sink\n"));
new_sink =3D (struct trap_sink *) malloc(sizeof(*new_sink));
if (new_sink =3D=3D NULL)
return 0;
=20
new_sink->sesp =3D ss;
new_sink->pdutype =3D pdutype;
new_sink->version =3D version;
new_sink->next =3D sinks;
sinks =3D new_sink;
}
return 1;
}
=20