diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-08-26 16:20:03 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-08-26 16:20:03 +0200 |
commit | 4a8ab14dc3cbe4245b95250c51ee427eb6241372 (patch) | |
tree | 0c2565357da5fbd9cb64cff484e80bbbe8c24c90 /src/conf_mode | |
parent | d5e9512b8461f55d276182b4a75267378aa11f50 (diff) | |
download | vyos-1x-4a8ab14dc3cbe4245b95250c51ee427eb6241372.tar.gz vyos-1x-4a8ab14dc3cbe4245b95250c51ee427eb6241372.zip |
bridge: T1608: deny adding non existing interfaces to bridge config
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-x | src/conf_mode/interface-bridge.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/conf_mode/interface-bridge.py b/src/conf_mode/interface-bridge.py index fc1243867..c5c5bd4ac 100755 --- a/src/conf_mode/interface-bridge.py +++ b/src/conf_mode/interface-bridge.py @@ -23,6 +23,7 @@ import subprocess import vyos.configinterface as VyIfconfig +from netifaces import interfaces from vyos.config import Config from vyos import ConfigError @@ -189,6 +190,10 @@ def verify(bridge): if intf['name'] in tmp: raise ConfigError('Interface "{}" belongs to bridge "{}" and can not be enslaved.'.format(intf['name'], bridge['intf'])) + # the interface must exist prior adding it to a bridge + for intf in bridge['member']: + if intf['name'] not in interfaces(): + raise ConfigError('Can not add non existing interface "{}" to bridge "{}"'.format(intf['name'], bridge['intf'])) return None |