summaryrefslogtreecommitdiff
path: root/proto/bgp/bgp.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2018-08-01 17:41:29 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2018-08-01 17:41:29 +0200
commitb1f6c439f55233338a5f7cca5070c70618fe7f1d (patch)
tree2f62b62b2532d8561faa30832ea94faa63709dbf /proto/bgp/bgp.c
parent4abccabd7b10808c2ebb9ad4f6cbac3fe47cfb8f (diff)
BGP: Fix BFD/GR interaction
The old code does not cause GR if BFD failed when GR is running, session is re-established but not yet synchronized.
Diffstat (limited to 'proto/bgp/bgp.c')
-rw-r--r--proto/bgp/bgp.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index 369d78f5..a4b37691 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -1054,22 +1054,23 @@ bgp_bfd_notify(struct bfd_request *req)
if (req->down && ((ps == PS_START) || (ps == PS_UP)))
{
BGP_TRACE(D_EVENTS, "BFD session down");
+ bgp_store_error(p, NULL, BE_MISC, BEM_BFD_DOWN);
- /* Ignore if already in GR */
- if (p->gr_active && (p->cf->bfd == BGP_BFD_GRACEFUL))
- return;
-
- if (p->conn && (p->conn->state == BS_ESTABLISHED) &&
- p->gr_ready && (p->cf->bfd == BGP_BFD_GRACEFUL))
+ if (p->cf->bfd == BGP_BFD_GRACEFUL)
{
/* Trigger graceful restart */
- bgp_handle_graceful_restart(p);
- bgp_conn_enter_idle_state(p->conn);
+ if (p->conn && (p->conn->state == BS_ESTABLISHED) && p->gr_ready)
+ bgp_handle_graceful_restart(p);
+
+ if (p->incoming_conn.state > BS_IDLE)
+ bgp_conn_enter_idle_state(&p->incoming_conn);
+
+ if (p->outgoing_conn.state > BS_IDLE)
+ bgp_conn_enter_idle_state(&p->outgoing_conn);
}
else
{
/* Trigger session down */
- bgp_store_error(p, NULL, BE_MISC, BEM_BFD_DOWN);
if (ps == PS_UP)
bgp_update_startup_delay(p);
bgp_stop(p, 0, NULL, 0);