Net-SNMP structure pointer issue

"Canchivaram, Srivatsan" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <83ACC43C96CABA4D87AADCF1ADFFC702FC8ABDAA@wdc1exchmbxp01.hq.corp.viasat.com>
Hi,

Our MIB specification contains various tables and scalar entries that were converted to C code using 'mib2c'.

The C files forming our MIB branch were compiled into a shared object that is dynamically loaded using dlmod.
However, the initialization of each object in the module runs into NULL pointer errors:

Module vsatSb2Ut loaded
netsnmp_get_table_handler(NULL) called
netsnmp_inject_handler() called illegally
netsnmp_assert handler != ((void *)0) failed agent_handler.c:418 netsnmp_inject_handler_before()
netsnmp_get_table_handler(NULL) called
netsnmp_inject_handler() called illegally
netsnmp_assert handler != ((void *)0) failed agent_handler.c:418 netsnmp_inject_handler_before()
handlerName = vsatSb2UtMacTablenetsnmp_get_table_handler(NULL) called

..... and so on.

Using gdb, I was able to find out the origin of the NULL pointer.
In any of our initialize_table_xxx() functions that are auto generated by the mib2c  tool, these structures are populated:

netsnmp_handler_registration *reg;
netsnmp_iterator_info *iinfo;
netsnmp_table_registration_info *table_info;

Finally, this libnetsnmp iterator function is called within the initialization function:
netsnmp_register_table_iterator(reg, iinfo);

Both reg and iinfo are valid memory addresses in both our module and in the libnetsnmp functions.
However, iinfo->table_reginfo which prints a valid address in our module becomes address 0x0 as soon as it enters the netsnmp_register_table_iterator() function.
This is the cause of the NULL pointer errors seen above.

If you have any comments, debug suggestions or more questions, kindly reply.

Thanks,
Sri

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev

_______________________________________________
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.