Hi. I'm trying to develop a snmp sub-agent, and one of its missions is to send informs to a Network Management System when an alarm/warning occurs in our device.
I've found that when the first inform is not 'aknowledged' by the trap receiving system (after 5 retries), the agent doesn't send any inform to it anymore.  After that, this message appears in the log everytime a new inform need to be sent: "snmpd: send_trap: USM unknown security name (no such user exists)"
After digging deeply into the code I've found that the agent only tries to discover the peer engineID once per 'session':
send_v2trap -> send_trap_vars -> send_enterprise_trap_vars -> netsnmp_send_traps -> send_trap_to sess -> snmp_async_send -> snmp_sess_async_send -> _sess_async_send   calls to snmpv3_engineID_probe.  This function sets the session->flags SNMP_FLAGS_DONT_PROBE to prevent recursion... but if the remote engine doesn't answer, this flag remains set.  And, later, if a new inform needs to be sent the agent doesn't retry to obtain the engineID again.

I've detected this behaviour using net-snmp versions 5.3.0.1 and 5.3.1 libraries in a subagent module through agentx (SNMPV3) running on Linux.
Is this behaviour correct?  Shouldn't the agent keep trying to obtain the engineID of the receiver if the previous communication failed?

To correct this I've done the following modification (turn off the flag SNMP_FLAG_DONT_PROBE if we have no answer) in function snmpv3_engineID_probe in snmplib/snmp_api.c

            if (slp->session->securityEngineIDLen == 0) {
                DEBUGMSGTL(("snmp_api",
                            "unable to determine remote engine ID\n"));
            session->flags &= ~SNMP_FLAGS_DONT_PROBE; /* EBP */
                return 0;
            }

But this modification provoques two effects: 1) the engineID is requested for every inform while we have no answer from the receiver (OK ;)))).
2)The informs are repeated a lot of times when the receiver acknowledge them (BAD!!!).

My snmpd.conf ...
createUser snmp_usr MD5 snmp_pass
trapsess -C i -v 3 -u snmp_usr -a MD5 -A snmp_pass -l authNoPriv 172.16.2.5:162

Any comments would be appreciated..
Thanks in advance.
Enric.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to