summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-09-10 16:47:42 +0200
committerChristian Poessinger <christian@poessinger.com>2021-09-10 17:01:29 +0200
commit7a264d9e17bd918c33879ba5cd70b00bb786726a (patch)
treee126cb699d4f13b8283acc03fed376ad7795cbe9 /python
parent2abf6711e880463b9d9276b2fa9ea7b4ebcdc179 (diff)
downloadvyos-1x-7a264d9e17bd918c33879ba5cd70b00bb786726a.tar.gz
vyos-1x-7a264d9e17bd918c33879ba5cd70b00bb786726a.zip
ethernet: T3802: not all NICs support reading speed/duplex settings in all states
Turns out an AX88179 USB 3.0 NIC does not support reading back the speed and duplex settings in every operating state. While the NIC is beeing initialized, reading the speed setting will return: $ cat /sys/class/net/eth6/speed cat: /sys/class/net/eth6/speed: Invalid argument Thus if this happens, we simply tell the system that the current NIC speed matches the requested speed and nothing is changed at this point in time. (cherry picked from commit e2b7e1766cc22c5cd718a5001be6336bdca92eec)
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/ethernet.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py
index 78fec1fa2..2e59a7afc 100644
--- a/python/vyos/ifconfig/ethernet.py
+++ b/python/vyos/ifconfig/ethernet.py
@@ -142,9 +142,12 @@ class EthernetIf(Interface):
# bail out early as nothing is to change
return
else:
- # read in current speed and duplex settings
- cur_speed = read_file(f'/sys/class/net/{ifname}/speed')
- cur_duplex = read_file(f'/sys/class/net/{ifname}/duplex')
+ # XXX: read in current speed and duplex settings
+ # There are some "nice" NICs like AX88179 which do not support
+ # reading the speed thus we simply fallback to the supplied speed
+ # to not cause any change here and raise an exception.
+ cur_speed = read_file(f'/sys/class/net/{ifname}/speed', speed)
+ cur_duplex = read_file(f'/sys/class/net/{ifname}/duplex', duplex)
if (cur_speed == speed) and (cur_duplex == duplex):
# bail out early as nothing is to change
return