diff options
| author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2020-12-07 12:08:44 -0300 |
|---|---|---|
| committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2020-12-07 12:08:44 -0300 |
| commit | 54d153f7864c8197d883cbaafe55bddf940a6db0 (patch) | |
| tree | c46ed9c54f48bace5af4721d893c3b09045d6d7c /lib/filter.h | |
| parent | 208dc372cd1069ab0a9efee2815b04481934f856 (diff) | |
lib: disallow prefix list duplicated values
Don't allow users to create multiple entries in the same list with the
same value to keep the behavior previously to northbound migration.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'lib/filter.h')
| -rw-r--r-- | lib/filter.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/filter.h b/lib/filter.h index c6dc269276..091a5197f6 100644 --- a/lib/filter.h +++ b/lib/filter.h @@ -203,6 +203,33 @@ struct acl_dup_args { */ bool acl_is_dup(const struct lyd_node *dnode, struct acl_dup_args *ada); +struct plist_dup_args { + /** Access list type ("ipv4" or "ipv6"). */ + const char *pda_type; + /** Access list name. */ + const char *pda_name; + +#define PDA_MAX_VALUES 4 + /** Entry XPath for value. */ + const char *pda_xpath[PDA_MAX_VALUES]; + /** Entry value to match. */ + const char *pda_value[PDA_MAX_VALUES]; + + /** Duplicated entry found in list? */ + bool pda_found; + + /** (Optional) Already existing `dnode`. */ + const struct lyd_node *pda_entry_dnode; +}; + +/** + * Check for duplicated entries using the candidate configuration. + * + * \param vty so we can get the candidate config. + * \param pda the arguments to check. + */ +bool plist_is_dup(const struct lyd_node *dnode, struct plist_dup_args *pda); + /* filter_cli.c */ struct lyd_node; struct vty; |
