summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2021-03-29 20:26:28 +0200
committerIgor Ryzhov <iryzhov@nfware.com>2021-03-29 21:54:03 +0200
commit18abe2b91ef41d4c6ccdd19ac505f6705db64f87 (patch)
tree007ab35f8314d34ea06c245c2a84c47094d8c2f5 /lib
parentMerge pull request #8326 from idryzhov/hide-show-config (diff)
downloadfrr-18abe2b91ef41d4c6ccdd19ac505f6705db64f87.tar.xz
frr-18abe2b91ef41d4c6ccdd19ac505f6705db64f87.zip
lib: fix checking for duplicated access-list entries
Restore the behavior that was before the NB conversion. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/filter.h3
-rw-r--r--lib/filter_cli.c5
-rw-r--r--lib/filter_nb.c5
3 files changed, 13 insertions, 0 deletions
diff --git a/lib/filter.h b/lib/filter.h
index 091a5197f..337639c4b 100644
--- a/lib/filter.h
+++ b/lib/filter.h
@@ -182,6 +182,9 @@ struct acl_dup_args {
/** Access list name. */
const char *ada_name;
+ /** Entry action. */
+ const char *ada_action;
+
#define ADA_MAX_VALUES 4
/** Entry XPath for value. */
const char *ada_xpath[ADA_MAX_VALUES];
diff --git a/lib/filter_cli.c b/lib/filter_cli.c
index 5d66a9fc7..0c49665fd 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";
diff --git a/lib/filter_nb.c b/lib/filter_nb.c
index c83738e72..36ce5429c 100644
--- a/lib/filter_nb.c
+++ b/lib/filter_nb.c
@@ -238,6 +238,9 @@ static int _acl_is_dup(const struct lyd_node *dnode, void *arg)
&& ada->ada_entry_dnode == dnode)
return YANG_ITER_CONTINUE;
+ if (strcmp(yang_dnode_get_string(dnode, "action"), ada->ada_action))
+ return YANG_ITER_CONTINUE;
+
/* Check if all values match. */
for (idx = 0; idx < ADA_MAX_VALUES; idx++) {
/* No more values. */
@@ -292,6 +295,7 @@ static bool acl_cisco_is_dup(const struct lyd_node *dnode)
/* Initialize. */
ada.ada_type = "ipv4";
ada.ada_name = yang_dnode_get_string(entry_dnode, "../name");
+ ada.ada_action = yang_dnode_get_string(entry_dnode, "action");
ada.ada_entry_dnode = entry_dnode;
/* Load all values/XPaths. */
@@ -341,6 +345,7 @@ static bool acl_zebra_is_dup(const struct lyd_node *dnode,
break;
}
ada.ada_name = yang_dnode_get_string(entry_dnode, "../name");
+ ada.ada_action = yang_dnode_get_string(entry_dnode, "action");
ada.ada_entry_dnode = entry_dnode;
/* Load all values/XPaths. */