error-handlingsnmpnet-snmpmib

NetSNMP Returning noCreation on writing to a Read-Write Only Table


I have a table MIB which entries have columnar objects that have MAX-ACCESS of at most "read-write" and all entries in the MIB have a STATUS of "current". The Agent is generating the rows in the table based off certain system events (that is why the user cannot create the rows, but they can modify certain columns to cause other events to happen). Additionally, I have 3 fixed length octet strings for the indices (so I am using the ASN_PRIV_IMPLIED_OCTECT_STR type to register the indices using the netsnmp_table_helper_add_indexes function). (Side note: I am not allowed to modify the MIB)

For context on how the mib file was generated: I used mib2c to generate the file with Net-SNMP style code, have table-specific code to provide information about which rows exist in the table, a single handler routine, and query the external data directly for each request.

If anyone knows where I went wrong in the above process to get the Agent to return a noCreation error when trying to set a read-write column for a row that already exists (but get can retrieve the values just fine), I would appreciate that tremendously.


Solution

  • My issue was that even though I was setting the ASN_PRIV_IMPLIED_OCTET_STRING types for the fixed length string indices, I was not setting the lengths (netsnmp_table_helper_add_indexes does not set these lengths, if one wishes to use this function, one has to go and manually set the lengths afterwards, as far as I am aware).