diff options
author | Georg <georg@lysergic.dev> | 2022-04-08 14:52:37 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-08 14:52:37 +0000 |
commit | 630945291c9a389ad62fd32caea3749f4c5e9d72 (patch) | |
tree | a85f72880269bfb43740b7a0bc790dcaca6de1e7 /src/conf_mode/policy.py | |
parent | 15461be0cd7b51e0e290d66bae0bb112f6b2c3ea (diff) | |
parent | 654dbc9aa3b0d27ec4f3faefff6cbd85fc3e1d1a (diff) | |
download | vyos-1x-630945291c9a389ad62fd32caea3749f4c5e9d72.tar.gz vyos-1x-630945291c9a389ad62fd32caea3749f4c5e9d72.zip |
Merge branch 'current' into dhcpd
Diffstat (limited to 'src/conf_mode/policy.py')
-rwxr-xr-x | src/conf_mode/policy.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/conf_mode/policy.py b/src/conf_mode/policy.py index e251396c7..9d8fcfa36 100755 --- a/src/conf_mode/policy.py +++ b/src/conf_mode/policy.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2021 VyOS maintainers and contributors +# Copyright (C) 2021-2022 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as @@ -87,6 +87,7 @@ def verify(policy): # human readable instance name (hypen instead of underscore) policy_hr = policy_type.replace('_', '-') + entries = [] 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: @@ -113,6 +114,10 @@ def verify(policy): if 'prefix' not in rule_config: raise ConfigError(f'A prefix {mandatory_error}') + if rule_config in entries: + raise ConfigError(f'Rule "{rule}" contains a duplicate prefix definition!') + entries.append(rule_config) + # route-maps tend to be a bit more complex so they get their own verify() section if 'route_map' in policy: |