From 18abe2b91ef41d4c6ccdd19ac505f6705db64f87 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Mon, 29 Mar 2021 21:26:28 +0300 Subject: lib: fix checking for duplicated access-list entries Restore the behavior that was before the NB conversion. Signed-off-by: Igor Ryzhov --- lib/filter_cli.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/filter_cli.c') diff --git a/lib/filter_cli.c b/lib/filter_cli.c index 5d66a9fc73..0c49665fd4 100644 --- a/lib/filter_cli.c +++ b/lib/filter_cli.c @@ -173,6 +173,7 @@ DEFPY_YANG( if (seq_str == NULL) { ada.ada_type = "ipv4"; ada.ada_name = name; + ada.ada_action = action; if (host_str && mask_str == NULL) { ada.ada_xpath[0] = "./host"; ada.ada_value[0] = host_str; @@ -309,6 +310,7 @@ DEFPY_YANG( if (seq_str == NULL) { ada.ada_type = "ipv4"; ada.ada_name = name; + ada.ada_action = action; if (src_str && src_mask_str == NULL) { ada.ada_xpath[idx] = "./host"; ada.ada_value[idx] = src_str; @@ -504,6 +506,7 @@ DEFPY_YANG( if (seq_str == NULL) { ada.ada_type = "ipv4"; ada.ada_name = name; + ada.ada_action = action; if (prefix_str) { ada.ada_xpath[0] = "./ipv4-prefix"; @@ -701,6 +704,7 @@ DEFPY_YANG( if (seq_str == NULL) { ada.ada_type = "ipv6"; ada.ada_name = name; + ada.ada_action = action; if (prefix_str) { ada.ada_xpath[0] = "./ipv6-prefix"; @@ -902,6 +906,7 @@ DEFPY_YANG( if (seq_str == NULL) { ada.ada_type = "mac"; ada.ada_name = name; + ada.ada_action = action; if (mac_str) { ada.ada_xpath[0] = "./mac"; -- cgit v1.2.3 From 4179f151fe80584167dbeeb260144d0cfa171f16 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Tue, 30 Mar 2021 00:37:52 +0300 Subject: lib: fix checking for duplicated prefix-list entries Restore the behavior that was before the NB conversion. Signed-off-by: Igor Ryzhov --- lib/filter.h | 3 +++ lib/filter_cli.c | 2 ++ lib/filter_nb.c | 4 ++++ 3 files changed, 9 insertions(+) (limited to 'lib/filter_cli.c') diff --git a/lib/filter.h b/lib/filter.h index 337639c4b7..b1bf1d67ba 100644 --- a/lib/filter.h +++ b/lib/filter.h @@ -212,6 +212,9 @@ struct plist_dup_args { /** Access list name. */ const char *pda_name; + /** Entry action. */ + const char *pda_action; + #define PDA_MAX_VALUES 4 /** Entry XPath for value. */ const char *pda_xpath[PDA_MAX_VALUES]; diff --git a/lib/filter_cli.c b/lib/filter_cli.c index 0c49665fd4..24980f7858 100644 --- a/lib/filter_cli.c +++ b/lib/filter_cli.c @@ -1336,6 +1336,7 @@ DEFPY_YANG( if (seq_str == NULL) { pda.pda_type = "ipv4"; pda.pda_name = name; + pda.pda_action = action; if (prefix_str) { pda.pda_xpath[arg_idx] = "./ipv4-prefix"; pda.pda_value[arg_idx] = prefix_str; @@ -1531,6 +1532,7 @@ DEFPY_YANG( if (seq_str == NULL) { pda.pda_type = "ipv6"; pda.pda_name = name; + pda.pda_action = action; if (prefix_str) { pda.pda_xpath[arg_idx] = "./ipv6-prefix"; pda.pda_value[arg_idx] = prefix_str; diff --git a/lib/filter_nb.c b/lib/filter_nb.c index 50325a39f9..3b650742f3 100644 --- a/lib/filter_nb.c +++ b/lib/filter_nb.c @@ -396,6 +396,9 @@ static int _plist_is_dup(const struct lyd_node *dnode, void *arg) && pda->pda_entry_dnode == dnode) return YANG_ITER_CONTINUE; + if (strcmp(yang_dnode_get_string(dnode, "action"), pda->pda_action)) + return YANG_ITER_CONTINUE; + /* Check if all values match. */ for (idx = 0; idx < PDA_MAX_VALUES; idx++) { /* No more values. */ @@ -449,6 +452,7 @@ static bool plist_is_dup_nb(const struct lyd_node *dnode) /* Initialize. */ pda.pda_type = yang_dnode_get_string(entry_dnode, "../type"); pda.pda_name = yang_dnode_get_string(entry_dnode, "../name"); + pda.pda_action = yang_dnode_get_string(entry_dnode, "action"); pda.pda_entry_dnode = entry_dnode; /* Load all values/XPaths. */ -- cgit v1.2.3