I realize this is a long shot, that I'm behind revisions, and all that
but have a little pity on me, please, I'm working with an old embedded
system.

Recently, I've seen a problem in send_v2trap() that's fairly easy to
reproduce (though with a sequence that's very specific to my system and
I don't know that I can generalize it; I'll work on that).  I'm using
Net-SNMP 5.1.1, cross-compiled from Intel to PPC Linux and calling
send_v2trap() results in an Illegal Instruction error.  The code looks like:

    oid objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
    size_t objid_snmptrap_len = OID_LENGTH(objid_snmptrap);

    // 0 overwritten below with 3 (down) or 4 (up)
    oid notification_oid[] = {1, 3, 6, 1, 6, 3, 1, 1, 5, 0 };
    size_t notification_oid_len = OID_LENGTH(notification_oid);

    oid ifindex_oid[] = { 1, 3, 6, 1, 2, 1, 2, 2, 1, 1 };
    size_t ifindex_oidlen = OID_LENGTH(ifindex_oid);
        
    netsnmp_variable_list *notification_vars = NULL;
    
    static int port;

    if (port->MAC_Operational)
        notification_oid[notification_oid_len-1] = 4; // Up
    else
        notification_oid[notification_oid_len-1] = 3; // Down

    /*
     * add in the trap definition object 
     */
    snmp_varlist_add_variable(&notification_vars,
                              objid_snmptrap, objid_snmptrap_len,
                              ASN_OBJECT_ID,
                              (u_char*)notification_oid,
                              notification_oid_len * sizeof(oid));

    /* and the interface number */
    port = port->portId;
    snmp_varlist_add_variable(&notification_vars,
                              ifindex_oid, ifindex_oidlen,
                              ASN_INTEGER,
                              (u_char*)&port,
                              sizeof(port));
    /*
     * send the trap out.  This will send it to all registered
     * receivers (see the "SETTING UP TRAP AND/OR INFORM
     * DESTINATIONS" section of the snmpd.conf manual page.  */
    send_v2trap(notification_vars);
    
I've peppered this with "printf("%s:%d\n", __FILE__, __LINE__)" and I
get to the line before send_v2trap() but never the line after.  I'll dig
into the code, put in more debugging, etc. but any Net-SNMP-unique
insight would be appreciated.  Thanks.

                                                   Chris


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
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/listinfo/net-snmp-users

Reply via email to