diff options
| author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2020-12-04 18:11:45 -0300 |
|---|---|---|
| committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2020-12-04 18:11:45 -0300 |
| commit | f414129b0ce109550bd3a61f6020d7a9af6f9c35 (patch) | |
| tree | 797180b0e5b3618d192918c425a12633dcc67d65 /lib/filter.h | |
| parent | 057edd2e84a6536615b4c80c67d83024ef8f3234 (diff) | |
lib: disallow access list duplicated values
Don't allow users to create multiple rules 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 623fb94527..c6dc269276 100644 --- a/lib/filter.h +++ b/lib/filter.h @@ -176,6 +176,33 @@ enum yang_prefix_list_action { YPLA_PERMIT = 1, }; +struct acl_dup_args { + /** Access list type ("ipv4", "ipv6" or "mac"). */ + const char *ada_type; + /** Access list name. */ + const char *ada_name; + +#define ADA_MAX_VALUES 4 + /** Entry XPath for value. */ + const char *ada_xpath[ADA_MAX_VALUES]; + /** Entry value to match. */ + const char *ada_value[ADA_MAX_VALUES]; + + /** Duplicated entry found in list? */ + bool ada_found; + + /** (Optional) Already existing `dnode`. */ + const struct lyd_node *ada_entry_dnode; +}; + +/** + * Check for duplicated entries using the candidate configuration. + * + * \param vty so we can get the candidate config. + * \param ada the arguments to check. + */ +bool acl_is_dup(const struct lyd_node *dnode, struct acl_dup_args *ada); + /* filter_cli.c */ struct lyd_node; struct vty; |
