]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: remove concurrent nexthop zapi (un)registration
authorLouis Scalbert <louis.scalbert@6wind.com>
Mon, 23 Jan 2023 12:33:22 +0000 (13:33 +0100)
committerLouis Scalbert <louis.scalbert@6wind.com>
Tue, 24 Jan 2023 15:08:26 +0000 (16:08 +0100)
Daemons like staticd already implement nexthop zapi (un)registration.
b7ca809d1c ("lib: BFD automatic source selection") has implemented a
concurrent nexthop (un)registration. Some nexthop could be unregistred
by the bfd whereas they were still needed by the daemon.

Let the deamons deal with nexthop zapi (un)registration.

Fixes: b7ca809d1c ("lib: BFD automatic source selection")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
lib/bfd.c
lib/bfd.h
staticd/static_zebra.c

index 2e184898c44f7004bc18dda48425418455e10173..9078e3559f54f92562ddcf6d8d396cc1d1b85e5f 100644 (file)
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -149,22 +149,6 @@ static const struct in6_addr i6a_zero;
 static void bfd_source_cache_get(struct bfd_session_params *session);
 static void bfd_source_cache_put(struct bfd_session_params *session);
 
-static inline void
-bfd_source_cache_register(const struct bfd_source_cache *source)
-{
-       zclient_send_rnh(bsglobal.zc, ZEBRA_NEXTHOP_REGISTER, &source->address,
-                        SAFI_UNICAST, false, false, source->vrf_id);
-}
-
-static inline void
-bfd_source_cache_unregister(const struct bfd_source_cache *source)
-{
-       zclient_send_rnh(bsglobal.zc, ZEBRA_NEXTHOP_UNREGISTER,
-                        &source->address, SAFI_UNICAST, false, false,
-                        source->vrf_id);
-}
-
-
 /*
  * bfd_get_peer_info - Extract the Peer information for which the BFD session
  *                     went down from the message sent from Zebra to clients.
@@ -1226,8 +1210,6 @@ static void bfd_source_cache_get(struct bfd_session_params *session)
        session->source_cache = source;
        source->refcount = 1;
 
-       bfd_source_cache_register(source);
-
        return;
 }
 
@@ -1242,7 +1224,6 @@ static void bfd_source_cache_put(struct bfd_session_params *session)
                return;
        }
 
-       bfd_source_cache_unregister(session->source_cache);
        SLIST_REMOVE(&bsglobal.source_list, session->source_cache,
                     bfd_source_cache, entry);
        XFREE(MTYPE_BFD_SOURCE, session->source_cache);
@@ -1352,17 +1333,6 @@ static bool bfd_source_cache_update(struct bfd_source_cache *source,
        return false;
 }
 
-void bfd_nht_zclient_connected(struct zclient *zclient)
-{
-       struct bfd_source_cache *source;
-
-       if (bsglobal.debugging)
-               zlog_debug("BFD NHT zclient connected");
-
-       SLIST_FOREACH (source, &bsglobal.source_list, entry)
-               bfd_source_cache_register(source);
-}
-
 int bfd_nht_update(const struct prefix *match, const struct zapi_route *route)
 {
        struct bfd_source_cache *source;
index 91e6d77993e70e5d1a2ffeba46d820c3d15e206b..51e831785a0efb28ae08da2712150b12a7b1d9ff 100644 (file)
--- a/lib/bfd.h
+++ b/lib/bfd.h
@@ -473,8 +473,6 @@ extern bool bfd_protocol_integration_debug(void);
  */
 extern bool bfd_protocol_integration_shutting_down(void);
 
-extern void bfd_nht_zclient_connected(struct zclient *zclient);
-
 /* Update nexthop-tracking (nht) information for BFD auto source selection.
  * The function must be called from the daemon callback function
  * that deals with the ZEBRA_NEXTHOP_UPDATE zclient command
index f4f9878e8d6f0e045c643c242cd0c54c08c5d107..85e4b1c033fa468ec0c2a4a95b78c0cc9400954b 100644 (file)
@@ -182,8 +182,6 @@ static void zebra_connected(struct zclient *zclient)
        zclient_send_reg_requests(zclient, VRF_DEFAULT);
 
        static_fixup_vrf_ids(vrf_info_lookup(VRF_DEFAULT));
-
-       bfd_nht_zclient_connected(zclient);
 }
 
 /* API to check whether the configured nexthop address is