Page MenuHomeVyOS Platform

`show snmp mib ifmib` crashes with IndexError
Closed, ResolvedPublic

Description

After run command show snmp mib ifmib and lspci not returned values script crashed

lo:     ifIndex = 1
        ifAlias = lo
        ifDescr = lo
eth0:   ifIndex = 2
        ifAlias = OUTSIDE
Traceback (most recent call last):
  File "/usr/libexec/vyos/op_mode/snmp_ifmib.py", line 126, in <module>
    print('\t{0}'.format(show_ifdescr(i)))
  File "/usr/libexec/vyos/op_mode/snmp_ifmib.py", line 82, in show_ifdescr
    vendor = string[3]
IndexError: list index out of range

Returned values

sudo cat /sys/class/net/eth0/device/vendor
 0x1af4
sudo cat /sys/class/net/eth0/device/device
0x0001
/usr/bin/lspci -mm -d 0x1af4:0x0001

needs add additional check

Details

Difficulty level
Unknown (require assessment)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)

Event Timeline

Unknown Object (User) created this task.Aug 10 2019, 7:42 PM
Unknown Object (User) created this object in space S1 VyOS Public.
Unknown Object (User) updated the task description. (Show Details)
Unknown Object (User) changed the task status from Open to Needs testing.Nov 28 2019, 12:27 PM
Unknown Object (User) claimed this task.
Unknown Object (User) added a project: VyOS 1.2 Crux (VyOS 1.2.4).
Unknown Object (User) set Is it a breaking change? to Unspecified (possibly destroys the router).
Unknown Object (User) added a comment.Nov 28 2019, 12:32 PM

This patch successfully tested on VyOS 1.2.3

vyos@vyos# run show snmp mib ifmib 
lo:     ifIndex = 1
        ifAlias = lo
        ifDescr = lo
eth0:   ifIndex = 2
        ifAlias = eth0
        ifDescr =  
eth1:   ifIndex = 3
        ifAlias = eth1
        ifDescr =  
eth2:   ifIndex = 4
        ifAlias = eth2
        ifDescr =  
eth3:   ifIndex = 5
        ifAlias = eth3
        ifDescr =
syncer changed the task status from Needs testing to Backport pending.Jan 1 2020, 1:02 PM
syncer reassigned this task from Unknown Object (User) to jestabro.
syncer triaged this task as Normal priority.
syncer moved this task from Need Triage to Finished on the VyOS 1.3 Equuleus board.
erkin renamed this task from `show snmp mib ifmib` crashed to `show snmp mib ifmib` crashes with IndexError.Sep 9 2020, 1:00 PM