qmsk/snmpbot

table walk fails if any entry object is not accessible

Closed this issue · 1 comments

If mibs:Client.WalkTable() => client:Client.Walk() returns snmp.EndOfMibView for any table entry object, then the entire table walk fails. It should probably return some invalid value for that column instead.

$ ~/go/bin/snmptable public@edgeswitch-098730 IF-MIB::ifTable
2018/03/04 19:18:15 Invalid VarBind[.1.3.6.1.2.1.2.2.1.15] Value for IF-MIB::ifInUnknownProtos: SNMP VarBind Error: EndOfMibView
$ ~/go/bin/snmpwalk -debug public@edgeswitch-098730 IF-MIB::ifInUnknownProtos
DEBUG client: Engine<[::]:51693>: Run...
DEBUG client: Engine<[::]:51693>: Send: client.IO{Addr:(*net.UDPAddr)(0xc420396180), Packet:snmp.Packet{Version:1, Community:[]uint8{0x70, 0x75, 0x62, 0x6c, 0x69, 0x63}, RawPDU:asn1.RawValue{Class:0, Tag:0, IsCompound:false, Bytes:[]uint8(nil), FullBytes:[]uint8(nil)}}, PDUType:1, PDU:snmp.GenericPDU{RequestID:0, ErrorStatus:0, ErrorIndex:0, VarBinds:[]snmp.VarBind{snmp.VarBind{Name:asn1.ObjectIdentifier{1, 3, 6, 1, 2, 1, 2, 2, 1, 15}, RawValue:asn1.RawValue{Class:0, Tag:5, IsCompound:false, Bytes:[]uint8(nil), FullBytes:[]uint8(nil)}}}}}
DEBUG client: Engine<[::]:51693>: Start request public@172.28.2.2:161[0]: GetNextRequest<1.3.6.1.2.1.2.2.1.15>@172.28.2.2:161[1]
DEBUG client: Engine<[::]:51693>: Recv: client.IO{Addr:(*net.UDPAddr)(0xc420198000), Packet:snmp.Packet{Version:1, Community:[]uint8{0x70, 0x75, 0x62, 0x6c, 0x69, 0x63}, RawPDU:asn1.RawValue{Class:2, Tag:2, IsCompound:true, Bytes:[]uint8{0x2, 0x1, 0x0, 0x2, 0x1, 0x0, 0x2, 0x1, 0x0, 0x30, 0x15, 0x30, 0x13, 0x6, 0xa, 0x2b, 0x6, 0x1, 0x2, 0x1, 0x2, 0x2, 0x1, 0x10, 0x1, 0x41, 0x5, 0x0, 0xb5, 0x98, 0xe, 0x22}, FullBytes:[]uint8{0xa2, 0x20, 0x2, 0x1, 0x0, 0x2, 0x1, 0x0, 0x2, 0x1, 0x0, 0x30, 0x15, 0x30, 0x13, 0x6, 0xa, 0x2b, 0x6, 0x1, 0x2, 0x1, 0x2, 0x2, 0x1, 0x10, 0x1, 0x41, 0x5, 0x0, 0xb5, 0x98, 0xe, 0x22}}}, PDUType:2, PDU:snmp.GenericPDU{RequestID:0, ErrorStatus:0, ErrorIndex:0, VarBinds:[]snmp.VarBind{snmp.VarBind{Name:asn1.ObjectIdentifier{1, 3, 6, 1, 2, 1, 2, 2, 1, 16, 1}, RawValue:asn1.RawValue{Class:1, Tag:1, IsCompound:false, Bytes:[]uint8{0x0, 0xb5, 0x98, 0xe, 0x22}, FullBytes:[]uint8{0x41, 0x5, 0x0, 0xb5, 0x98, 0xe, 0x22}}}}}}
DEBUG client: Engine<[::]:51693>: Request public@172.28.2.2:161[0] done: GetNextRequest<1.3.6.1.2.1.2.2.1.15>@172.28.2.2:161[1]
INFO client: Client<public@172.28.2.2:161>: Request GetNextRequest<1.3.6.1.2.1.2.2.1.15>@172.28.2.2:161[1] => 1.3.6.1.2.1.2.2.1.16.1=3046641186
DEBUG client: Engine<[::]:51693>: Close...

Fixed in c0a20b6, these columns now end up being nil in the EntryValues and API JSON.