From 6d7a03d0b1b53cf5d225b0af3f21301bb7858542 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Fri, 17 Mar 2023 14:48:35 +0200 Subject: [PATCH] lib: Adjust only `any` flag for prefix-list entries if destroying Before this patch, if we destroy `any` flag for a prefix-list entry, we always set destination as 0.0.0.0/0 and/or ::/0. This means that, if we switch from `ip prefix-list r1-2 seq 5 deny any` to `ip prefix-list r1-2 seq 5 permit 10.10.10.10/32` we will have `permit any` eventually, which broke ACLs. Signed-off-by: Donatas Abraitis (cherry picked from commit 61c07b9d43529f69f48ca54f4f0213cff52b5d0a) --- lib/filter_cli.c | 1 + lib/filter_nb.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/filter_cli.c b/lib/filter_cli.c index 5accea3f02..3b896e3aa2 100644 --- a/lib/filter_cli.c +++ b/lib/filter_cli.c @@ -1340,6 +1340,7 @@ DEFPY_YANG( vty, "./ipv4-prefix-length-lesser-or-equal", NB_OP_DESTROY, NULL); } + nb_cli_enqueue_change(vty, "./any", NB_OP_DESTROY, NULL); } else { nb_cli_enqueue_change(vty, "./any", NB_OP_CREATE, NULL); } diff --git a/lib/filter_nb.c b/lib/filter_nb.c index cfe3105380..fecbd50ed3 100644 --- a/lib/filter_nb.c +++ b/lib/filter_nb.c @@ -1644,7 +1644,7 @@ static int lib_prefix_list_entry_any_destroy(struct nb_cb_destroy_args *args) /* Start prefix entry update procedure. */ prefix_list_entry_update_start(ple); - prefix_list_entry_set_empty(ple); + ple->any = false; /* Finish prefix entry update procedure. */ prefix_list_entry_update_finish(ple); -- 2.39.5