]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Fix session re-establishment
authorDonald Sharp <sharpd@nvidia.com>
Tue, 3 Dec 2024 17:08:12 +0000 (12:08 -0500)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Wed, 4 Dec 2024 06:55:32 +0000 (08:55 +0200)
Currently if you have this sequence of events:

a) BGP starts
b) BGP reads cli that has bfd configuration
c) BGP attempts to install bfd configuration but fails because
zebra is not connected to yet
d) BGP connects to zebra
e) BGP receives resend bfd code from bfdd
f) BGP was not sending down the unsent data to bfd, never causing
the bfd session to be established.

So effectively bfd was attempting to install but failed
and then when it was asked to replay everything it decided
that the bfd information for a particular peer was actually
installed and does not need to be resent.  Modify the code
such that the bfd code now tracks failed installation and
allows the resend of data to bfdd.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
lib/bfd.c

index 4535fc123378b77244697add7bc41c2a878ca52a..bc4b1c5b51e6601f44742939fdd976d719374b7a 100644 (file)
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -32,6 +32,8 @@ enum bfd_session_event {
        BSE_UNINSTALL,
        /** Install the BFD session configuration. */
        BSE_INSTALL,
+       /** We should install but it couldn't because of a error talking to zebra */
+       BSE_VALID_FOR_INSTALL,
 };
 
 /**
@@ -527,6 +529,10 @@ static void _bfd_sess_send(struct event *t)
                        vrf_id_to_name(bsp->args.vrf_id), bsp->args.vrf_id,
                        bsp->lastev == BSE_INSTALL ? "installed"
                                                   : "uninstalled");
+
+               bsp->installed = false;
+               if (bsp->lastev == BSE_INSTALL)
+                       bsp->lastev = BSE_VALID_FOR_INSTALL;
        }
 }
 
@@ -883,7 +889,7 @@ int zclient_bfd_session_replay(ZAPI_CALLBACK_ARGS)
        /* Replay all activated peers. */
        TAILQ_FOREACH (bsp, &bsglobal.bsplist, entry) {
                /* Skip not installed sessions. */
-               if (!bsp->installed)
+               if (!bsp->installed && bsp->lastev != BSE_VALID_FOR_INSTALL)
                        continue;
 
                /* We are reconnecting, so we must send installation. */