diff options
author | jack9603301 <jack9603301@163.com> | 2021-01-16 13:32:50 +0800 |
---|---|---|
committer | jack9603301 <jack9603301@163.com> | 2021-01-16 13:32:50 +0800 |
commit | 2d1e8a2fdba707aaae46b9f136aa8dd171ff8f3d (patch) | |
tree | 062451e331c02dd6d1617fbbe775b5e76871c721 /src/conf_mode/interfaces-bridge.py | |
parent | c759e4030441ddb891657a6ed03cae8a9bfb980a (diff) | |
download | vyos-1x-2d1e8a2fdba707aaae46b9f136aa8dd171ff8f3d.tar.gz vyos-1x-2d1e8a2fdba707aaae46b9f136aa8dd171ff8f3d.zip |
bridge: T3137: Improved verification logic
Diffstat (limited to 'src/conf_mode/interfaces-bridge.py')
-rwxr-xr-x | src/conf_mode/interfaces-bridge.py | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/conf_mode/interfaces-bridge.py b/src/conf_mode/interfaces-bridge.py index 4817947eb..ca2718423 100755 --- a/src/conf_mode/interfaces-bridge.py +++ b/src/conf_mode/interfaces-bridge.py @@ -138,23 +138,10 @@ def verify(bridge): if 'wlan' in interface: raise ConfigError(error_msg + 'VLAN aware cannot be set!') - - if 'allowed_vlan' in interface_config: - for vlan in interface_config['allowed_vlan']: - if re.search('[0-9]{1,4}-[0-9]{1,4}', vlan): - vlan_range = vlan.split('-') - if int(vlan_range[0]) <1 and int(vlan_range[0])>4094: - raise ConfigError('VLAN ID must be between 1 and 4094') - if int(vlan_range[1]) <1 and int(vlan_range[1])>4094: - raise ConfigError('VLAN ID must be between 1 and 4094') - else: - if int(vlan) <1 and int(vlan)>4094: - raise ConfigError('VLAN ID must be between 1 and 4094') else: - if 'allowed_vlan' in interface_config: - raise ConfigError(f'You must first activate "enable-vlan" of {ifname} bridge to use "allowed-vlan"') - if 'native_vlan' in interface_config: - raise ConfigError(f'You must first activate "enable-vlan" of {ifname} bridge to use "native-vlan"') + for option in ['allowed_vlan', 'native_vlan']: + if option in interface_config: + raise ConfigError('Can not use VLAN options on non VLAN aware bridge') if 'enable_vlan' in bridge: if dict_search('vif.1', bridge): |