diff options
author | Christian Breunig <christian@breunig.cc> | 2024-05-22 19:46:46 +0200 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2024-05-22 19:46:46 +0200 |
commit | 3870247517741ce23e2fcee8aaa1d194f0ad621b (patch) | |
tree | d16a06aa2bed97ff5a4a521c0b81c51e0e1e41d3 /src/conf_mode | |
parent | 03eae30b27433055ddc10f09fc134b83e9bd6cec (diff) | |
download | vyos-1x-3870247517741ce23e2fcee8aaa1d194f0ad621b.tar.gz vyos-1x-3870247517741ce23e2fcee8aaa1d194f0ad621b.zip |
nat: T6365: use string startswith() over [0] index access
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-x | src/conf_mode/nat.py | 4 |
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!') |