I am encountering an issue regarding Net-SNMP version 5.9.4.
I am trying to register my table and scalar into existing oid list, but failed.
Before I continue, I ensured that dlmod is working, and all register handler are running, and my own module code is working correctly in other built, so please take that for granted.
This is how I run my snmpd
snmpd -f -C -c /etc/snmpd/snmpd.conf -Dsubtree,mib_init,mib_load,register_mib,wtest
and here’s my snmpd.conf file
com2sec rw_sec_name default private
com2sec ro_sec_name default public
group RWGroupLan v1 rw_sec_name
group ROGroupLan v1 ro_sec_name
group RWGroupLan v2c rw_sec_name
group ROGroupLan v2c ro_sec_name
access RWGroupLan "" any noauth exact all all none
access ROGroupLan "" any noauth exact all none none
view all included .1 80
master agentx
agentxsocket tcp:localhost:701
dlmod netsnmpObjects /lib/libnetsnmpObjects.so
The problem lies when loading netsnmpObjects, when registering handler for the netsnmpObjects table, the snmpd search for context, subtree, and trying to inject oid. When read the config line ” dlmod netsnmpObjects /lib/libnetsnmpObjects.so”, it searchs the context, somehow its NULL, and treat it as a new list. After further research, the problem lies with the global variable “static lookup_cache_context *thecontextcache = NULL;”
Base on the log, when registering mytable
Creating registration name myTable.
trace: netsnmp_inject_handler_before(): agent_handler.c, 453:
handler:inject: injecting table_iterator before myTable
trace: netsnmp_inject_handler_before(): agent_handler.c, 453:
handler:inject: injecting table before table_iterator
trace: netsnmp_register_handler(): agent_handler.c, 276:
handler::register: Registering myTable (::table::table_iterator::myTable) at .1.3.6.1.4.1.1234.12
trace: netsnmp_inject_handler_before(): agent_handler.c, 453:
handler:inject: injecting bulk_to_next before table
trace: netsnmp_register_mib(): agent_registry.c, 1164:
register_mib: registering "myTable" at .1.3.6.1.4.1.1234.12 with context "(null)"
trace: netsnmp_subtree_find_first(): agent_registry.c, 320:
subtree: looking for subtree for context: ""
trace: netsnmp_subtree_find_first(): agent_registry.c, 329:
subtree: didn't find a subtree for context: ""
trace: netsnmp_register_handler(): agent_handler.c, 276:
handler::register: Registering (::null) at .0
I am building net-snmp-5.9.4 with static library, and compile my mib module as shared object. Is there any way to work around it, or would it help if I build net-snmp-5.9.4 as shared? But I think they will create separate static variable as well.
If there is any insight, please let me know. Thanks.