Page MenuHomeVyOS Platform

ethtool.py:Ethtool.__init__ has always true conditional due to typo
Closed, ResolvedPublicBUG

Description

Due to typo, conditional on init is always true:

if 'Supports auto-negotiation:':
    # Split the following string: Auto-negotiation: off
    # we are only interested in off or on
    tmp = line.split()[-1]
    self._auto_negotiation_supported = bool(tmp == 'Yes')

Results in the following interface config:

+ eth6 {
+     description "HOME"
+     vif 20 {
+         address "10.0.20.26/23"
+         description "TRUSTED"
+     }
+     vif 24 {
+         address "10.0.24.26/23"
+         description "UNTRUSTED"
+     }
+ }

Producing the following error:

Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/interfaces-ethernet.py", line 218, in <module>
    verify(c)
  File "/usr/libexec/vyos/conf_mode/interfaces-ethernet.py", line 91, in verify
    ethtool = Ethtool(ifname)
              ^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/vyos/ethtool.py", line 87, in __init__
    tmp = line.split()[-1]
          ~~~~~~~~~~~~^^^^
IndexError: list index out of range

Details

Difficulty level
Easy (less than an hour)
Version
vyos-1.4-rolling-202305060317
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)