Skip to content

Commit

Permalink
nat: T6365: use string startswith() over [0] index access
Browse files Browse the repository at this point in the history
  • Loading branch information
c-po committed May 22, 2024
1 parent 03eae30 commit 3870247
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/conf_mode/nat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!')
Expand Down Expand Up @@ -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!')
Expand Down

0 comments on commit 3870247

Please sign in to comment.