summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2024-05-29 10:19:45 +0200
committerGitHub <noreply@github.com>2024-05-29 10:19:45 +0200
commitdb4c7f15b16b1d9730066d4ca42d7a500284443f (patch)
treedcb18b3b5f84e9e89bd72febe3c15c35282edd7c /src/conf_mode
parentdf6ae88f6e366c015dfe55deb8e88ee67e0d5af5 (diff)
parent55e02bef4f3aeff5e33cddc79f22b93fc671e491 (diff)
downloadvyos-1x-db4c7f15b16b1d9730066d4ca42d7a500284443f.tar.gz
vyos-1x-db4c7f15b16b1d9730066d4ca42d7a500284443f.zip
Merge pull request #3534 from sever-sever/T6411
T6411: CGNAT fix sequences for external address ranges
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/nat_cgnat.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/conf_mode/nat_cgnat.py b/src/conf_mode/nat_cgnat.py
index 5ad65de80..957b12c28 100755
--- a/src/conf_mode/nat_cgnat.py
+++ b/src/conf_mode/nat_cgnat.py
@@ -252,7 +252,11 @@ def generate(config):
ext_pool_name: str = rule_config['translation']['pool']
int_pool_name: str = rule_config['source']['pool']
- external_ranges: list = [range for range in config['pool']['external'][ext_pool_name]['range']]
+ # Sort the external ranges by sequence
+ external_ranges: list = sorted(
+ config['pool']['external'][ext_pool_name]['range'],
+ key=lambda r: int(config['pool']['external'][ext_pool_name]['range'][r].get('seq', 999999))
+ )
internal_ranges: list = [range for range in config['pool']['internal'][int_pool_name]['range']]
external_list_hosts_count = []
external_list_hosts = []