summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarius Lindvall <marius@varden.info>2026-01-01 22:42:10 +0100
committerMarius Lindvall <marius@varden.info>2026-01-01 22:42:10 +0100
commit95f40d8b30f03a47b022042ed8b3c179b0e7abdf (patch)
treecf4f451c23bbe59179d7ca01199ab3ab3ad31e97 /src
parent76830afc8703a3f9f6be7500cb92aa9b6e255425 (diff)
downloadvyos-1x-95f40d8b30f03a47b022042ed8b3c179b0e7abdf.tar.gz
vyos-1x-95f40d8b30f03a47b022042ed8b3c179b0e7abdf.zip
nat66: T8139: add support for NAT66 source groups
Copy the support for NAT66 destination groups (commit f96733dd and commit 43554efc) over to NAT66 source groups as well. Change the existing smoketest for NAT66 groups to also cover a source group use-case example.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/nat66.py14
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