diff options
| author | Daniil Baturin <daniil@vyos.io> | 2025-10-21 12:36:31 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-21 12:36:31 +0100 |
| commit | ad0ad372dc8e00cd12ccf024257dcb130329982e (patch) | |
| tree | 69d87b4589174e030e74bdfb706f98d9c54b06b2 /src | |
| parent | a24b9d219e3d854fa8a3e194e56ad0326c939dee (diff) | |
| parent | 28f752327510335b9dacc894973a8e708ce8fb74 (diff) | |
| download | vyos-1x-ad0ad372dc8e00cd12ccf024257dcb130329982e.tar.gz vyos-1x-ad0ad372dc8e00cd12ccf024257dcb130329982e.zip | |
Merge pull request #4805 from natali-rs1985/T7929
T7929: VPP: nat44: validate that only self-twice-nat external address is in translation pool
Diffstat (limited to 'src')
| -rw-r--r-- | src/conf_mode/vpp_nat.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/conf_mode/vpp_nat.py b/src/conf_mode/vpp_nat.py index ad82b53b4..28edbdf19 100644 --- a/src/conf_mode/vpp_nat.py +++ b/src/conf_mode/vpp_nat.py @@ -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( @@ -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"' |
