Fix off by one bug in snmp trap v1 generic trap field (#6797)

This commit is contained in:
reimda 2019-12-12 11:54:44 -07:00 committed by Daniel Nelson
parent cae701c54b
commit a7a639f6a3
1 changed files with 1 additions and 1 deletions

View File

@ -171,7 +171,7 @@ func makeTrapHandler(s *SnmpTrap) handler {
// translate a v1 trap to v2. // translate a v1 trap to v2.
var trapOid string var trapOid string
if packet.GenericTrap > 0 && packet.GenericTrap < 6 { if packet.GenericTrap >= 0 && packet.GenericTrap < 6 {
trapOid = "1.3.6.1.6.3.1.1.5." + strconv.Itoa(packet.GenericTrap+1) trapOid = "1.3.6.1.6.3.1.1.5." + strconv.Itoa(packet.GenericTrap+1)
} else if packet.GenericTrap == 6 { } else if packet.GenericTrap == 6 {
trapOid = packet.Enterprise + ".0." + strconv.Itoa(packet.SpecificTrap) trapOid = packet.Enterprise + ".0." + strconv.Itoa(packet.SpecificTrap)