summaryrefslogtreecommitdiff
path: root/src/conf_mode/nat.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-05-22 19:46:46 +0200
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-05-22 18:02:02 +0000
commit50e7577815ca2e2da80a0356815d421350df63f5 (patch)
tree0f973f7b7dec4ea4c6909d265ecdc6b0169d442b /src/conf_mode/nat.py
parentc64d877d2a1fdf6a596a5c4036b3d045703b5931 (diff)
downloadvyos-1x-50e7577815ca2e2da80a0356815d421350df63f5.tar.gz
vyos-1x-50e7577815ca2e2da80a0356815d421350df63f5.zip
nat: T6365: use string startswith() over [0] index access
(cherry picked from commit 3870247517741ce23e2fcee8aaa1d194f0ad621b)
Diffstat (limited to 'src/conf_mode/nat.py')
-rwxr-xr-xsrc/conf_mode/nat.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/conf_mode/nat.py b/src/conf_mode/nat.py
index 056351986..db02ca66f 100755
--- a/src/conf_mode/nat.py
+++ b/src/conf_mode/nat.py
@@ -151,7 +151,7 @@ def verify(nat):
elif 'name' in config['outbound_interface']:
interface_name = config['outbound_interface']['name']
if interface_name not in 'any':
- if interface_name[0] == '!':
+ if interface_name.startswith('!'):
interface_name = interface_name[1:]
if interface_name not in interfaces():
Warning(f'NAT interface "{interface_name}" for source NAT rule "{rule}" does not exist!')
@@ -188,7 +188,7 @@ def verify(nat):
elif 'name' in config['inbound_interface']:
interface_name = config['inbound_interface']['name']
if interface_name not in 'any':
- if interface_name[0] == '!':
+ if interface_name.startswith('!'):
interface_name = interface_name[1:]
if interface_name not in interfaces():
Warning(f'NAT interface "{interface_name}" for destination NAT rule "{rule}" does not exist!')