diff options
author | Daniil Baturin <daniil@vyos.io> | 2024-05-29 10:19:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-29 10:19:45 +0200 |
commit | db4c7f15b16b1d9730066d4ca42d7a500284443f (patch) | |
tree | dcb18b3b5f84e9e89bd72febe3c15c35282edd7c /src | |
parent | df6ae88f6e366c015dfe55deb8e88ee67e0d5af5 (diff) | |
parent | 55e02bef4f3aeff5e33cddc79f22b93fc671e491 (diff) | |
download | vyos-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')
-rwxr-xr-x | src/conf_mode/nat_cgnat.py | 6 |
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 = [] |