bgpd: improve reconnection mechanism by cancelling connect timers

if bfd comes back up, and a bgp reconnection is in progress, theorically
it should be necessary to wait for the end of the reconnection process.
however, since that reconnection process may take some time, update the
fsm by cancelling the connect timer. This done, one just have to call
the start timer.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
Philippe Guibert 2019-04-16 15:10:17 +02:00
parent 5172851960
commit fc04a6778e
4 changed files with 6 additions and 5 deletions

View File

@ -282,8 +282,10 @@ static void bgp_bfd_peer_status_update(struct peer *peer, int status)
}
if ((status == BFD_STATUS_UP) && (old_status == BFD_STATUS_DOWN)
&& peer->status != Established) {
if (!BGP_PEER_START_SUPPRESSED(peer))
if (!BGP_PEER_START_SUPPRESSED(peer)) {
bgp_fsm_event_update(peer, 1);
BGP_EVENT_ADD(peer, BGP_Start);
}
}
}

View File

@ -1754,7 +1754,7 @@ static int bgp_fsm_exeption(struct peer *peer)
return (bgp_stop(peer));
}
void bgp_fsm_nht_update(struct peer *peer, int valid)
void bgp_fsm_event_update(struct peer *peer, int valid)
{
if (!peer)
return;
@ -1788,7 +1788,6 @@ void bgp_fsm_nht_update(struct peer *peer, int valid)
}
}
/* Finite State Machine structure */
static const struct {
int (*func)(struct peer *);

View File

@ -57,7 +57,7 @@
#define FSM_PEER_TRANSITIONED 3
/* Prototypes. */
extern void bgp_fsm_nht_update(struct peer *, int valid);
extern void bgp_fsm_event_update(struct peer *peer, int valid);
extern int bgp_event(struct thread *);
extern int bgp_event_update(struct peer *, int event);
extern int bgp_stop(struct peer *peer);

View File

@ -793,7 +793,7 @@ static void evaluate_paths(struct bgp_nexthop_cache *bnc)
if (BGP_DEBUG(nht, NHT))
zlog_debug("%s: Updating peer (%s) status with NHT",
__FUNCTION__, peer->host);
bgp_fsm_nht_update(peer, bgp_isvalid_nexthop(bnc));
bgp_fsm_event_update(peer, bgp_isvalid_nexthop(bnc));
SET_FLAG(bnc->flags, BGP_NEXTHOP_PEER_NOTIFIED);
}