I'm tracing through the snmpd agent code (net-snmp 5.5) to study how it
works, but I'm getting stuck at what point the "context_subtrees" pointer
gets filled in. i.e. it's first initialized here,
agent/agent_registry.c: (line 209)
subtree_context_cache *context_subtrees = NULL;
So, we see it's assigned to NULL in the beginning. Code-Stepping (with
cscope) leads me to understand that it's first encountered in this manner
(during initialization/startup),
setup_tree() -> netsnmp_register_null() -> netsnmp_register_null_context()
-> netsnmp_register_null_context() -> netsnmp_register_handler() ->
netsnmp_register_mib() -> netsnmp_subtree_load() ->
netsnmp_subtree_find_first()
In that last function [ netsnmp_subtree_find_first() ], I'm assuming that as
the value of "context_subtrees" would be NULL the first time, it (the
function) should return NULL as well. And here is where my problem starts.
IF "netsnmp_subtree_find_first()" returns NULL, then we end up calling
"netsnmp_register_null_context()" AGAIN, which leads to an infinite calling
loop (as mentioned above) - which obviously doesn't make sense (the code
compiles and runs fine for me).
The way I see it, my 'paradox' can be fixed if "context_subtrees" is
assigned a value (other than NULL) somewhere. But, I can't find it. The ONLY
function that fills it in is "add_subtree()" - but that isn't called from
anywhere during initialization/startup.
I'm going round in circles here. :( Anyone know what I'm missing? Just a
small hint would do.
Getting dizzy,
Abraham V.
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders