summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2025-12-23 13:43:55 +0000
committerGitHub <noreply@github.com>2025-12-23 13:43:55 +0000
commit583b29ba947d8c8ab4bdcd02b4af7d4d2bf80ca0 (patch)
tree46980081529dd701ae0f3d5e016266930fadec09 /python
parentf4f19d33b5568fe14117b0c55fc4ccf423541730 (diff)
parent066d2be8b3d57b2171aa2056c7d953810f50dcb8 (diff)
downloadvyos-1x-583b29ba947d8c8ab4bdcd02b4af7d4d2bf80ca0.tar.gz
vyos-1x-583b29ba947d8c8ab4bdcd02b4af7d4d2bf80ca0.zip
Merge pull request #4911 from c-po/bond-ena
bond: T8084: disallow bond members that do not support MAC changes
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ethtool.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/python/vyos/ethtool.py b/python/vyos/ethtool.py
index 22e066def..d0495df43 100644
--- a/python/vyos/ethtool.py
+++ b/python/vyos/ethtool.py
@@ -25,6 +25,11 @@ _drivers_without_speed_duplex_flow = ['vmxnet3', 'virtio_net', 'xen_netfront',
'iavf', 'ice', 'i40e', 'hv_netvsc', 'veth', 'ixgbevf',
'tun', 'vif']
+_drivers_without_mac_change = ['ena']
+# enable interface bonding will change the interface MAC address, thus all drivers
+# not supporting MAC address change, also do not support bonding
+_drivers_without_bonding_support = _drivers_without_mac_change + []
+
class Ethtool:
"""
Class is used to retrive and cache information about an ethernet adapter
@@ -222,3 +227,11 @@ class Ethtool:
matches = re.findall(rf'{rx_tx_comb}:\s+(\d+)', self._channels)
return [int(value) for value in matches]
+
+ def check_mac_change(self) -> bool:
+ """ Check if ethernet drivers supports changing MAC address """
+ return bool(self.get_driver_name() not in _drivers_without_mac_change)
+
+ def check_bonding(self) -> bool:
+ """ Check if ethernet drivers supports bonding """
+ return bool(self.get_driver_name() not in _drivers_without_bonding_support)