From 50e7577815ca2e2da80a0356815d421350df63f5 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Wed, 22 May 2024 19:46:46 +0200 Subject: nat: T6365: use string startswith() over [0] index access (cherry picked from commit 3870247517741ce23e2fcee8aaa1d194f0ad621b) --- src/conf_mode/nat.py | 4 ++-- 1 file 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!') -- cgit v1.2.3