Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/conf_mode/vpp_nat.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,6 @@ def verify(config):
f'{error_msg} external address/port is already in use!'
)
addresses_with_ports.add(pair)
if ext_address not in addresses_translation:
raise ConfigError(
f'{error_msg} external address {ext_address} is not in "address-pool translation"'
)

else:
if ext_address in addresses_without_ports or any(
Expand All @@ -300,6 +296,13 @@ def verify(config):
local_addresses.add(local_address)

options = rule_config.get('options', {})

if 'self_twice_nat' in options and ext_address not in addresses_translation:
raise ConfigError(
f'{error_msg} external address {ext_address} must be part of '
'"address-pool translation" when using self-twice-nat'
)

if all(key in options for key in ('twice_nat', 'self_twice_nat')):
raise ConfigError(
f'{error_msg} cannot set both options "twice-nat" and "self-twice-nat"'
Expand Down
Loading