/** * bgp_graceful_restart_done - finish active BGP graceful restart * @p: BGP instance * * This function is called when the active BGP graceful restart of the neighbor * should be finished - either successfully (the neighbor sends all paths and * reports end-of-RIB on the new session) or unsuccessfully (the neighbor does * not support BGP graceful restart on the new session). The function ends * routing table refresh cycle and stops BGP restart timer. */ void bgp_graceful_restart_done(struct bgp_proto *p) { BGP_TRACE(D_EVENTS, "Neighbor graceful restart done"); p->gr_active = 0; tm_stop(p->gr_timer); rt_refresh_end(p->p.main_ahook->table, p->p.main_ahook); }
/** * bgp_refresh_end - finish incoming enhanced route refresh sequence * @p: BGP instance * * This function is called when an incoming enhanced route refresh sequence is * finished by the neighbor, demarcated by the EoRR packet. The function updates * the load state and ends the routing table refresh cycle. Routes not received * during the sequence are removed by the nest. */ void bgp_refresh_end(struct bgp_proto *p) { if (p->load_state != BFS_REFRESHING) { log(L_WARN "%s: END-OF-RR received without prior BEGIN-OF-RR, ignoring", p->p.name); return; } p->load_state = BFS_NONE; rt_refresh_end(p->p.main_ahook->table, p->p.main_ahook); }
/** * bgp_handle_graceful_restart - handle detected BGP graceful restart * @p: BGP instance * * This function is called when a BGP graceful restart of the neighbor is * detected (when the TCP connection fails or when a new TCP connection * appears). The function activates processing of the restart - starts routing * table refresh cycle and activates BGP restart timer. The protocol state goes * back to %PS_START, but changing BGP state back to %BS_IDLE is left for the * caller. */ void bgp_handle_graceful_restart(struct bgp_proto *p) { ASSERT(p->conn && (p->conn->state == BS_ESTABLISHED) && p->gr_ready); BGP_TRACE(D_EVENTS, "Neighbor graceful restart detected%s", p->gr_active ? " - already pending" : ""); proto_notify_state(&p->p, PS_START); if (p->gr_active) rt_refresh_end(p->p.main_ahook->table, p->p.main_ahook); p->gr_active = 1; bgp_start_timer(p->gr_timer, p->conn->peer_gr_time); rt_refresh_begin(p->p.main_ahook->table, p->p.main_ahook); }