summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2019-04-16 15:10:17 +0200
committerPhilippe Guibert <philippe.guibert@6wind.com>2019-04-18 16:11:51 +0200
commitfc04a6778e3a3d6e0cf13d33fa2f98368a42f1ef (patch)
tree491a3f1ef9164adeb117a32fd090cbd2947dfa71
parent5172851960576252a9a427b8bcec12b3595561ef (diff)
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>
-rw-r--r--bgpd/bgp_bfd.c4
-rw-r--r--bgpd/bgp_fsm.c3
-rw-r--r--bgpd/bgp_fsm.h2
-rw-r--r--bgpd/bgp_nht.c2
4 files changed, 6 insertions, 5 deletions
diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c
index 965ba868c9..dadf124eec 100644
--- a/bgpd/bgp_bfd.c
+++ b/bgpd/bgp_bfd.c
@@ -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);
+ }
}
}
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 447d8da613..9e37a60188 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -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 *);
diff --git a/bgpd/bgp_fsm.h b/bgpd/bgp_fsm.h
index d021c9884a..3476a3c3a9 100644
--- a/bgpd/bgp_fsm.h
+++ b/bgpd/bgp_fsm.h
@@ -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);
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index 6e85abc8df..7e721db49d 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -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);
}