diff options
| author | Oleksandr Kuchmystyi <o.kuchmystyi@vyos.io> | 2026-10-15 12:16:39 +0300 |
|---|---|---|
| committer | Oleksandr Kuchmystyi <o.kuchmystyi@vyos.io> | 2026-10-16 14:41:03 +0300 |
| commit | 6e3598a23b22462c59635cac4f367987c253277b (patch) | |
| tree | 79ed49c2f8be1a6f7a5325738dbe0a2dc0af8b6d /python | |
| parent | 7677efce1f811445d033d0ca81f3fe11396e8dd7 (diff) | |
| download | vyos-1x-6e3598a23b22462c59635cac4f367987c253277b.tar.gz vyos-1x-6e3598a23b22462c59635cac4f367987c253277b.zip | |
policy: T9346: Allow dot in `prefix-list` and `prefix-list6` names
VyOS 1.3 allowed a dot in `policy prefix-list` and `policy prefix-list6`
names (pattern `^[-_a-zA-Z0-9.]+$`). The XML rewrite dropped the dot from
the allowed characters, so a 1.3 configuration using such names
can no longer be loaded or committed after an
upgrade. FRR itself accepts the dot in prefix-list names.
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/configverify.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py index 89f1b7ad7..d918c53bb 100644 --- a/python/vyos/configverify.py +++ b/python/vyos/configverify.py @@ -439,10 +439,9 @@ def verify_common_route_maps(config): for route_map in ['route-map', 'route_map']: if route_map not in config: continue - tmp = config[route_map] + route_map_name = config[route_map] # Check if the specified route-map exists, if not error out - if dict_search(f'policy.route_map.{tmp}', config) == None: - raise ConfigError(f'Specified route-map "{tmp}" does not exist!') + verify_route_map(route_map_name, config) if 'redistribute' in config: for protocol, protocol_config in config['redistribute'].items(): @@ -454,8 +453,10 @@ def verify_route_map(route_map_name, config): Common helper function used by routing protocol implementations to perform recurring validation if a specified route-map exists! """ + # Check if the specified route-map exists, if not error out - if dict_search(f'policy.route_map.{route_map_name}', config) == None: + route_maps = dict_search('policy.route_map', config) or {} + if route_map_name not in route_maps: raise ConfigError(f'Specified route-map "{route_map_name}" does not exist!') def verify_prefix_list(prefix_list, config, version=''): @@ -463,8 +464,10 @@ def verify_prefix_list(prefix_list, config, version=''): Common helper function used by routing protocol implementations to perform recurring validation if a specified prefix-list exists! """ + # Check if the specified prefix-list exists, if not error out - if dict_search(f'policy.prefix_list{version}.{prefix_list}', config) == None: + prefixes = dict_search(f'policy.prefix_list{version}', config) or {} + if prefix_list not in prefixes: raise ConfigError(f'Specified prefix-list{version} "{prefix_list}" does not exist!') def verify_access_list(access_list, config, version=''): |
