diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-04-07 22:02:49 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-04-07 22:02:49 +0200 |
commit | fcce4714146a39f608ddd141338547a5a952c63f (patch) | |
tree | 3b521908928e0cae15c2e8f8979088b5f7d2c0a5 /src/conf_mode/interfaces-openvpn.py | |
parent | 681576fff6a268ed04ae1a73ad7771882672cdb6 (diff) | |
download | vyos-1x-fcce4714146a39f608ddd141338547a5a952c63f.tar.gz vyos-1x-fcce4714146a39f608ddd141338547a5a952c63f.zip |
bridge: T2232: prevent deletion of enslaved interfaces
Interfaces enslaved to a bridge are not allowed to be deleted. If an interface
is deleted from the config but it is still enslaved to a bridge will cause a
configuration error on the subsequent boot.
Diffstat (limited to 'src/conf_mode/interfaces-openvpn.py')
-rwxr-xr-x | src/conf_mode/interfaces-openvpn.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/conf_mode/interfaces-openvpn.py b/src/conf_mode/interfaces-openvpn.py index 1fe1143cd..e9b40bb38 100755 --- a/src/conf_mode/interfaces-openvpn.py +++ b/src/conf_mode/interfaces-openvpn.py @@ -31,7 +31,7 @@ from shutil import rmtree from vyos.config import Config from vyos.defaults import directories as vyos_data_dir from vyos.ifconfig import VTunIf -from vyos.util import process_running, cmd +from vyos.util import process_running, cmd, is_bridge_member from vyos.validate import is_addr_assigned from vyos import ConfigError @@ -444,8 +444,16 @@ def get_config(): def verify(openvpn): if openvpn['deleted']: + interface = openvpn['intf'] + is_member, bridge = is_bridge_member(interface) + if is_member: + # can not use a f'' formatted-string here as bridge would not get + # expanded in the print statement + raise ConfigError('Can not delete interface "{0}" as it ' \ + 'is a member of bridge "{1}"!'.format(interface, bridge)) return None + if not openvpn['mode']: raise ConfigError('Must specify OpenVPN operation mode') |