diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-04-27 19:20:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-27 19:20:49 +0200 |
commit | af108d812d1506a38feee7061fe935639dcc63a6 (patch) | |
tree | 2b0c4f700d71323e957667897a5d5ab420ea5549 /src/validators | |
parent | 41152d41a18fc75f91e105a7a85ccc64e67a99c0 (diff) | |
parent | b141b56e6779644826129cf0899a87f28058c7ea (diff) | |
download | vyos-1x-af108d812d1506a38feee7061fe935639dcc63a6.tar.gz vyos-1x-af108d812d1506a38feee7061fe935639dcc63a6.zip |
Merge pull request #818 from sever-sever/T2216-ports
container: T2216: Add binding for ports and volumes
Diffstat (limited to 'src/validators')
-rwxr-xr-x | src/validators/port-range | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/validators/port-range b/src/validators/port-range new file mode 100755 index 000000000..abf0b09d5 --- /dev/null +++ b/src/validators/port-range @@ -0,0 +1,19 @@ +#!/usr/bin/python3 + +import sys +import re + +if __name__ == '__main__': + if len(sys.argv)>1: + port_range = sys.argv[1] + if re.search('[0-9]{1,5}-[0-9]{1,5}', port_range): + for tmp in port_range.split('-'): + if int(tmp) not in range(1, 65535): + sys.exit(1) + else: + if int(port_range) not in range(1, 65535): + sys.exit(1) + else: + sys.exit(2) + + sys.exit(0) |