summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-20 19:31:29 +0200
committerGitHub <noreply@github.com>2020-04-20 19:31:29 +0200
commitae6f1052b1d90f0f56a367c661c810608527f4d6 (patch)
tree2ae7765f81e64fb353f1b8ea6c9da517f61b89cd /src/conf_mode
parenta176ab7329df15aea2cdb260361fb75c11244905 (diff)
parent4441ea511bac21828817f1c6a66af9c68d583bc3 (diff)
downloadvyos-1x-ae6f1052b1d90f0f56a367c661c810608527f4d6.tar.gz
vyos-1x-ae6f1052b1d90f0f56a367c661c810608527f4d6.zip
Merge pull request #358 from thomas-mangin/T2320
bridge: T2320: add to tunnel
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/interfaces-tunnel.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/conf_mode/interfaces-tunnel.py b/src/conf_mode/interfaces-tunnel.py
index 06c2ea29b..be0279bd2 100755
--- a/src/conf_mode/interfaces-tunnel.py
+++ b/src/conf_mode/interfaces-tunnel.py
@@ -25,7 +25,7 @@ from vyos.config import Config
from vyos.ifconfig import Interface, GREIf, GRETapIf, IPIPIf, IP6GREIf, IPIP6If, IP6IP6If, SitIf, Sit6RDIf
from vyos.ifconfig.afi import IP4, IP6
from vyos.configdict import list_diff
-from vyos.validate import is_ipv4, is_ipv6
+from vyos.validate import is_ipv4, is_ipv6, is_bridge_member
from vyos import ConfigError
from vyos.dicts import FixedDict
@@ -275,6 +275,7 @@ default_config_data = {
'tclass': 'inherit',
'6rd-prefix': '',
'6rd-relay-prefix': '',
+ 'bridge': '',
}
# dict name -> config name, multiple values, default
@@ -405,6 +406,9 @@ def get_config():
ct = conf.get_config_dict()['tunnel']
options['tunnel'] = {}
+ # check for bridges
+ options['bridge'] = is_bridge_member(conf, ifname)
+
for name in ct:
tunnel = ct[name]
encap = tunnel.get('encapsulation', '')
@@ -429,6 +433,11 @@ def verify(conf):
if changes['section'] == 'delete':
if ifname in options['nhrp']:
raise ConfigError(f'Can not delete interface tunnel {iftype} {ifname}, it is used by nhrp')
+
+ bridge = changes['bridge']
+ if bridge:
+ raise ConfigError(f'Interface "{ifname}" can not be deleted as it belongs to bridge "{bridge}"!')
+
# done, bail out early
return None