Hi Coders,

I have a mib that of the below structure. I have generated the C code using 
mib2c( scalar.conf and iterate.conf) and modified the hooks 
------------
| x.y.z  |
------------
     |
     +----- 1
           |----- 1.0 (scalar obj)
      |----- 2.0 ( scalar obj)
              |----- 3.0 ( scalar obj)
      |----- 4.0 ( scalar obj)
             +-------2 
      |-------1 ( Table not implemented)
     +-------3 
      |------ 1 ( Table implemented)
      |--------
snmpget works for the scalar objects and instances of table 3.1

Now when I do a snmpwalk/snmpgetnext on the table(x.y.z.3.1). My SNMP agent 
crashes with the following stack

#0  0x00414499 in sprint_realloc_integer () from /mysnmp/lib/libnetsnmp.so.8
#1  0x0041282e in sprint_realloc_by_type () from /mysnmp/lib/libnetsnmp.so.8
#2  0x00527d51 in table_helper_handler () from 
/mysnmp/lib/libnetsnmphelpers.so.8
#3  0x007ea81f in netsnmp_call_next_handler () from 
/mysnmp/lib/libnetsnmpagent.so.8
#4  0x0051b4b2 in netsnmp_bulk_to_next_helper () from 
/mysnmp/lib/libnetsnmphelpers.so.8
#5  0x007ea569 in netsnmp_call_handlers () from /mysnmp/lib/libnetsnmpagent.so.8
#6  0x007deb94 in handle_var_requests () from /mysnmp/lib/libnetsnmpagent.so.8
#7  0x007df7e7 in handle_pdu () from /mysnmp/lib/libnetsnmpagent.so.8
#8  0x007e096d in netsnmp_handle_request () from 
/mysnmp/lib/libnetsnmpagent.so.8
#9  0x007e0f50 in handle_snmp_packet () from /mysnmp/lib/libnetsnmpagent.so.8
#10 0x00433689 in _sess_process_packet () from /mysnmp/lib/libnetsnmp.so.8
#11 0x00434ba0 in _sess_read () from /mysnmp/lib/libnetsnmp.so.8
#12 0x00435639 in snmp_sess_read () from /mysnmp/lib/libnetsnmp.so.8
#13 0x004356b2 in snmp_read () from /mysnmp/lib/libnetsnmp.so.8

>From the debug traces I see, that my agent is trying a getnext on x.y.z.3.2 
I think my agent is not able to identify x.y.z.3.1. as a table. Also call does 
not seem to have reached my module.  
Am I missing some thing here?

initialize_table_myTable(void)
{
    static oid myTable_oid[] = {x,y,z,3,1};
    netsnmp_table_registration_info *table_info;
    netsnmp_handler_registration *my_handler;
    netsnmp_iterator_info *iinfo;

    /* create the table structure itself */
    table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
    iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);

    /* if your table is read only, it's easiest to change the
       HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY */
    my_handler = netsnmp_create_handler_registration("myTable",
                                             myTable_handler,
                                             myTable_oid,
                                             OID_LENGTH(myTable_oid),
                                             HANDLER_CAN_RONLY);

    if (!my_handler || !table_info || !iinfo)
        return; /* mallocs failed */

    /***************************************************
     * Setting up the table's definition
     */
    netsnmp_table_helper_add_index(table_info,
                                  ASN_INTEGER);

    table_info->min_column = MINCOLUMN;
    table_info->max_column = MAXCOLUMN;

    /* iterator access routines */
    iinfo->get_first_data_point = myTable_get_first_data_point;
    iinfo->get_next_data_point = myTable_get_next_data_point;

    iinfo->table_reginfo = table_info;

    /***************************************************
     * registering the table with the master agent
     */
    DEBUGMSGTL(("initialize_table_myTable",
                "Registering table myTable as a table iterator\n"));
    netsnmp_register_table(my_handler, iinfo);
}

On doing an SNMP walk on the mib, I see that my snmp agent is crashing at 
getnext of x.y.z.1.4.0
Why is my agent not able to recognize the table in that subtree. What am I 
missing?
 P.S : I am using Net-SNMP 5.1.4.2 version

Thanks
Princy Gift



------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to