diff options
| author | Daniil Baturin <daniil@vyos.io> | 2025-12-23 13:43:55 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-23 13:43:55 +0000 |
| commit | 583b29ba947d8c8ab4bdcd02b4af7d4d2bf80ca0 (patch) | |
| tree | 46980081529dd701ae0f3d5e016266930fadec09 /src/conf_mode/interfaces_bonding.py | |
| parent | f4f19d33b5568fe14117b0c55fc4ccf423541730 (diff) | |
| parent | 066d2be8b3d57b2171aa2056c7d953810f50dcb8 (diff) | |
| download | vyos-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 'src/conf_mode/interfaces_bonding.py')
| -rwxr-xr-x | src/conf_mode/interfaces_bonding.py | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/conf_mode/interfaces_bonding.py b/src/conf_mode/interfaces_bonding.py index f844d0a21..e6aaa3440 100755 --- a/src/conf_mode/interfaces_bonding.py +++ b/src/conf_mode/interfaces_bonding.py @@ -30,11 +30,11 @@ from vyos.configverify import verify_mirror_redirect from vyos.configverify import verify_mtu_ipv6 from vyos.configverify import verify_vlan_config from vyos.configverify import verify_vrf +from vyos.ethtool import Ethtool from vyos.frrender import FRRender from vyos.frrender import get_frrender_dict from vyos.ifconfig import BondIf from vyos.ifconfig.ethernet import EthernetIf -from vyos.ifconfig import Section from vyos.utils.assertion import assert_mac from vyos.utils.dict import dict_search from vyos.utils.dict import dict_to_paths_values @@ -114,8 +114,7 @@ def get_config(config=None): # ethernet commit again in apply function # to apply options under ethernet section set_dependents('ethernet', conf, interface) - section = Section.section(interface) # this will be 'ethernet' for 'eth0' - if conf.exists([section, interface, 'disable']): + if conf.exists(['ethernet', interface, 'disable']): tmp[interface] = {'disable': ''} else: tmp[interface] = {} @@ -144,14 +143,8 @@ def get_config(config=None): bond['shutdown_required'] = {} bond['member']['interface'][interface].update({'new_added' : {}}) - # Check if member interface is disabled - conf.set_level(['interfaces']) - - section = Section.section(interface) # this will be 'ethernet' for 'eth0' - if conf.exists([section, interface, 'disable']): - if tmp: bond['member']['interface'][interface].update({'disable': ''}) - - conf.set_level(old_level) + if 'disable' in interface_ethernet_config: + bond['member']['interface'][interface].update({'disable': ''}) # Check if member interface is already member of another bridge tmp = is_member(conf, interface, 'bridge') @@ -259,6 +252,10 @@ def verify(bond): raise ConfigError('Configured MTU is less then member '\ f'interface "{interface}" minimum of {min_mtu}!') + # not all ethernet drivers support interface bonding + if not Ethtool(interface).check_bonding(): + raise ConfigError(error_msg + 'driver is not supported!') + if 'primary' in bond: if bond['primary'] not in bond['member']['interface']: raise ConfigError(f'Primary interface of bond "{bond_name}" must be a member interface') |
