summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-05-22 19:46:46 +0200
committerChristian Breunig <christian@breunig.cc>2024-05-22 19:46:46 +0200
commit3870247517741ce23e2fcee8aaa1d194f0ad621b (patch)
treed16a06aa2bed97ff5a4a521c0b81c51e0e1e41d3
parent03eae30b27433055ddc10f09fc134b83e9bd6cec (diff)
downloadvyos-1x-3870247517741ce23e2fcee8aaa1d194f0ad621b.tar.gz
vyos-1x-3870247517741ce23e2fcee8aaa1d194f0ad621b.zip
nat: T6365: use string startswith() over [0] index access
-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!')