summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2025-03-25 13:54:24 +0200
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2025-04-03 06:18:58 +0000
commit5d16f0fe996c8d2c99cf337ad412175702ae3fdf (patch)
tree1e2178535db1c6ed6e70eab4ef03d02b07103857
parent6fcdc14e3a5563fb446387ea11765d7402d6a6d9 (diff)
lib: Return duplicate prefix-list entry test
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> (cherry picked from commit 8384d41144496019725c1e250abd0ceea854341f)
-rw-r--r--lib/filter_cli.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/filter_cli.c b/lib/filter_cli.c
index c40c2a75fe..b3ad5fb46d 100644
--- a/lib/filter_cli.c
+++ b/lib/filter_cli.c
@@ -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);