diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-08-22 15:13:48 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-08-22 15:13:48 +0200 |
commit | 785af7cf6603a81adc432537bf97987f59d818a3 (patch) | |
tree | 74f6187a69e597608647a9c6aebe57707b291dce /src/validators/allowed-vlan | |
parent | 5567b9ae59cdd2137fa7d7250fd84f31093eb1cc (diff) | |
download | vyos-1x-785af7cf6603a81adc432537bf97987f59d818a3.tar.gz vyos-1x-785af7cf6603a81adc432537bf97987f59d818a3.zip |
bridge: T3137: backport vlan features from 1.4 current
Diffstat (limited to 'src/validators/allowed-vlan')
-rwxr-xr-x | src/validators/allowed-vlan | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/validators/allowed-vlan b/src/validators/allowed-vlan new file mode 100755 index 000000000..11389390b --- /dev/null +++ b/src/validators/allowed-vlan @@ -0,0 +1,19 @@ +#! /usr/bin/python3 + +import sys +import re + +if __name__ == '__main__': + if len(sys.argv)>1: + allowed_vlan = sys.argv[1] + if re.search('[0-9]{1,4}-[0-9]{1,4}', allowed_vlan): + for tmp in allowed_vlan.split('-'): + if int(tmp) not in range(1, 4095): + sys.exit(1) + else: + if int(allowed_vlan) not in range(1, 4095): + sys.exit(1) + else: + sys.exit(2) + + sys.exit(0) |