Hi Ian, Everything seems to be fine. Not sure why "tabreq" is getting NULL in netsnmp_get_table_handler.
I have a suggestion. I see the same implementation with slight modification in init_icmp() function in agent/mibgroup/mibII/icmp.c. There I can see the table is using a different function "netsnmp_register_table_iterator2" to register the table. Maybe this function might help you. I'm not sure whether this will solve the issue. Just a suggestion so that you can try. Thanks, Aferjes Blesswin Redeemson M On Fri, Aug 7, 2020 at 12:21 AM Ian C via Net-snmp-coders < net-snmp-coders@lists.sourceforge.net> wrote: > I took Wes' advice and ran with -DALL, along with some extra DEBUGMSGTLs > in suspect areas (-DALL output follows): > void > initialize_table_chAsinHwSbcNtpTable(void) > { > syslog( LOG_ERR, "initialize_table_chAsinHwSbcNtpTable()"); > const oid chAsinHwSbcNtpTable_oid[] = {1,3,6,1,4,1,25228,3,3,1,9,6,6}; > const size_t chAsinHwSbcNtpTable_oid_len = > OID_LENGTH(chAsinHwSbcNtpTable_oid); > netsnmp_handler_registration *reg; > netsnmp_iterator_info *iinfo; > netsnmp_table_registration_info *table_info; > > DEBUGMSGTL(("chAsinHwSbcNtpTable", "initializing table > chAsinHwSbcNtpTable\n")); > > reg = netsnmp_create_handler_registration( > "chAsinHwSbcNtpTable", chAsinHwSbcNtpTable_handler, > chAsinHwSbcNtpTable_oid, chAsinHwSbcNtpTable_oid_len, > HANDLER_CAN_RONLY > ); > > table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info ); > if(table_info == NULL) { > DEBUGMSGTL(("chAsinHwSbcNtpTable", "after SNMP_MALLOC_TYPEDEF( ) > table_info is _N_U_L_L!\n")); > } > else { > DEBUGMSGTL(("chAsinHwSbcNtpTable", "after SNMP_MALLOC_TYPEDEF( ) > table_info _NOT_ null\n")); > } > netsnmp_table_helper_add_indexes(table_info, > ASN_OCTET_STR, /* index: chAsinHwSbcNtpSbcName > */ > 0); > if(table_info == NULL) { > DEBUGMSGTL(("chAsinHwSbcNtpTable", "after > netsnmp_table_helper_add_indexes( ) table_info is _N_U_L_L!\n")); > } > else { > DEBUGMSGTL(("chAsinHwSbcNtpTable", "after > netsnmp_table_helper_add_indexes( ) table_info _NOT_ null\n")); > } > table_info->min_column = COLUMN_CHASINHWSBCNTPSBCNAME; > table_info->max_column = COLUMN_CHASINHWSBCNTPSTATUSSTRING; > > iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info ); > iinfo->get_first_data_point = chAsinHwSbcNtpTable_get_first_data_point; > iinfo->get_next_data_point = chAsinHwSbcNtpTable_get_next_data_point; > iinfo->table_reginfo = table_info; > iinfo->free_loop_context_at_end = nsModuleTable_loop_free; > iinfo->free_data_context = freeTableEntry; > > if(iinfo->table_reginfo == NULL) { > DEBUGMSGTL(("chAsinHwSbcNtpTable", "before > netsnmp_register_table_iterator( ) iinfo->table_reginfo is _N_U_L_L!\n")); > } > else { > DEBUGMSGTL(("chAsinHwSbcNtpTable", "before > netsnmp_register_table_iterator( ) iinfo->table_reginfo _NOT_ null\n")); > } > netsnmp_register_table_iterator( reg, iinfo ); > > /* Initialise the contents of the table here */ > } > > > Now a snippet from the -DALL logging, but nothing stands out to me, > perhaps someone on the list may have some idea: > > 9:callback:lock: locked (LIB,POST_READ_CONFIG) > trace: netsnmp_register_callback(): callback.c, 296: > callback: registered (0,0) at 806c818 with priority 0 > trace: _callback_unlock(): callback.c, 170: > 9:callback:lock: unlocked (LIB,POST_READ_CONFIG) > trace: subagent_init(): mibgroup/agentx/subagent.c, 162: > agentx/subagent: initializing.... DONE > trace: internal_register_config_handler(): read_config.c, 219: > 9:read_config:register_handler: registering ./icSNMPntpSubAgentChA.exe > com2sec > trace: internal_register_config_handler(): read_config.c, 219: > 9:read_config:register_handler: registering ./icSNMPntpSubAgentChA.exe > com2sec6 > trace: internal_register_config_handler(): read_config.c, 219: > 9:read_config:register_handler: registering ./icSNMPntpSubAgentChA.exe > com2secunix > trace: initialize_table_chAsinHwSbcNtpTable(): > C:/Users/clougia/workspace/SIN_4/SIN_QNX7/seg_src/SNMP/sinHwSbcNTPtable/channelA/chAsinHwSbcNtpTable.cpp, > 60: > chAsinHwSbcNtpTable: initializing table chAsinHwSbcNtpTable > trace: initialize_table_chAsinHwSbcNtpTable(): > C:/Users/clougia/workspace/SIN_4/SIN_QNX7/seg_src/SNMP/sinHwSbcNTPtable/channelA/chAsinHwSbcNtpTable.cpp, > 73: > chAsinHwSbcNtpTable: after SNMP_MALLOC_TYPEDEF( ) table_info _NOT_ null > trace: initialize_table_chAsinHwSbcNtpTable(): > C:/Users/clougia/workspace/SIN_4/SIN_QNX7/seg_src/SNMP/sinHwSbcNTPtable/channelA/chAsinHwSbcNtpTable.cpp, > 82: > chAsinHwSbcNtpTable: after netsnmp_table_helper_add_indexes( ) table_info > _NOT_ null > trace: initialize_table_chAsinHwSbcNtpTable(): > C:/Users/clougia/workspace/SIN_4/SIN_QNX7/seg_src/SNMP/sinHwSbcNTPtable/channelA/chAsinHwSbcNtpTable.cpp, > 98: > chAsinHwSbcNtpTable: before netsnmp_register_table_iterator( ) > iinfo->table_reginfo _NOT_ null > trace: netsnmp_inject_handler_before(): agent_handler.c, 444: > handler:inject: injecting table_iterator before chAsinHwSbcNtpTable > netsnmp_get_table_handler(NULL) called > could not create table handler > > Thanks again Wes, and everyone else reading this! > > Ian > > > > > On Thursday, August 6, 2020, 9:56:00 a.m. EDT, Ian C <mc_...@yahoo.com> > wrote: > > > Thanks Wes, will try this soon. > > On Wednesday, August 5, 2020, 1:47:24 p.m. EDT, Wes Hardaker < > harda...@users.sourceforge.net> wrote: > > > Ian C via Net-snmp-coders <net-snmp-coders@lists.sourceforge.net> > > writes: > > > Hi, > > > > We previously had net-snmp 5.6 running on QNX 6.5 (from pkgsrc), and had > various > > sub-agents retrieving data and working well. However we've recently > migrated our OS > > to QNX 7.0 and since there are no pkgsrc packages available for that OS > we've > > upgraded and compiled net-snmp 5.8 ourselves. > > > > Most of the system has ported well, GETs for scalars are fine; snmp > table queries > > for system OIDs such as ifTable & atTable also work, however any table > query for our > > own table-based subagents fail. While digging into this I noticed that > upon start-up > > our subagent reports: > > > > Qnx7->SubAgentChA.exe -Lo -d > > netsnmp_get_table_handler(NULL) called > > could not create table handler > > > I'd run with -DALL in order to get a *lot* of debug output (assuming you > didn't turn off debugging output). Specifically, look for the same > error message to figure out where in the code the problem is triggered > from in the output trace. Because this is where the code is: > > netsnmp_mib_handler * > netsnmp_get_table_handler(netsnmp_table_registration_info *tabreq) > { > netsnmp_mib_handler *ret = NULL; > > if (!tabreq) { > snmp_log(LOG_INFO, "netsnmp_get_table_handler(NULL) called\n"); > return NULL; > } > > Which means that the function is getting called with a NULL input, which > certainly shouldn't happen. But *where* is calling it? > > -DALL should help identify that > -- > Wes Hardaker > Please mail all replies to net-snmp-coders@lists.sourceforge.net > > _______________________________________________ > Net-snmp-coders mailing list > Net-snmp-coders@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/net-snmp-coders >
_______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders