netdisco / snmp-info

Other
35 stars 31 forks source link

lldp doesn't check for invalid ifsubtype & ifid #520

Open inphobia opened 2 months ago

inphobia commented 2 months ago

Expected Behavior

Current Behavior

only seen on cisco fabric interconnects, fi 6332 running "Version 5.0(3)N2(4.23d)"

Use of uninitialized value $proto in numeric eq (==) at /home/netdisco/perl5/lib/perl5/SNMP/Info/LLDP.pm line 450.
Use of uninitialized value $proto in numeric eq (==) at /home/netdisco/perl5/lib/perl5/SNMP/Info/LLDP.pm line 455.
Use of uninitialized value $proto in numeric eq (==) at /home/netdisco/perl5/lib/perl5/SNMP/Info/LLDP.pm line 461.

reason:

invalid response returned for lldpRemManAddrIfSubtype & lldpRemManAddrIfId. 0 is not a valid value for these enumerations.

LLDP-MIB::lldpRemManAddrIfSubtype.83886080 = INTEGER: 0
LLDP-MIB::lldpRemManAddrIfSubtype.83890176 = INTEGER: ifIndex(2)
LLDP-MIB::lldpRemManAddrIfSubtype.83894272 = INTEGER: ifIndex(2)

LLDP-MIB::lldpRemManAddrIfId.83886080 = INTEGER: 0
LLDP-MIB::lldpRemManAddrIfId.83890176 = INTEGER: 5
LLDP-MIB::lldpRemManAddrIfId.83894272 = INTEGER: 5

Possible Solution

either add checks in _lldp_addr_index

or perhaps a cleaner solution, change lldp_rman_addr to a sub function that checks for correct values & return undef otherwise? https://github.com/netdisco/snmp-info/blob/0b477ae16bee143a087679d324deded668211202/lib/SNMP/Info/LLDP.pm#L91

Your Device

Your Environment