Issue in snmpv2 walk while filling handler context name( netsnmp_handler_registration_create->contextName)

"Lakshmipathy, Sridhar" <[email protected]>
Newsgroups gmane.network.net-snmp.devel,gmane.network.net-snmp.user
Message-ID <AT5PR84MB0306BDA7BAEE022D404A88BD9CC80@AT5PR84MB0306.NAMPRD84.PROD.OUTLOOK.COM>
Hi ,

I am new to Netsnmp,  I adding the context support .

I am facing issue in snmpv2 walk , If I filling  the context Name during the registration table .
I am not able do the walk for register table , It only accessible in context based walk ,
So what I need to add , for support the default walk .  So please help me if I missed anything .

  Handler =    netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
    reginfo = netsnmp_handler_registration_create(
        "ifTable", handler, ifTable_oid, ifTable_oid_size,
        HANDLER_CAN_BABY_STEP | HANDLER_CAN_RONLY);

    if (NULL == reginfo) {
        snmp_log(LOG_ERR, "error registering table ifTable\n");
        return;
    }

    reginfo->my_reg_void = &ifTable_if_ctx;

  if(snmp_ctx != NULL)
  {
    reginfo->contextName = strdup(snmp_ctx);
  }
if (access_multiplexer->object_lookup)
        mfd_modes |= BABY_STEP_OBJECT_LOOKUP;
    if (access_multiplexer->pre_request)
        mfd_modes |= BABY_STEP_PRE_REQUEST;
    if (access_multiplexer->post_request)
        mfd_modes |= BABY_STEP_POST_REQUEST;

    handler = netsnmp_baby_steps_handler_get(mfd_modes);
    netsnmp_inject_handler(reginfo, handler);

    handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);
    netsnmp_inject_handler(reginfo, handler);

    handler = netsnmp_container_table_handler_get(
        tbl_info, ifTable_if_ctx.container, TABLE_CONTAINER_KEY_NETSNMP_INDEX);
    netsnmp_inject_handler(reginfo, handler);

    if (NULL != ifTable_if_ctx.cache) {
        handler = netsnmp_cache_handler_get(ifTable_if_ctx.cache);
        netsnmp_inject_handler(reginfo, handler);
netsnmp_register_table(reginfo, tbl_info);


I have wrapper will fil the context name ,
However during initialization I will pass context as NULL. So I assumed there will be table registration without context name .

My snmpwalk output:
bash-4.3# snmpwalk -v2c -cpublic localhost 1.3.6.1.2.1.2.2.1.2.1
IF-MIB::ifEntry = No Such Object available on this agent at this OID

bash-4.3# snmpwalk -v3 -u test1 -l authPriv -a MD5 -A 'password' -x DES -X 'password' -n "" localhost 1.3.6.1.2.1.2.2.1.2.1
IF-MIB::ifEntry = No Such Object available on this agent at this OID

bash-4.3#snmpwalk -v3 -u test1 -l authPriv -a MD5 -A 'password' -x DES -X 'password' -n "snmp_context" localhost 1.3.6.1.2.1.2.2.1.2.1
IF-MIB::ifDescr.1 = STRING:
IF-MIB::ifSpecific.2 = No more variables left in this MIB View (It is past the end of the MIB tree)

If I am comment above  line , I can able to do the walk .

Regards,
Sridhar .L

------------------------------------------------------------------------------

_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
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.