summaryrefslogtreecommitdiffstats
path: root/bfdd
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2021-04-01 14:42:53 +0200
committerIgor Ryzhov <iryzhov@nfware.com>2021-04-01 14:49:27 +0200
commitf13ad7c542f85c31d0e31436d292e72a60d54969 (patch)
tree19369afee480558e578e07b0ddc582f7f4b1b901 /bfdd
parentbfdd: remove profiles when removing bfd node (diff)
downloadfrr-f13ad7c542f85c31d0e31436d292e72a60d54969.tar.xz
frr-f13ad7c542f85c31d0e31436d292e72a60d54969.zip
bbfd: clear nb config entries when removing bfd node
When bfd node is removed, we must clear all NB entries set by its children - sessions and profiles. Let's store some fake data as an entry for the bfd node to be able to unset it later. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'bfdd')
-rw-r--r--bfdd/bfdd_nb_config.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/bfdd/bfdd_nb_config.c b/bfdd/bfdd_nb_config.c
index 33adca793..b221b6d53 100644
--- a/bfdd/bfdd_nb_config.c
+++ b/bfdd/bfdd_nb_config.c
@@ -229,7 +229,15 @@ static int bfd_session_destroy(enum nb_event event,
*/
int bfdd_bfd_create(struct nb_cb_create_args *args)
{
- /* NOTHING */
+ if (args->event != NB_EV_APPLY)
+ return NB_OK;
+
+ /*
+ * Set any non-NULL value to be able to call
+ * nb_running_unset_entry in bfdd_bfd_destroy.
+ */
+ nb_running_set_entry(args->dnode, (void *)0x1);
+
return NB_OK;
}
@@ -245,6 +253,12 @@ int bfdd_bfd_destroy(struct nb_cb_destroy_args *args)
return NB_OK;
case NB_EV_APPLY:
+ /*
+ * We need to call this to unset pointers from
+ * the child nodes - sessions and profiles.
+ */
+ nb_running_unset_entry(args->dnode);
+
bfd_sessions_remove_manual();
bfd_profiles_remove();
break;