Title: Multiple OID handler problem

Upgraded net-snmp to 5.3.1
Operating system rd7.3

Table function handler fails to loop thru multiple OID's in the same snmpget command.

snmpget -v2c -c public localhost enterprises.103.1.9.2.5.1.2.1 enterprises.103.1.9.2.5.1.2.1 enterprises.103.1.9.2.5.1.2.1 enterprises.103.1.9.2.5.1.2.0

The handler gets called, but the for (request = requests; request; request = request->next) does not loop through the OID's.  The first value is returned correctly, but all subsequent values return the table row index.

Scalar variables work fine.  Let me know if there is any other information that can be of assistance.

Thanks.

Below is the initialization function.  The number of table rows can very from 5 to 20 depending on implementation.

#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "commBaseStatsEntryTable.h"
#include "COMMdefs.h"
#include "commfifo.h"

/** Initialize the commBaseStatsEntryTable table by defining its contents and how it's structured */
void
initialize_table_commBaseStatsEntryTable(int number_of_tables)
{
        oid      commBaseStatsEntryTable_oid[] = {1,3,6,1,4,1,103,1,9,2,5};
        size_t          commBaseStatsEntryTable_oid_len = OID_LENGTH(commBaseStatsEntryTable_oid);
        netsnmp_table_data_set *table_set;

        //added manually to create dummy table rows
        netsnmp_table_row *row;
        int i;
        int index[1];
        char tmp[1] = "\0";

         table_set = netsnmp_create_table_data_set("commBaseStatsEntryTable");

        table_set->allow_creation = 1;

        netsnmp_table_dataset_add_index(table_set, ASN_INTEGER);

netsnmp_table_set_multi_add_default_row(table_set,
                                                COLUMN_COMMBASESTATSENTRYINDEX,
                                                ASN_INTEGER, 0, NULL, 0,
                                                COLUMN_COMMBASESTATSENTRYCARDNUMBER,
                                                ASN_INTEGER, 0, NULL, 0,
                                                COLUMN_COMMBASESTATSENTRYPORTNUMBER,
                                                ASN_INTEGER, 0, NULL, 0,
                                                COLUMN_COMMBASESTATSENTRYRADARTYPE,
                                                ASN_OCTET_STR, 0, NULL, 0,
                                                COLUMN_COMMBASESTATSENTRYSTATUS,
                                                ASN_INTEGER, 0, NULL, 0,
                                                COLUMN_COMMBASESTATSENTRYMSGOUTCNT,
                                                ASN_COUNTER, 0, NULL, 0,
                                                COLUMN_COMMBASESTATSENTRYFRAMEINCNT,
                                                ASN_COUNTER, 0, NULL, 0,
                                                COLUMN_COMMBASESTATSENTRYFRAMEBADCNT,
                                                ASN_COUNTER, 0, NULL, 0, 0);

        netsnmp_register_table_data_set(netsnmp_create_handler_registration
                                                ("commBaseStatsEntryTable",
                                                commBaseStatsEntryTable_handler,
                                                commBaseStatsEntryTable_oid,
                                                commBaseStatsEntryTable_oid_len,
                                                HANDLER_CAN_RWRITE), table_set, NULL);

        for (i=1; i<= number_of_tables; i++){

                index[0] = i;

                row = netsnmp_create_table_data_row();

                netsnmp_table_row_add_index(row, ASN_INTEGER, &index, sizeof(int));
                netsnmp_set_row_column(row,COLUMN_COMMBASESTATSENTRYINDEX,ASN_INTEGER,(char*)&index[0],sizeof(int));
                netsnmp_set_row_column(row,COLUMN_COMMBASESTATSENTRYCARDNUMBER,ASN_INTEGER,(char*)&index[0],sizeof(int));

                netsnmp_set_row_column(row,COLUMN_COMMBASESTATSENTRYPORTNUMBER,ASN_INTEGER,(char*)&index[0],sizeof(int));

                netsnmp_set_row_column(row,COLUMN_COMMBASESTATSENTRYRADARTYPE,ASN_OCTET_STR,tmp,strlen(tmp));
                netsnmp_set_row_column(row,COLUMN_COMMBASESTATSENTRYSTATUS,ASN_INTEGER,(char*)&index[0],sizeof(int));
                netsnmp_set_row_column(row,COLUMN_COMMBASESTATSENTRYMSGOUTCNT,ASN_COUNTER,(char*)&index[0],sizeof(int));

                netsnmp_set_row_column(row,COLUMN_COMMBASESTATSENTRYFRAMEINCNT,ASN_COUNTER,(char*)&index[0],sizeof(int));

                netsnmp_set_row_column(row,COLUMN_COMMBASESTATSENTRYFRAMEBADCNT,ASN_COUNTER,(char*)&index[0],sizeof(int));

                netsnmp_table_dataset_add_row(table_set,row);

netsnmp_register_auto_data_table(table_set,NULL);
        }

 }

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
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