SNMPv2 traps and Snmp::notify_register ??

Corrado Giacomini c.giacomini____acresearch.com
Wed Nov 8 09:23:45 CET 2000


I need to set a  filter for incoming SNMv2 Traps.
I have  registered  my trap oids  in the following way :

OidCollection oidc;
oidc += Oid(IC_HW_ALERT_OID);
oidc += Oid(IC_SW_ALERT_OID);
oidc += Oid(IC_ADMIN_ALERT_OID);
 ...
status = snmp.notify_register(oidc, targetc, callback, NULL);
The filter doesn't  work !!

 I had a look of the SNMP++ code and I notice the following things:

 1) When I   prepare an snmpv2 trap using SNMP++  I set  the attribute
"Oid notify_id"  of the Pdu  with the trap OID.

  2) The snmpmsg::load method then,   when  preparing a snmp_pdu  for a
snmpv2 trap,   put the notify_id contents in the varbind list as well as
the
sysuptime  by doing the follow:

      // vb #2 is the id
      Oid trapid;
      tempvb.set_oid("1.3.6.1.6.3.1.1.4.1.0");
      pdu.get_notify_id( trapid);
      tempvb.set_value( trapid);
      temppdu += tempvb;

     the snmp_pdu is then  sent

3) when the trap is received  by my snmptrapd the snmpmsg::unload method

is called to convert a snmp_pdu to a Pdu object..
Here the "notify_id" is not  assigned to the
value of the trap Oid contained in the varbind list.

4) the CNotifyEvent::notify_filter method now compare the Oids in my
OidCollection  with the "notify_id"  in Pdu object
which is been been assigned so the filter always fail.

Is this a Bug or there is a reason for this ??

-Corrado






More information about the AGENTPP mailing list