summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces-bridge.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-09-22 18:37:00 +0200
committerChristian Poessinger <christian@poessinger.com>2020-09-22 18:38:35 +0200
commit83a9ce7991195c709736eec234fea3d60cde7582 (patch)
tree763b1c5b113dab172c6f1f00cdef2c1ca58316d3 /src/conf_mode/interfaces-bridge.py
parentd28a6a516d449ede788816574c35061fbf7d6485 (diff)
downloadvyos-1x-83a9ce7991195c709736eec234fea3d60cde7582.tar.gz
vyos-1x-83a9ce7991195c709736eec234fea3d60cde7582.zip
ifconfig: T2653: bond: bridge: ensure member interface is not a source-interface
As we already check that a bond/bridge member interface is not a member of any other bridge or bond, the check must be extended. We also need to ensure that the bond member interface is not used as a source-interface to pppoe, macsec, tunnel, pseudo-ethernet, vxlan interfaces.
Diffstat (limited to 'src/conf_mode/interfaces-bridge.py')
-rwxr-xr-xsrc/conf_mode/interfaces-bridge.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/conf_mode/interfaces-bridge.py b/src/conf_mode/interfaces-bridge.py
index 3bddac023..485decb17 100755
--- a/src/conf_mode/interfaces-bridge.py
+++ b/src/conf_mode/interfaces-bridge.py
@@ -23,6 +23,7 @@ from vyos.config import Config
from vyos.configdict import get_interface_dict
from vyos.configdict import node_changed
from vyos.configdict import is_member
+from vyos.configdict import is_source_interface
from vyos.configverify import verify_dhcpv6
from vyos.configverify import verify_vrf
from vyos.ifconfig import BridgeIf
@@ -80,6 +81,9 @@ def get_config(config=None):
tmp = is_member(conf, interface, 'bonding')
if tmp: interface_config.update({'is_bond_member' : tmp})
+ # Check if member interface is used as source-interface on another interface
+ tmp = is_source_interface(conf, interface)
+ if tmp: interface_config.update({'is_source_interface' : tmp})
# Bridge members must not have an assigned address
tmp = has_address_configured(conf, interface)
@@ -112,6 +116,10 @@ def verify(bridge):
tmp = interface_config['is_bond_member']
raise ConfigError(error_msg + f'it is already a member of bond "{tmp}"!')
+ if 'is_source_interface' in interface_config:
+ tmp = interface_config['is_source_interface']
+ raise ConfigError(error_msg + f'it is the source-interface of "{tmp}"!')
+
if 'has_address' in interface_config:
raise ConfigError(error_msg + 'it has an address assigned!')