diff options
| author | Nataliia Solomko <natalirs1985@gmail.com> | 2026-03-25 14:53:23 +0200 |
|---|---|---|
| committer | Nataliia Solomko <natalirs1985@gmail.com> | 2026-03-27 16:19:01 +0200 |
| commit | 2f0ef2bfe9d36228795ae46eee23031a37ab5957 (patch) | |
| tree | 43ab55fed122346d9c2c8da0fb7eb88812768de2 /src/conf_mode/interfaces_bonding.py | |
| parent | e66c23ddf1f70fd7aa31fbc696a361a376ea15d1 (diff) | |
| download | vyos-1x-2f0ef2bfe9d36228795ae46eee23031a37ab5957.tar.gz vyos-1x-2f0ef2bfe9d36228795ae46eee23031a37ab5957.zip | |
vpp: T8419: Disallow cross-membership between VPP and kernel bonding/bridge interfaces
Diffstat (limited to 'src/conf_mode/interfaces_bonding.py')
| -rwxr-xr-x | src/conf_mode/interfaces_bonding.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/conf_mode/interfaces_bonding.py b/src/conf_mode/interfaces_bonding.py index 0b27c8cad..79363f47a 100755 --- a/src/conf_mode/interfaces_bonding.py +++ b/src/conf_mode/interfaces_bonding.py @@ -44,6 +44,7 @@ from vyos.configdict import has_address_configured from vyos.configdict import has_vrf_configured from vyos.configdep import set_dependents from vyos.configdep import call_dependents +from vyos.vpp.utils import cli_ifaces_list from vyos import ConfigError from vyos import airbag airbag.enable() @@ -170,6 +171,8 @@ def get_config(config=None): if 'static_arp' in bond: set_dependents('static_arp', conf) + bond['vpp_ifaces'] = cli_ifaces_list(conf) + return bond @@ -205,7 +208,7 @@ def verify(bond): bond_name = bond['ifname'] if dict_search('member.interface', bond): for interface, interface_config in bond['member']['interface'].items(): - error_msg = f'Can not add interface "{interface}" to bond, ' + error_msg = f'Cannot add interface "{interface}" to bond, ' if interface == 'lo': raise ConfigError('Loopback interface "lo" can not be added to a bond') @@ -239,6 +242,12 @@ def verify(bond): continue raise ConfigError(error_msg + f'it has a "{option_path.replace(".", " ")}" assigned!') + iface_base = interface.split('.')[0] # get the parent interface name + if iface_base in bond['vpp_ifaces']: + raise ConfigError( + error_msg + 'it is already configured as VPP interface' + ) + if mtu := bond.get('mtu'): mtu = int(mtu) max_mtu = int(EthernetIf(interface).get_max_mtu()) |
