summaryrefslogtreecommitdiffstats
path: root/bfdd
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@opensourcerouting.org>2020-08-18 17:36:56 +0200
committerRafael Zalamena <rzalamena@opensourcerouting.org>2020-11-24 11:54:07 +0100
commit29397ec1abb6068b5cb847a7d7a18b0c5a699b59 (patch)
tree4d54efcb63ccfbb065bd70c361fa911b6adbd4c9 /bfdd
parentbfdd: distributed BFD debugging knob (diff)
downloadfrr-29397ec1abb6068b5cb847a7d7a18b0c5a699b59.tar.xz
frr-29397ec1abb6068b5cb847a7d7a18b0c5a699b59.zip
bfdd: disable sockets when using distributed BFD
The current distributed BFD implementantion doesn't support falling back to software implementation in FRR, so to keep the code simple lets give the data plane full control of the BFD packet handling (helps running a software data plane for testing too otherwise it would fail with 'address in use' error). Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'bfdd')
-rw-r--r--bfdd/bfd.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/bfdd/bfd.c b/bfdd/bfd.c
index c77b5cd1a..4b46a0e1d 100644
--- a/bfdd/bfd.c
+++ b/bfdd/bfd.c
@@ -2028,6 +2028,16 @@ static int bfd_vrf_enable(struct vrf *vrf)
bvrf = XCALLOC(MTYPE_BFDD_VRF, sizeof(struct bfd_vrf_global));
bvrf->vrf = vrf;
vrf->info = (void *)bvrf;
+
+ /* Disable sockets if using data plane. */
+ if (bglobal.bg_use_dplane) {
+ bvrf->bg_shop = -1;
+ bvrf->bg_mhop = -1;
+ bvrf->bg_shop6 = -1;
+ bvrf->bg_mhop6 = -1;
+ bvrf->bg_echo = -1;
+ bvrf->bg_echov6 = -1;
+ }
} else
bvrf = vrf->info;
@@ -2049,25 +2059,24 @@ static int bfd_vrf_enable(struct vrf *vrf)
if (!bvrf->bg_echov6)
bvrf->bg_echov6 = bp_echov6_socket(vrf);
- /* Add descriptors to the event loop. */
- if (!bvrf->bg_ev[0])
- thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_shop,
- &bvrf->bg_ev[0]);
- if (!bvrf->bg_ev[1])
- thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_mhop,
- &bvrf->bg_ev[1]);
+ if (!bvrf->bg_ev[0] && bvrf->bg_shop != -1)
+ thread_add_read(master, bfd_recv_cb, bvrf,
+ bvrf->bg_shop, &bvrf->bg_ev[0]);
+ if (!bvrf->bg_ev[1] && bvrf->bg_mhop != -1)
+ thread_add_read(master, bfd_recv_cb, bvrf,
+ bvrf->bg_mhop, &bvrf->bg_ev[1]);
if (!bvrf->bg_ev[2] && bvrf->bg_shop6 != -1)
- thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_shop6,
- &bvrf->bg_ev[2]);
+ thread_add_read(master, bfd_recv_cb, bvrf,
+ bvrf->bg_shop6, &bvrf->bg_ev[2]);
if (!bvrf->bg_ev[3] && bvrf->bg_mhop6 != -1)
- thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_mhop6,
- &bvrf->bg_ev[3]);
- if (!bvrf->bg_ev[4])
- thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_echo,
- &bvrf->bg_ev[4]);
+ thread_add_read(master, bfd_recv_cb, bvrf,
+ bvrf->bg_mhop6, &bvrf->bg_ev[3]);
+ if (!bvrf->bg_ev[4] && bvrf->bg_echo != -1)
+ thread_add_read(master, bfd_recv_cb, bvrf,
+ bvrf->bg_echo, &bvrf->bg_ev[4]);
if (!bvrf->bg_ev[5] && bvrf->bg_echov6 != -1)
- thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_echov6,
- &bvrf->bg_ev[5]);
+ thread_add_read(master, bfd_recv_cb, bvrf,
+ bvrf->bg_echov6, &bvrf->bg_ev[5]);
}
if (vrf->vrf_id != VRF_DEFAULT) {
bfdd_zclient_register(vrf->vrf_id);