SNMPv3 trap problem with snmp++v3.1.4a

Jochen Katz katz____agentpp.com
Thu Nov 29 22:01:05 CET 2001


Hi,

> I have just upgraded to the latest versions of snmp++ and agent++ and I have
> a problem with SNMPv3 traps (my agent which used to work just fine with
> agent++ v3.4.7 and snmp++ v3.1.3 quit sending v3 traps - or rather it keeps
> sending them, but they are not received by my trap receiver any more).

> [lukasz at aveta consoleExamples]$ ./snmpTraps localhost -p10162 -v3 -snMD5DES
> -md5 -uaMD5DESUserAuthPassword -des -upMD5DESUserPrivPassword

> This command returned success, but the trap never showed as received by
> receive_trap.  I compiled snmp++ with debugging, and this is what
> receive_trap reported:
> mp: received request message with zero length contextEngineID ->
> unknownPduHandlers.
> 
> What's going on here?

SNMPv3 pdus must have the contextEngineId set. Otherwise the above error
has to be generated and the pdu must be dropped. 
As snmp++v3.1.4a does not set the contextEngineId for traps, this trap
is dropped :-(

Solution: Apply the patch below to the method Snmp::trap() in
uxsnmp.cpp.

Kind regards,
  Jochen

--- uxsnmp.with_bug     Thu Nov 15 23:14:31 2001
+++ uxsnmp.cpp  Thu Nov 29 21:46:26 2001
@@ -1081,6 +1081,14 @@
       return SNMP_CLASS_INVALID_TARGET;
     }
 
+    // set context_engine_id of pdu, if it is not set
+    if (pdu.get_context_engine_id().len() == 0)
+    {
+      debugprintf(8, "Setting contextEngineID of Pdu to (%s)",
+                  engine_id.get_printable());
+      pdu.set_context_engine_id(engine_id);
+    }
+
     debugprintf(4,"Snmp::trap:");
     debugprintf(4," engineID (%s), securityName (%s)\n securityModel
(%i) security_level (%i)",
                engine_id.get_printable(),
security_name.get_printable(),



More information about the AGENTPP mailing list