]> git.puffer.fish Git - mirror/frr.git/commitdiff
bbfd: clear nb config entries when removing bfd node
authorIgor Ryzhov <iryzhov@nfware.com>
Thu, 1 Apr 2021 12:42:53 +0000 (15:42 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Thu, 1 Apr 2021 12:42:53 +0000 (15:42 +0300)
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>
bfdd/bfdd_nb_config.c

index 77f8cbd09c074f6ac0b76bb7dae7eb46b1deba5e..4030e2eefa50012d5298ee91ed8955481463be01 100644 (file)
@@ -186,7 +186,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;
 }
 
@@ -202,6 +210,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;