Incorrect Time Stamp in V1/V2 Traps

Mike Perler Mperler____ss7-link.com
Wed Feb 28 16:01:22 CET 2001


> > While testing SNMP traps, I noticed that when I send a V1 or V2 trap
using
> > the NotificationOriginator::generate function, the time stamp that is
sent
> > in the trap is incorrect. The generate function eventually calls the
> > Snmp::trap function. Instead of using sysUpTime, this function retrieves
the
> > current time, subtracts 946080000 seconds (30 years), and uses the
result as
> > the time stamp.
> 
> the problem here is, that the Snmp class does not know, how long the
> agent is running (the object could have been created only temporarily).
> So if the timestamp wasn't set by the application it uses the above
> method which should be ok for a timestamp.

That's fine.

> > I noticed that the NotificationOriginator::generate function does
retrieve
> > the value of sysUpTime and insert it into a PDU object, but that object
is
> > only used if _SNMPv3 is defined. I commented out this #define from both
> > config.h and agent++.h because I only want SNMPv2 support. Therefore,
the
> > generate function is calling SnmpRequest::process_trap, which is
building a
> > new PDU instead of using the one that it had already constructed.
> 
> The creation of the Pdu object should only occur if _SNMPv3 
> is defined.

That is not the case. It does define the Pdu object, even though it does not
use it.

> Does something speak against a
> 
>         pdu.set_notify_timestamp(sysUpTime::get());
> 
> before the line 
> 
>         pdu.set_notify_enterprise(enterprise);
> 
> in SnmpRequest::process_trap()?

No. The only things that SnmpRequest::process_trap() sets up in the pdu are
the variable bindings, the trap OID, and the enterprise OID. Should Agent++
be doing this?

Thank you,
Mike



More information about the AGENTPP mailing list