diff options
| author | Igor Ryzhov <iryzhov@nfware.com> | 2021-03-30 00:37:52 +0300 |
|---|---|---|
| committer | Igor Ryzhov <iryzhov@nfware.com> | 2021-03-30 00:37:52 +0300 |
| commit | 4179f151fe80584167dbeeb260144d0cfa171f16 (patch) | |
| tree | 151fd3524329487a948220a0733b412a57e17878 | |
| parent | bf79e923167c79b2e813b7e7efda7211949d6378 (diff) | |
lib: fix checking for duplicated prefix-list entries
Restore the behavior that was before the NB conversion.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
| -rw-r--r-- | lib/filter.h | 3 | ||||
| -rw-r--r-- | lib/filter_cli.c | 2 | ||||
| -rw-r--r-- | lib/filter_nb.c | 4 |
3 files changed, 9 insertions, 0 deletions
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. */ |
