]> git.proxmox.com Git - mirror_frr.git/commit - lib/bfd.c
lib: do not reopen a zclient socket for bfd
authorLouis Scalbert <louis.scalbert@6wind.com>
Mon, 23 Jan 2023 10:57:57 +0000 (11:57 +0100)
committerLouis Scalbert <louis.scalbert@6wind.com>
Tue, 24 Jan 2023 15:08:04 +0000 (16:08 +0100)
commita77ea81ef34c05bd2b84260c7bbbf9d32443ca7f
tree418b0a16ab76b8d9446f1b00e5c85ec5ce9556f1
parent1983a80dd603161dffca36d822ff0f9912a672e3
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>
lib/bfd.c
lib/bfd.h
staticd/static_zebra.c