summaryrefslogtreecommitdiff
path: root/src/validators/allowed-vlan
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-01-16 08:42:41 +0100
committerGitHub <noreply@github.com>2021-01-16 08:42:41 +0100
commit3315af9ab8b570ada24a3f68ab0a18f84274186b (patch)
tree8fe8d4459c88c2403803fbde983575d4bea696be /src/validators/allowed-vlan
parent56ec3259b67c6441d992948a8bae95039194eb6c (diff)
parent2d1e8a2fdba707aaae46b9f136aa8dd171ff8f3d (diff)
downloadvyos-1x-3315af9ab8b570ada24a3f68ab0a18f84274186b.tar.gz
vyos-1x-3315af9ab8b570ada24a3f68ab0a18f84274186b.zip
Merge pull request #677 from jack9603301/T3137
bridge: T3137: Let VLAN aware bridge approach the behavior of professional equipment
Diffstat (limited to 'src/validators/allowed-vlan')
-rwxr-xr-xsrc/validators/allowed-vlan19
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)