After much tracking down I believe I narrowed the problem down to an assumption of contiguous indices in table_data.c.
Any getnext request on the last row of a column followed by a gap would produce nonsense. This patch seems to fix the problem: --- table_data.c.orig Tue Oct 6 12:33:16 2009 +++ table_data.c Tue Oct 6 12:36:22 2009 @@ -529,7 +529,9 @@ } } if (!row) { - table_info->colnum++; + table_info->colnum = + netsnmp_closest_column(table_info->colnum + 1, + table_reg_info->valid_columns); if (table_info->colnum <= table_reg_info->max_column) { row = table->first_row; } On Wed, 16 Sep 2009 16:50:08 -0400, Aaron Young <aaron.yo...@mpathix.com> wrote: > I've experienced an issue with 5.4.2.1 where my table has non-contiguous > column ids, and both snmpwalk and snmptable seem to stop at the gap. > > i.e. (column ids 2,3,10) > > snmptable -v2c -Ci -c public localhost:1616 mxOtherTable > SNMP table: MPATHIX-MIB::mxOtherTable > > index mxOtherIdentity mxOtherState mxOtherErrorMsg > 1 Joe's Chicken and Waffles ok ? > 2 Sal's donut shoppe ok ? > > If I use snmptable in GETNEXT or v1 mode it works fine. > > An snmpwalk on the table oid will also stop at the gap: > > snmpwalk -v2c -Ci -c public localhost:1616 mxOtherTable > MPATHIX-MIB::mxOtherTable = No Such Object available on this agent at > this > OID > MPATHIX-MIB::mxOtherIdentity.1 = STRING: Joe's Chicken and Waffles > MPATHIX-MIB::mxOtherIdentity.2 = STRING: Sal's donut shoppe > MPATHIX-MIB::mxOtherState.1 = INTEGER: ok(1) > MPATHIX-MIB::mxOtherState.2 = INTEGER: ok(1) > > This is in Solaris x86 built in 64-bit mode, communicating with snmpd > through agentx > > Here's how I built my table: > > > static oid tableOid[] = { 1, 3, 6, 1, 4, 1, 8276, 1, 2, 1, 6 }; > > int defaultState = 1; > > std::string tableName = "mxOtherTable"; > static netsnmp_table_data_set* table > = netsnmp_create_table_data_set( tableName.c_str() ); > > // disallow SET > table->allow_creation = 0; > > // add index > netsnmp_table_dataset_add_index( table, ASN_INTEGER ); > > // add columns > // column # > // type > // writable > // default value > // default value len > > netsnmp_table_set_multi_add_default_row( table, > 2, ASN_OCTET_STR, 0, NULL, 0, > 3, ASN_INTEGER, 0, &defaultState, sizeof( defaultState ), > 20, ASN_OCTET_STR, 0, NULL, 0, > 0 ); > > netsnmp_handler_registration* regInfo > = netsnmp_create_handler_registration > ( tableName.c_str(), NULL, > tableOid, OID_LENGTH(tableOid), > HANDLER_CAN_RWRITE ); > > netsnmp_register_table_data_set( regInfo, table, NULL); > > netsnmp_register_auto_data_table( table, NULL ); > > > // add > netsnmp_table_row* newRow = netsnmp_create_table_data_row(); > > int index = 1; > netsnmp_table_row_add_index( newRow, ASN_INTEGER, > &index, sizeof( index ) ); > > std::string identity = "Joe's Chicken and Waffles"; > netsnmp_set_row_column (newRow, 2, ASN_OCTET_STR, > identity.c_str(), identity.length() ); > > netsnmp_set_row_column (newRow, 3, ASN_INTEGER, > reinterpret_cast<const char*>(&defaultState), sizeof( > defaultState ) ); > > std::string errorMsg = "Waffle-lite"; > netsnmp_set_row_column (newRow, 20, ASN_OCTET_STR, > errorMsg.c_str(), errorMsg.length() ); > > netsnmp_table_dataset_add_row( table, newRow ); > > // add > netsnmp_table_row* newRow2 = netsnmp_create_table_data_row(); > > index++; > netsnmp_table_row_add_index( newRow2, ASN_INTEGER, > &index, sizeof( index ) ); > > identity = "Sal's donut shoppe"; > netsnmp_set_row_column (newRow2, 2, ASN_OCTET_STR, > identity.c_str(), identity.length() ); > > netsnmp_set_row_column (newRow2, 3, ASN_INTEGER, > reinterpret_cast<const char*>(&defaultState), sizeof( > defaultState ) ); > > errorMsg = "full of donuts"; > netsnmp_set_row_column (newRow2, 20, ASN_OCTET_STR, > errorMsg.c_str(), errorMsg.length() ); > > netsnmp_table_dataset_add_row( table, newRow2 ); > > > Any ideas on what the problem may be? > > -Aaron > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register > now! > http://p.sf.net/sfu/devconf > _______________________________________________ > 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 ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ 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