Sending V1 traps instead of V2????

"Rob Rose" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
I created a simple SNMPv2 notification in my MIB listed below:
-- ****************************************************************************************
--	  QED Trap defintions
-- ****************************************************************************************
qedFtpDownloadCompleteTrap NOTIFICATION-TYPE
	OBJECTS { 	qedTansferStatus,
				qedSrcFile,
				qedDestFile,
				qedFileServer
			}
    STATUS  current
    DESCRIPTION
    	"Event notifying the user of that FTP download is complete."
    ::= { qedTraps 1 }

The attached file is the mib2c created source using the following command:
   "mib2c mib2c.notify.conf qedTraps"

When I call this function from the Net SNMP Agent I receive the following error in my error log:
snmpd: send_trap: Cannot send V1 PDU on V2 session
snmpd: send_trap: Cannot send V1 PDU on V2 session
snmpd: send_trap: Cannot send V1 PDU on V2 session
snmpd: send_trap: Cannot send V1 PDU on V2 session
snmpd: send_trap: Cannot send V1 PDU on V2 session
snmpd: send_trap: Cannot send V1 PDU on V2 session
snmpd: send_trap: Cannot send V1 PDU on V2 session
snmpd: send_trap: Cannot send V1 PDU on V2 session
snmpd: send_trap: Cannot send V1 PDU on V2 session

Any information on how to fix this will greatly help me stay on schedule :~)
Thanks!

Rob Rose
Email: [email protected]
qedTraps.c (application/octet-stream, 5.5 KB)
/*
 * Note: this file originally auto-generated by mib2c using
 *        : mib2c.notify.conf,v 5.3 2004/04/15 12:29:19 dts12 Exp $
 */

#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "qedTraps.h"

static oid      snmptrap_oid[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };

int
send_qedFtpDownloadCompleteTrap_trap(void)
{
    netsnmp_variable_list *var_list = NULL;
    oid             qedFtpDownloadCompleteTrap_oid[] =
        { 1, 3, 6, 1, 4, 1, 576, 26, 9, 1 };
    oid             qedTansferStatus_oid[] =
        { 1, 3, 6, 1, 4, 1, 576, 26, 3, 2, 0 };
    oid             qedSrcFile_oid[] =
        { 1, 3, 6, 1, 4, 1, 576, 26, 3, 4, 0 };
    oid             qedDestFile_oid[] =
        { 1, 3, 6, 1, 4, 1, 576, 26, 3, 5, 0 };
    oid             qedFileServer_oid[] =
        { 1, 3, 6, 1, 4, 1, 576, 26, 3, 6, 0 };

    /*
     * Set the snmpTrapOid.0 value
     */
    snmp_varlist_add_variable(&var_list,
                              snmptrap_oid, OID_LENGTH(snmptrap_oid),
                              ASN_OBJECT_ID,
                              qedFtpDownloadCompleteTrap_oid,
                              sizeof(qedFtpDownloadCompleteTrap_oid));

    /*
     * Add any objects from the trap definition
     */
    snmp_varlist_add_variable(&var_list,
                              qedTansferStatus_oid,
                              OID_LENGTH(qedTansferStatus_oid),
                              ASN_INTEGER,
                              /*
                               * Set an appropriate value for qedTansferStatus 
                               */
                              NULL, 0);
    snmp_varlist_add_variable(&var_list,
                              qedSrcFile_oid, OID_LENGTH(qedSrcFile_oid),
                              ASN_OCTET_STR,
                              /*
                               * Set an appropriate value for qedSrcFile 
                               */
                              NULL, 0);
    snmp_varlist_add_variable(&var_list,
                              qedDestFile_oid, OID_LENGTH(qedDestFile_oid),
                              ASN_OCTET_STR,
                              /*
                               * Set an appropriate value for qedDestFile 
                               */
                              NULL, 0);
    snmp_varlist_add_variable(&var_list,
                              qedFileServer_oid,
                              OID_LENGTH(qedFileServer_oid), ASN_IPADDRESS,
                              /*
                               * Set an appropriate value for qedFileServer 
                               */
                              NULL, 0);

    /*
     * Add any extra (optional) objects here
     */

    /*
     * Send the trap to the list of configured destinations
     *  and clean up
     */
    send_v2trap(var_list);
    snmp_free_varbind(var_list);

    return SNMP_ERR_NOERROR;
}

int
send_qedFtpDownloadFailedTrap_trap(void)
{
    netsnmp_variable_list *var_list = NULL;
    oid             qedFtpDownloadFailedTrap_oid[] =
        { 1, 3, 6, 1, 4, 1, 576, 26, 9, 2 };
    oid             qedTansferStatus_oid[] =
        { 1, 3, 6, 1, 4, 1, 576, 26, 3, 2, 0 };
    oid             qedSrcFile_oid[] =
        { 1, 3, 6, 1, 4, 1, 576, 26, 3, 4, 0 };
    oid             qedDestFile_oid[] =
        { 1, 3, 6, 1, 4, 1, 576, 26, 3, 5, 0 };
    oid             qedFileServer_oid[] =
        { 1, 3, 6, 1, 4, 1, 576, 26, 3, 6, 0 };

    /*
     * Set the snmpTrapOid.0 value
     */
    snmp_varlist_add_variable(&var_list,
                              snmptrap_oid, OID_LENGTH(snmptrap_oid),
                              ASN_OBJECT_ID,
                              qedFtpDownloadFailedTrap_oid,
                              sizeof(qedFtpDownloadFailedTrap_oid));

    /*
     * Add any objects from the trap definition
     */
    snmp_varlist_add_variable(&var_list,
                              qedTansferStatus_oid,
                              OID_LENGTH(qedTansferStatus_oid),
                              ASN_INTEGER,
                              /*
                               * Set an appropriate value for qedTansferStatus 
                               */
                              NULL, 0);
    snmp_varlist_add_variable(&var_list,
                              qedSrcFile_oid, OID_LENGTH(qedSrcFile_oid),
                              ASN_OCTET_STR,
                              /*
                               * Set an appropriate value for qedSrcFile 
                               */
                              NULL, 0);
    snmp_varlist_add_variable(&var_list,
                              qedDestFile_oid, OID_LENGTH(qedDestFile_oid),
                              ASN_OCTET_STR,
                              /*
                               * Set an appropriate value for qedDestFile 
                               */
                              NULL, 0);
    snmp_varlist_add_variable(&var_list,
                              qedFileServer_oid,
                              OID_LENGTH(qedFileServer_oid), ASN_IPADDRESS,
                              /*
                               * Set an appropriate value for qedFileServer 
                               */
                              NULL, 0);

    /*
     * Add any extra (optional) objects here
     */

    /*
     * Send the trap to the list of configured destinations
     *  and clean up
     */
    send_v2trap(var_list);
    snmp_free_varbind(var_list);

    return SNMP_ERR_NOERROR;
}
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.