SNMPV3 connectivity

Tarun Kumar <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CC38C57DB371F64EAF1A7BC5C1A4A4880123220AD8A7@FCEXMB02CCR.efi.internal>
Hi All,
I am trying to make an application to connect to my agent using snmpv3, but I am not able to connect it through.
I actually says that I am connected but is not able to get any variable from the agent, can anybody help in this ?

Here is the code which I am using

   init_snmp("snmpMgr");

    /*
     * Initialize a "session" that defines who we're going to talk to
     */
    snmp_sess_init( &m_session );                   /* set up defaults */

    m_session.peername = strdup(m_agentIp.c_str());

    /* set the SNMP version number
    m_session.version = SNMP_VERSION_2c;

    m_session.community = (u_char*)m_readCommunity.c_str();
    m_session.community_len = strlen((const char*)m_session.community);

      Open the session
     */
    fprintf(stderr, "*******connectioning to %s *****\n", m_agentIp.c_str());

    m_session.version = SNMP_VERSION_3;
    m_session.securityName = "admin";
    m_session.securityNameLen = 5;
    m_session.securityAuthProto = usmHMACMD5AuthProtocol;
    m_session.securityAuthProtoLen = sizeof(usmHMACMD5AuthProtocol)/sizeof(oid);
    m_session.securityAuthKeyLen = USM_AUTH_KU_LEN;

    m_session.securityAuthProtoLen = USM_AUTH_PROTO_MD5_LEN;

    m_session.securityPrivProto = usmDESPrivProtocol;
    m_session.securityPrivProtoLen =  sizeof(usmDESPrivProtocol)/sizeof(oid);
    m_session.securityPrivProtoLen = USM_PRIV_PROTO_DES_LEN;
    m_session.securityLevel = SNMP_SEC_LEVEL_AUTHPRIV;


    m_session.securityAuthKeyLen = USM_AUTH_KU_LEN;

    if (generate_Ku(m_session.securityAuthProto,
             m_session.securityAuthProtoLen,
             (u_char *) "12345678", 8,
             m_session.securityAuthKey,
             &m_session.securityAuthKeyLen) != SNMPERR_SUCCESS) {
             fprintf(stderr,
                   "Error generating a key (Ku) from the supplied authentication pass phrase. \n");
            return (-2);
    }

    m_session.securityPrivKeyLen = USM_PRIV_KU_LEN;

    if (generate_Ku(m_session.securityPrivProto,
            m_session.securityPrivProtoLen,
            (u_char *) "87654321", 8,
             m_session.securityPrivKey,
             &m_session.securityPrivKeyLen) != SNMPERR_SUCCESS) {
             fprintf(stderr,
                   "Error generating a key (Ku) from the supplied privacy pass phrase. \n");
             return (-2);
    }
    SOCK_STARTUP;

    m_sessPtr = snmp_open(&m_session);                     /* establish the session */

    fprintf(stderr, "\n *******session opened ******\n");

    if (!m_sessPtr) {
      snmp_sess_perror("ack", &m_session);
      fprintf(stderr, "\n*******Error in connection Reason: ******\n");

      SOCK_CLEANUP;
      return 1;
    }
    return 0;



Regards
-tarun

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com

_______________________________________________
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.