Hello all 
 
I've encounter with memory leak and unclose sockets in the snmp agent
-Net-SNMP version 5.3.1:
 
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)
==
        SNMPERR_SUCCESS) {
        /*
         * something else wants to handle notification registrations 
         */
        struct agent_add_trap_args args;
        DEBUGMSGTL(("trap", "adding callback trap sink\n"));
        args.ss = ss;
        args.confirm = confirm;
        snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
                            SNMPD_CALLBACK_REGISTER_NOTIFICATIONS,
                            (void *) &args);
    } else {
        /*
         * no other support exists, handle it ourselves. 
         */
        struct trap_sink *new_sink;
 
        DEBUGMSGTL(("trap", "adding internal trap sink\n"));
        new_sink = (struct trap_sink *) malloc(sizeof(*new_sink));
        if (new_sink == NULL)
            return 0;
 
        new_sink->sesp = ss;
        new_sink->pdutype = pdutype;
        new_sink->version = version;
        new_sink->next = sinks;
        sinks = new_sink;
    }
    return 1;
}
 
 .

*       for each Trap sent by the agent there is memory leak  ( trap
version v1 or v2)

 
 
There is known patch for this issue ?
 
Thanks
 
Kobi
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to