summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_bfd.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2020-03-12 14:04:30 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2020-03-13 16:38:33 +0100
commitfe0c4ed7ba11ad8654ab868c4bbf9744f8df4db6 (patch)
tree9a7bf5579d88d45f9143ea75cd0ddb047849d815 /bgpd/bgp_bfd.c
parentMerge pull request #5972 from rubenk/eigrpd-remove-workaround-for-old-openbsd (diff)
downloadfrr-fe0c4ed7ba11ad8654ab868c4bbf9744f8df4db6.tar.xz
frr-fe0c4ed7ba11ad8654ab868c4bbf9744f8df4db6.zip
bgpd: reset bfd session when bgp comes up
This scenario has been seen against microtik virtual machine with bfd enabled. When remote microtik bgp reestablishes the bgp session after a bgp reset, the bgp establishment comes first, then bfd is initialising. The second point is true for microtik, but not for frrouting, as the frrouting, when receiving bfd down messages, is not at init state. Actually, bfd state is up, and sees the first bfd down packet from bfd as an issue. Consequently, the BGP session is cleared. The fix consists in resetting the BFD session, only if bfd status is considered as up, once BGP comes up. That permits to align state machines of both local and remote bfd. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bgpd/bgp_bfd.c')
-rw-r--r--bgpd/bgp_bfd.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c
index 1f650aaeb..5f4db3dfa 100644
--- a/bgpd/bgp_bfd.c
+++ b/bgpd/bgp_bfd.c
@@ -200,6 +200,25 @@ static void bgp_bfd_update_peer(struct peer *peer)
bgp_bfd_peer_sendmsg(peer, ZEBRA_BFD_DEST_UPDATE);
}
+/**
+ * bgp_bfd_reset_peer - reinitialise bfd
+ * ensures that bfd state machine is restarted
+ * to be synced with remote bfd
+ */
+void bgp_bfd_reset_peer(struct peer *peer)
+{
+ struct bfd_info *bfd_info;
+
+ if (!peer->bfd_info)
+ return;
+ bfd_info = (struct bfd_info *)peer->bfd_info;
+
+ /* if status is not down, reset bfd */
+ if (bfd_info->status != BFD_STATUS_DOWN)
+ bgp_bfd_peer_sendmsg(peer, ZEBRA_BFD_DEST_DEREGISTER);
+ bgp_bfd_peer_sendmsg(peer, ZEBRA_BFD_DEST_REGISTER);
+}
+
/*
* bgp_bfd_update_type - update session type with BFD through zebra.
*/