summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-01-11 20:46:16 +0100
committerGitHub <noreply@github.com>2022-01-11 20:46:16 +0100
commit968afb9e67a2267d248af5c127c4086bcd80374e (patch)
tree4cb8c9128c69cf8d43a52b3a052613046bc1ffc0
parentb55ac8e2c06c593c9f2310cc510bac45c6943ce7 (diff)
parent4793e2fc0baf09c8ef128147106acb8bb69ba02b (diff)
downloadvyos-1x-968afb9e67a2267d248af5c127c4086bcd80374e.tar.gz
vyos-1x-968afb9e67a2267d248af5c127c4086bcd80374e.zip
Merge pull request #1160 from bjw-s/T4174
firewall: validators: T4174: Correct upper port range boundary
-rwxr-xr-xsrc/validators/port-multi4
-rwxr-xr-xsrc/validators/port-range4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/validators/port-multi b/src/validators/port-multi
index 763d34e57..017ea78fb 100755
--- a/src/validators/port-multi
+++ b/src/validators/port-multi
@@ -24,14 +24,14 @@ if __name__ == '__main__':
for port in ports:
if re.match('^[0-9]{1,5}-[0-9]{1,5}$', port):
port_1, port_2 = port.split('-')
- if int(port_1) not in range(1, 65535) or int(port_2) not in range(1, 65535):
+ if int(port_1) not in range(1, 65536) or int(port_2) not in range(1, 65536):
print(f'Error: {port} is not a valid port range')
sys.exit(1)
if int(port_1) > int(port_2):
print(f'Error: {port} is not a valid port range')
sys.exit(1)
elif port.isnumeric():
- if int(port) not in range(1, 65535):
+ if int(port) not in range(1, 65536):
print(f'Error: {port} is not a valid port')
sys.exit(1)
elif port not in services:
diff --git a/src/validators/port-range b/src/validators/port-range
index 657a21e20..6c01048f0 100755
--- a/src/validators/port-range
+++ b/src/validators/port-range
@@ -12,11 +12,11 @@ if __name__ == '__main__':
port_range = sys.argv[1]
if re.match('^[0-9]{1,5}-[0-9]{1,5}$', port_range):
port_1, port_2 = port_range.split('-')
- if int(port_1) not in range(1, 65535) or int(port_2) not in range(1, 65535):
+ if int(port_1) not in range(1, 65536) or int(port_2) not in range(1, 65536):
error(port_range)
if int(port_1) > int(port_2):
error(port_range)
- elif not port_range.isnumeric() or int(port_range) not in range(1, 65535):
+ elif not port_range.isnumeric() or int(port_range) not in range(1, 65536):
error(port_range)
else:
sys.exit(2)