Illegal instruction when sending traps in v5.1.1

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 ...


Go Back   Usenet Forums > Networking and Network Related > SNMP Users

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-05-2005
cnelson@nycap.rr.com
 
Posts: n/a
Default Illegal instruction when sending traps in v5.1.1

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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:17 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0