diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-01-05 16:12:50 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-05 16:12:50 +0100 |
| commit | 0da5b3c18ef56ab13cabbbf874f41e8c5b35a518 (patch) | |
| tree | 35ec3a0d999f977718b26ec5e6507b935148c7e0 /src | |
| parent | 1fc20e61560d26abec5277a62a318070c8596437 (diff) | |
| parent | 95f40d8b30f03a47b022042ed8b3c179b0e7abdf (diff) | |
| download | vyos-1x-0da5b3c18ef56ab13cabbbf874f41e8c5b35a518.tar.gz vyos-1x-0da5b3c18ef56ab13cabbbf874f41e8c5b35a518.zip | |
Merge pull request #4928 from bilde2910/T8139
nat66: T8139: add support for NAT66 source groups
Diffstat (limited to 'src')
| -rwxr-xr-x | src/conf_mode/nat66.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/conf_mode/nat66.py b/src/conf_mode/nat66.py index aea187d18..c3637c6b9 100755 --- a/src/conf_mode/nat66.py +++ b/src/conf_mode/nat66.py @@ -92,10 +92,14 @@ def verify(nat): if prefix != None: if not is_ipv6(prefix): raise ConfigError(f'{err_msg} source-prefix not specified') - + + if 'source' in config and 'group' in config['source']: + if len({'address_group', 'network_group', 'domain_group'} & set(config['source']['group'])) > 1: + raise ConfigError('Only one source address-group, network-group or domain-group can be specified') + if 'destination' in config and 'group' in config['destination']: if len({'address_group', 'network_group', 'domain_group'} & set(config['destination']['group'])) > 1: - raise ConfigError('Only one address-group, network-group or domain-group can be specified') + raise ConfigError('Only one destination address-group, network-group or domain-group can be specified') if dict_search('destination.rule', nat): for rule, config in dict_search('destination.rule', nat).items(): @@ -112,9 +116,13 @@ def verify(nat): if not interface_exists(interface_name): Warning(f'Interface "{interface_name}" for destination NAT66 rule "{rule}" does not exist!') + if 'source' in config and 'group' in config['source']: + if len({'address_group', 'network_group', 'domain_group'} & set(config['source']['group'])) > 1: + raise ConfigError('Only one source address-group, network-group or domain-group can be specified') + if 'destination' in config and 'group' in config['destination']: if len({'address_group', 'network_group', 'domain_group'} & set(config['destination']['group'])) > 1: - raise ConfigError('Only one address-group, network-group or domain-group can be specified') + raise ConfigError('Only one destination address-group, network-group or domain-group can be specified') return None |
