This is a discussion on Illegal instruction when sending traps in v5.1.1 within the SNMP Users forums, part of the Networking and Network Related category; I wrote a few weeks ago about a problem I was having in send_v2trap(). I've narrowed it down but ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I wrote a few weeks ago about a problem I was having in send_v2trap().
I've narrowed it down but while I continue to research, I'd appreciate any feedback or insight members of this list have. In agent_trap.c, toward the end of netsnmp_send_traps(), I find: /* * Now loop through the list of trap sinks * and call the trap callback routines, * providing an appropriately formatted PDU in each case */ for (sink = sinks; sink; sink = sink->next) { if (sink->version == SNMP_VERSION_1) { send_trap_to_sess(sink->sesp, template_v1pdu); } else { template_v2pdu->command = sink->pdutype; send_trap_to_sess(sink->sesp, template_v2pdu); } } the last executable line in that (sending with template_v2pdu) is where my program crashes. I've already peppered this routine with: printf("%s:%d\n", __FILE__, __LINE__); to find this out. If I change that to printf("%s:%d, sink->version:%d\n", __FILE__, __LINE__, sink->version); between the for and the if, the value printed is 193. If sink->version is tested against SNMP_VERSION_1 (defined as 0 in include/net-snmp/library/snmp.h), I'd expect other legal values to be SNMP_VERSION_2c and SNMP_VERSION_3 (from the same include file). But 193 isn't listed at all, even as an illegal or unused value. Am I right about where this comes from, what expected values are? Granted that there's some problem elsewhere that puts this 193 where it oughtn't to be, might this bit of code be safer as: for (sink = sinks; sink; sink = sink->next) { switch (sink->version) { case SNMP_VERSION_1: send_trap_to_sess(sink->sesp, template_v1pdu); break; case SNMP_VERSION_2c: template_v2pdu->command = sink->pdutype; send_trap_to_sess(sink->sesp, template_v2pdu); break; default: // Log unexpected value } } Thanks for any feedback. Chris ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ 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/...net-snmp-users |