summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces-bridge.py
diff options
context:
space:
mode:
authorJernej Jakob <jernej.jakob@gmail.com>2020-05-01 17:45:20 +0200
committerJernej Jakob <jernej.jakob@gmail.com>2020-05-04 22:59:39 +0200
commitf81ca22c1988495943531cba11add7cfc9441033 (patch)
treee3076a082789e0c56bc6ce2db85ee8a4eccd79a1 /src/conf_mode/interfaces-bridge.py
parent6f784231283ec3a63335145e914f2b15e28795dc (diff)
downloadvyos-1x-f81ca22c1988495943531cba11add7cfc9441033.tar.gz
vyos-1x-f81ca22c1988495943531cba11add7cfc9441033.zip
bridge: T2241: disallow adding interfaces with addresses to bridge
Diffstat (limited to 'src/conf_mode/interfaces-bridge.py')
-rwxr-xr-xsrc/conf_mode/interfaces-bridge.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/conf_mode/interfaces-bridge.py b/src/conf_mode/interfaces-bridge.py
index 3f54e0dc3..fe3675190 100755
--- a/src/conf_mode/interfaces-bridge.py
+++ b/src/conf_mode/interfaces-bridge.py
@@ -23,7 +23,7 @@ from netifaces import interfaces
from vyos.ifconfig import BridgeIf, Section
from vyos.ifconfig.stp import STP
from vyos.configdict import list_diff
-from vyos.validate import is_member
+from vyos.validate import is_member, has_address_configured
from vyos.config import Config
from vyos.util import cmd, get_bridge_member_config
from vyos import ConfigError
@@ -268,6 +268,12 @@ def verify(bridge):
f'Cannot add interface "{intf["name"]}" to bridge '
f'"{bridge["intf"]}", it is already a member of bond "{tmp}"!'))
+ # bridge members must not have an assigned address
+ if has_address_configured(conf, intf['name']):
+ raise ConfigError((
+ f'Cannot add interface "{intf["name"]}" to bridge '
+ f'"{bridge["intf"]}", it has an address assigned!'))
+
return None
def generate(bridge):