snmp: fix SNMPv2 generic trap ID and special varbinds OID to send according to rfc3584

This commit is contained in:
qazmko1029 2023-12-30 23:15:52 +08:00
parent b413b04093
commit 53c3e8165a

View File

@ -256,7 +256,7 @@ snmp_prepare_trap_oid(struct snmp_obj_id *dest_snmp_trap_oid, const struct snmp_
if (sizeof(dest_snmp_trap_oid->id) >= sizeof(snmpTrapOID)) {
MEMCPY(&dest_snmp_trap_oid->id, snmpTrapOID , sizeof(snmpTrapOID));
dest_snmp_trap_oid->len = LWIP_ARRAYSIZE(snmpTrapOID);
dest_snmp_trap_oid->id[dest_snmp_trap_oid->len++] = specific_trap + 1;
dest_snmp_trap_oid->id[dest_snmp_trap_oid->len++] = generic_trap + 1;
} else {
err = ERR_MEM;
}
@ -359,8 +359,8 @@ snmp_send_trap_or_notification_or_inform_generic(struct snmp_msg_trap *trap_msg,
NULL, /* *next */
NULL, /* *prev */
{ /* oid */
8, /* oid len */
{1, 3, 6, 1, 2, 1, 1, 3} /* oid for sysUpTime */
9, /* oid len */
{1, 3, 6, 1, 2, 1, 1, 3, 0} /* oid for sysUpTime.0 */
},
SNMP_ASN1_TYPE_TIMETICKS, /* type */
sizeof(u32_t), /* value_len */
@ -372,7 +372,7 @@ snmp_send_trap_or_notification_or_inform_generic(struct snmp_msg_trap *trap_msg,
NULL, /* *prev */
{ /* oid */
10, /* oid len */
{1, 3, 6, 1, 6, 3, 1, 1, 4, 1} /* oid for snmpTrapOID */
{1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0} /* oid for snmpTrapOID.0 */
},
SNMP_ASN1_TYPE_OBJECT_ID, /* type */
0, /* value_len */