summaryrefslogtreecommitdiff
path: root/lib/bfd.h
diff options
context:
space:
mode:
authorLouis Scalbert <louis.scalbert@6wind.com>2023-01-23 11:57:57 +0100
committerLouis Scalbert <louis.scalbert@6wind.com>2023-01-24 16:08:04 +0100
commita77ea81ef34c05bd2b84260c7bbbf9d32443ca7f (patch)
tree418b0a16ab76b8d9446f1b00e5c85ec5ce9556f1 /lib/bfd.h
parent1983a80dd603161dffca36d822ff0f9912a672e3 (diff)
lib: do not reopen a zclient socket for bfd
b7ca809d1c ("lib: BFD automatic source selection") has added a dedicated zclient socket for nht tracking. Since the bfd lib is used by daemons that already has a zclient socket, those daemons has now a second zclient socket. However, zebra does not distinguish the two zclient sessions. For example, the interfaces are asked a second via zebra_message_send(zclient, ZEBRA_INTERFACE_ADD, VRF_DEFAULT) in zclient_start(). As a result, callbacks functions like bgp_ifp_create() are called a second time, which causes some processing overhead and might cause bugs. Re-use the existing zclient socket for nht tracking. Note that BFD automatic source selection is only currently implemented in staticd. Other daemons will require to add the following in their ZEBRA_NEXTHOP_UPDATE callback function: > if (zclient->bfd_integration) > bfd_nht_update(&matched, &nhr); Fixes: b7ca809d1c ("lib: BFD automatic source selection") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Diffstat (limited to 'lib/bfd.h')
-rw-r--r--lib/bfd.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/bfd.h b/lib/bfd.h
index b7e4eea5f3..91e6d77993 100644
--- a/lib/bfd.h
+++ b/lib/bfd.h
@@ -473,6 +473,15 @@ 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
+ */
+extern int bfd_nht_update(const struct prefix *match,
+ const struct zapi_route *route);
+
#ifdef __cplusplus
}
#endif