]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: fix checking for duplicated access-list entries
authorIgor Ryzhov <iryzhov@nfware.com>
Mon, 29 Mar 2021 18:26:28 +0000 (21:26 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Mon, 29 Mar 2021 19:54:03 +0000 (22:54 +0300)
Restore the behavior that was before the NB conversion.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
lib/filter.h
lib/filter_cli.c
lib/filter_nb.c

index 091a5197f6af3a73422af8b44cf31c3bee5c640e..337639c4b7e2feb2647f4fe7ac1f1ae04f1de406 100644 (file)
@@ -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];
index 5d66a9fc73a30906f0f79e9203177ecc5de4dc2d..0c49665fd4729d15eec62958456eea611651ac93 100644 (file)
@@ -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";
index c83738e72957bf308c2c2017423dfa0009914e06..36ce5429c684161a74e0a229a262999fd34f891b 100644 (file)
@@ -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. */