summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-08-03 22:24:10 +0200
committerChristian Poessinger <christian@poessinger.com>2019-08-03 22:24:10 +0200
commit5b15c162c008958de2be9cba2cbf8f0b65bc6fb9 (patch)
treeef2bf91bfa5f617c2614402ab5534494deac803b /src/conf_mode
parent5b836709a15e4f6a8775e5dc26609febd5bc2480 (diff)
downloadvyos-1x-5b15c162c008958de2be9cba2cbf8f0b65bc6fb9.tar.gz
vyos-1x-5b15c162c008958de2be9cba2cbf8f0b65bc6fb9.zip
[bridge] T1156: interfaces can be assigned to any one bridge only
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/interface-bridge.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/conf_mode/interface-bridge.py b/src/conf_mode/interface-bridge.py
index 637c58a5e..1c9c6ec10 100755
--- a/src/conf_mode/interface-bridge.py
+++ b/src/conf_mode/interface-bridge.py
@@ -174,8 +174,16 @@ def verify(bridge):
if bridge is None:
return None
- # validate agains other bridge interfaces that the interface is not assigned
- # to another bridge
+ conf = Config()
+ for br in conf.list_nodes('interfaces bridge'):
+ # it makes no sense to verify ourself in this case
+ if br == bridge['br_name']:
+ continue
+
+ for intf in bridge['member']:
+ tmp = conf.list_nodes('interfaces bridge {} member interface'.format(br))
+ if intf['name'] in tmp:
+ raise ConfigError('{} can be assigned to any one bridge only'.format(intf['name']))
return None