possible bug in getnext implementation
"Rotem Tzuk" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
hi there I have a MIB implementation that handles a table. Calling snmpgetnext -v2c - c public localhost MyMIB::MyOID.1 to get index no. 1 works fine. It works fine for indexes up to 8. Trying snmpgetnext -v2c - c public localhost MyMIB::MyOID.9 resulted in skipping to the next column. Debugging this I found that that the index is stored in the string length value of the varbind - mib.c line 3770: var->val_len = uitmp; function parse_one_oid_index() In my iterator handler I'm overiding this value by calling snmp_set_var_value(put_index_data, (u_char *)strStationName.c_str(), strStationName.length() ); which sets the var->val_len to 8 (my string is "Station1") Now the original varbind has value length of 9 and the modified varbind has 8. This causes table.c : netsnmp_check_getnext_reply() to return 0 ( snmp_oid_compare fails) and does not fill the ti_info->results As a result netsnmp_table_next_column - table_iterator.c line 704 is called causing increment of column index Questions: why is the var->val_len used to store index data? Shouldn't the index variable be used for this? why does netsnmp_check_getnext_reply causes the name to change by setting var->name[0] = (oid) var->val_len; in ( mib.c line 3512 build_oid_noalloc->build_oid_segment() ) ? will be happy to provide more information Rotem ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Net-snmp-users mailing list [email protected] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users