Handle GetResponse errors correctly.

This commit is contained in:
Mike Spengler 2000-01-15 19:51:44 +00:00
parent cd7249ff6a
commit b4983dbec6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=56059

View File

@ -123,6 +123,16 @@ static char *PDU_Types[] = { "GET REQUEST", "GETNEXT REQUEST", "GET RESPONSE", "
#define SNMP_VERSION_1 1 #define SNMP_VERSION_1 1
#define SNMP_VERSION_2 2 #define SNMP_VERSION_2 2
/*
* SNMP Error-status values
*/
#define SNMP_ERR_NOERROR 0
#define SNMP_ERR_TOOBIG 1
#define SNMP_ERR_NOSUCHNAME 2
#define SNMP_ERR_BADVALUE 3
#define SNMP_ERR_READONLY 4
#define SNMP_ERR_GENERR 5
/* /*
* Max string length for Variable * Max string length for Variable
*/ */
@ -1222,9 +1232,9 @@ build_pdu ( hdr, type )
*bp++ = ASN_INTEGER; *bp++ = ASN_INTEGER;
*bp++ = 0x01; /* length = 1 */ *bp++ = 0x01; /* length = 1 */
if ( erridx ) if ( erridx )
*bp++ = 0x02; /* NoSuch */ *bp++ = SNMP_ERR_NOSUCHNAME;
else else
*bp++ = 0x00; /* NoError */ *bp++ = SNMP_ERR_NOERROR;
/* Error Index */ /* Error Index */
*bp++ = ASN_INTEGER; *bp++ = ASN_INTEGER;
*bp++ = 0x01; /* length = 1 */ *bp++ = 0x01; /* length = 1 */
@ -2306,10 +2316,12 @@ ilmi_do_state ()
/* /*
* First look for empty table. If found, go to next state. * First look for empty table. If found, go to next state.
*/ */
if ( oid_ncmp ( &Objids[ADDRESS_OBJID], &Hdr->head->oid, if ((Hdr->error == SNMP_ERR_NOSUCHNAME) ||
Objids[ADDRESS_OBJID].oid[0] ) == 1 ) { ((Hdr->error == SNMP_ERR_NOERROR) &&
( oid_ncmp ( &Objids[ADDRESS_OBJID], &Hdr->head->oid,
Objids[ADDRESS_OBJID].oid[0] ) == 1 ))) {
ilmi_state[intf] = ILMI_RUNNING; /* ILMI_REG; */ ilmi_state[intf] = ILMI_RUNNING; /* ILMI_REG; */
} else { } else if (Hdr->error == SNMP_ERR_NOERROR) {
/* /*
* Check to see if this matches our address * Check to see if this matches our address
* and if so, that it's a VALID entry. * and if so, that it's a VALID entry.