summaryrefslogtreecommitdiff
path: root/lib/bfd.c
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2021-10-26 11:33:44 -0400
committerGitHub <noreply@github.com>2021-10-26 11:33:44 -0400
commita2b52cbeb43f28daea6363f2fc6962347dfab334 (patch)
tree7d7b62d44195d08642c826a80720b97635223d6c /lib/bfd.c
parentfd1aebbe776ce5ee5d5ba554bf277f820e4a27b5 (diff)
parenta243d1db93aaa123413a754fe69fbad36d810ae7 (diff)
Merge pull request #9854 from opensourcerouting/zapi-call-table
*: convert zclient callbacks to table
Diffstat (limited to 'lib/bfd.c')
-rw-r--r--lib/bfd.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/bfd.c b/lib/bfd.c
index 5a8a46b67b..70cbe0f2a6 100644
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -821,10 +821,13 @@ void bfd_sess_show(struct vty *vty, struct json_object *json,
*
* Use this as `zclient` `bfd_dest_replay` callback.
*/
-static int zclient_bfd_session_reply(ZAPI_CALLBACK_ARGS)
+int zclient_bfd_session_reply(ZAPI_CALLBACK_ARGS)
{
struct bfd_session_params *bsp;
+ if (!zclient->bfd_integration)
+ return 0;
+
/* Do nothing when shutting down. */
if (bsglobal.shutting_down)
return 0;
@@ -855,7 +858,7 @@ static int zclient_bfd_session_reply(ZAPI_CALLBACK_ARGS)
return 0;
}
-static int zclient_bfd_session_update(ZAPI_CALLBACK_ARGS)
+int zclient_bfd_session_update(ZAPI_CALLBACK_ARGS)
{
struct bfd_session_params *bsp, *bspn;
size_t sessions_updated = 0;
@@ -868,6 +871,9 @@ static int zclient_bfd_session_update(ZAPI_CALLBACK_ARGS)
struct prefix sp;
char ifstr[128], cbitstr[32];
+ if (!zclient->bfd_integration)
+ return 0;
+
/* Do nothing when shutting down. */
if (bsglobal.shutting_down)
return 0;
@@ -969,9 +975,8 @@ void bfd_protocol_integration_init(struct zclient *zc, struct thread_master *tm)
bsglobal.zc = zc;
bsglobal.tm = tm;
- /* Install our callbacks. */
- zc->interface_bfd_dest_update = zclient_bfd_session_update;
- zc->bfd_dest_replay = zclient_bfd_session_reply;
+ /* Enable BFD callbacks. */
+ zc->bfd_integration = true;
/* Send the client registration */
bfd_client_sendmsg(zc, ZEBRA_BFD_CLIENT_REGISTER, VRF_DEFAULT);