Skip to content

Commit ad0ad37

Browse files
authored
Merge pull request #4805 from natali-rs1985/T7929
T7929: VPP: nat44: validate that only self-twice-nat external address is in translation pool
2 parents a24b9d2 + 28f7523 commit ad0ad37

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/conf_mode/vpp_nat.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,6 @@ def verify(config):
279279
f'{error_msg} external address/port is already in use!'
280280
)
281281
addresses_with_ports.add(pair)
282-
if ext_address not in addresses_translation:
283-
raise ConfigError(
284-
f'{error_msg} external address {ext_address} is not in "address-pool translation"'
285-
)
286282

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

302298
options = rule_config.get('options', {})
299+
300+
if 'self_twice_nat' in options and ext_address not in addresses_translation:
301+
raise ConfigError(
302+
f'{error_msg} external address {ext_address} must be part of '
303+
'"address-pool translation" when using self-twice-nat'
304+
)
305+
303306
if all(key in options for key in ('twice_nat', 'self_twice_nat')):
304307
raise ConfigError(
305308
f'{error_msg} cannot set both options "twice-nat" and "self-twice-nat"'

0 commit comments

Comments
 (0)