diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-10-03 18:01:28 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-10-03 18:01:28 +0200 |
| commit | fce6b4074f85a8112ba4de64bf2cee94eab704cd (patch) | |
| tree | ce2af359545b920438e20c6fe2b885677bb82f63 /src | |
| parent | 5c515753eafa43aceba3eb4dc03c6935cbf0fdb5 (diff) | |
| parent | 6a7cc74c48f0ce021b4c84cb7412683a9c0e9ae8 (diff) | |
| download | vyos-1x-fce6b4074f85a8112ba4de64bf2cee94eab704cd.tar.gz vyos-1x-fce6b4074f85a8112ba4de64bf2cee94eab704cd.zip | |
Merge pull request #5525 from alexk37/policy-prefix-list-dup-set
policy: T9379: prefix-list duplicate check in linear time
Diffstat (limited to 'src')
| -rwxr-xr-x | src/conf_mode/policy.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/conf_mode/policy.py b/src/conf_mode/policy.py index 9f10178af..7cc2488b5 100755 --- a/src/conf_mode/policy.py +++ b/src/conf_mode/policy.py @@ -131,7 +131,7 @@ def verify(config_dict): # human readable instance name (hyphen instead of underscore) policy_hr = policy_type.replace('_', '-') - entries = [] + entries = set() for rule, rule_config in instance_config['rule'].items(): mandatory_error = f'must be specified for "{policy_hr} {instance} rule {rule}"!' if 'action' not in rule_config: @@ -185,10 +185,11 @@ def verify(config_dict): f'"le" ({le})' ) - if rule_config in entries: + key = tuple(sorted(rule_config.items())) + if key in entries: raise ConfigError( f'Rule "{rule}" contains a duplicate prefix definition!') - entries.append(rule_config) + entries.add(key) # route-maps tend to be a bit more complex so they get their own verify() section if 'route_map' in policy: |
