summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorNataliia Solomko <natalirs1985@gmail.com>2026-06-09 17:28:49 +0300
committerNataliia Solomko <natalirs1985@gmail.com>2026-06-09 18:38:00 +0300
commit32c5c4cece5f58e51065363608d1b3f78a046d29 (patch)
treefd61cb9172d6944312d6cbafdb5b5f93b05b4ad3 /python
parent6a5f1961cde6116457cb9e6b958bee7b66603c3b (diff)
downloadvyos-1x-32c5c4cece5f58e51065363608d1b3f78a046d29.tar.gz
vyos-1x-32c5c4cece5f58e51065363608d1b3f78a046d29.zip
ethtool: T8964: Fix crash when NIC does not support ring-buffer configuration
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ethtool.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/python/vyos/ethtool.py b/python/vyos/ethtool.py
index 34c884e0b..85e228ede 100644
--- a/python/vyos/ethtool.py
+++ b/python/vyos/ethtool.py
@@ -181,15 +181,17 @@ class Ethtool:
# Configuration of RX/TX ring-buffers is not supported on every device,
# thus when it's impossible return None
if rx_tx not in ['rx', 'tx']:
- ValueError('Ring-buffer type must be either "rx" or "tx"')
- return str(self._ring_buffer.get(f'{rx_tx}-max', None))
+ raise ValueError('Ring-buffer type must be either "rx" or "tx"')
+ value = self._ring_buffer.get(f'{rx_tx}-max') if self._ring_buffer else None
+ return str(value) if value is not None else None
def get_ring_buffer(self, rx_tx):
# Configuration of RX/TX ring-buffers is not supported on every device,
# thus when it's impossible return None
if rx_tx not in ['rx', 'tx']:
- ValueError('Ring-buffer type must be either "rx" or "tx"')
- return str(self._ring_buffer.get(rx_tx, None))
+ raise ValueError('Ring-buffer type must be either "rx" or "tx"')
+ value = self._ring_buffer.get(rx_tx) if self._ring_buffer else None
+ return str(value) if value is not None else None
def check_speed_duplex(self, speed, duplex):
""" Check if the passed speed and duplex combination is supported by