]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: fix checking for duplicated prefix-list entries 8371/head
authorIgor Ryzhov <iryzhov@nfware.com>
Mon, 29 Mar 2021 21:37:52 +0000 (00:37 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Tue, 30 Mar 2021 14:38:41 +0000 (17:38 +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 337639c4b7e2feb2647f4fe7ac1f1ae04f1de406..b1bf1d67ba7414457abc1250a65c75ee87c70dc0 100644 (file)
@@ -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];
index 0c49665fd4729d15eec62958456eea611651ac93..24980f785876b829d1723cc71c1000b8787e9bbd 100644 (file)
@@ -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;
index bae401af01afa2f2543979f2b4a4c89c3ed4f8eb..877073a6064afa13b0140271bf73c39f3aa23a48 100644 (file)
@@ -280,6 +280,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. */
@@ -333,6 +336,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. */