Re: registering pdu failed: 263!

"NetSnmp User" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>

> 
> That'd point to a duplicate registration. Could be harmless if it's just
> due to implicit re-registering of top-level oids. Since you didn't tell
> us anything about your subagent or agent configuration, we don't know.
> 
> 
> +Thomas

Hi Thomas and Suresh,

Thanks for your replies.

According to my knowledge I don't think I'm registering any oid's twice. But still I'm doubt on that. My subagent was designed something like this:

I used mib2c compiler to generate c files. A sample subagent code looks something like this.

void
init_MyMIBScalars(void)
{
    static oid      MyId1_oid[] =
        { 1, 3, 6, 1, 4, 1, 1441, 1, 100, 1, 1, 1 };
    static oid      MyId2_oid[] =
        { 1, 3, 6, 1, 4, 1, 1441, 1, 100, 1, 1, 2 };
DEBUGMSGTL(("MyMIB", "Initializing\n"));

    netsnmp_handler_registration *reg;
    netsnmp_register_scalar(reg = netsnmp_create_handler_registration
                            ("MyId1", handle_MyId1, MyId1_oid,
                             OID_LENGTH(MyId1_oid), HANDLER_CAN_RONLY));
    reg->contextName = strdup("MyContext");
    netsnmp_register_handler(reg);
    netsnmp_register_scalar(reg = netsnmp_create_handler_registration
                            ("MyId2", handle_MyId2,
                             MyId2_oid,
                             OID_LENGTH(MyId2_oid),
                             HANDLER_CAN_RWRITE));
    reg->contextName = strdup("MyContext");
    netsnmp_register_handler(reg);
}
int
handle_MyId1(netsnmp_mib_handler *handler,
             netsnmp_handler_registration *reginfo,
             netsnmp_agent_request_info *reqinfo,
             netsnmp_request_info *requests)
{
    /*
     * We are never called for a GETNEXT if it's registered as a
     * "instance", as it's "magically" handled for us.  
     */
    switch (reqinfo->mode) {

    case MODE_GET:
 snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
                                 (u_char *)obj,len);

        	break;

    default:
        snmp_log(LOG_ERR, "unknown mode (%d) in handle_MyId1\n",
                 reqinfo->mode);
        return SNMP_ERR_GENERR;
    }

    return SNMP_ERR_NOERROR;
}

int
handle_MyId2(netsnmp_mib_handler *handler,
                    netsnmp_handler_registration *reginfo,
                    netsnmp_agent_request_info *reqinfo,
                    netsnmp_request_info *requests)
{
    int             ret;
    /*
     * We are never called for a GETNEXT if it's registered as a
     * "instance", as it's "magically" handled for us.  
     */

    switch (reqinfo->mode) {

    case MODE_GET:
          snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
                                 (u_char *)obj,len);
       	 break;
    case MODE_SET_RESERVE1:
        ret = netsnmp_check_vb_type(requests->requestvb, ASN_OCTET_STR);
        if (ret != SNMP_ERR_NOERROR) {
            netsnmp_set_request_error(reqinfo, requests, ret);
        }
        break;

    case MODE_SET_RESERVE2:
        if (  XXX if malloc, or whatever, failed:  ) {
            netsnmp_set_request_error(reqinfo, requests,
                                      SNMP_ERR_RESOURCEUNAVAILABLE);
        }
        break;

    case MODE_SET_FREE:
        break;

    case MODE_SET_ACTION:
          if ( 0 ) {
            netsnmp_set_request_error(reqinfo, requests, 
                                  0    );
        }
       break;

    case MODE_SET_COMMIT:
        /f (  0 ) {
            netsnmp_set_request_error(reqinfo, requests,
                                      SNMP_ERR_COMMITFAILED);
        }
        break;

    case MODE_SET_UNDO:
        if ( 0 ) {
            netsnmp_set_request_error(reqinfo, requests,
                                      SNMP_ERR_UNDOFAILED);
        }
        break;

    default:
        snmp_log(LOG_ERR, "unknown mode (%d) in handle_MyId2\n",
                 reqinfo->mode);
        return SNMP_ERR_GENERR;
    }

    return SNMP_ERR_NOERROR;
}

Can u help me in finding where is the re-registering is happening.

Thanks in Advance

=


-- 
_______________________________________________
Search for products and services at: 
http://search.mail.com

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
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.