]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Return duplicate prefix-list entry test
authorDonatas Abraitis <donatas@opensourcerouting.org>
Tue, 25 Mar 2025 11:54:24 +0000 (13:54 +0200)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Tue, 25 Mar 2025 11:54:24 +0000 (13:54 +0200)
If we do e.g.:

ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32
ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32
ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32

We end up, having duplicate records with a different sequence number only.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
lib/filter_cli.c

index c40c2a75fed5c7e6a548f90dcdf7437bf41f52e8..b3ad5fb46d0beabb13e8ec888184b23555ad6b2f 100644 (file)
@@ -1206,10 +1206,14 @@ DEFPY_YANG(
        snprintf(xpath, sizeof(xpath),
                 "/frr-filter:lib/prefix-list[type='ipv4'][name='%s']", name);
        if (seq_str == NULL) {
-               /* Use XPath to find the next sequence number. */
-               sseq = acl_get_seq(vty, xpath, false);
-               if (sseq < 0)
-                       return CMD_WARNING_CONFIG_FAILED;
+               if (plist_is_dup(vty->candidate_config->dnode, &pda))
+                       sseq = pda.pda_seq;
+               else {
+                       /* Use XPath to find the next sequence number. */
+                       sseq = acl_get_seq(vty, xpath, false);
+                       if (sseq < 0)
+                               return CMD_WARNING_CONFIG_FAILED;
+               }
 
                snprintfrr(xpath_entry, sizeof(xpath_entry),
                           "%s/entry[sequence='%" PRId64 "']", xpath, sseq);