0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-23 02:01:55 +00:00

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.
This commit is contained in:
Ondrej Zajicek (work) 2018-08-01 17:41:29 +02:00
parent 4abccabd7b
commit b1f6c439f5

View File

@ -1054,22 +1054,23 @@ bgp_bfd_notify(struct bfd_request *req)
if (req->down && ((ps == PS_START) || (ps == PS_UP))) if (req->down && ((ps == PS_START) || (ps == PS_UP)))
{ {
BGP_TRACE(D_EVENTS, "BFD session down"); BGP_TRACE(D_EVENTS, "BFD session down");
bgp_store_error(p, NULL, BE_MISC, BEM_BFD_DOWN);
/* Ignore if already in GR */ if (p->cf->bfd == BGP_BFD_GRACEFUL)
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))
{ {
/* Trigger graceful restart */ /* Trigger graceful restart */
if (p->conn && (p->conn->state == BS_ESTABLISHED) && p->gr_ready)
bgp_handle_graceful_restart(p); bgp_handle_graceful_restart(p);
bgp_conn_enter_idle_state(p->conn);
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 else
{ {
/* Trigger session down */ /* Trigger session down */
bgp_store_error(p, NULL, BE_MISC, BEM_BFD_DOWN);
if (ps == PS_UP) if (ps == PS_UP)
bgp_update_startup_delay(p); bgp_update_startup_delay(p);
bgp_stop(p, 0, NULL, 0); bgp_stop(p, 0, NULL, 0);