mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 10:37:29 +00:00
bgpd: rename bgp_fsm_event_update
This function is poorly named; it's really used to allow the FSM to decide the next valid state based on whether a peer has valid / reachable nexthops as determined by NHT or BFD. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
This commit is contained in:
parent
70d400cefa
commit
f8dcd38ddb
@ -361,7 +361,7 @@ static void bgp_bfd_peer_status_update(struct peer *peer, int status,
|
|||||||
if ((status == BFD_STATUS_UP) && (old_status == BFD_STATUS_DOWN)
|
if ((status == BFD_STATUS_UP) && (old_status == BFD_STATUS_DOWN)
|
||||||
&& peer->status != Established) {
|
&& peer->status != Established) {
|
||||||
if (!BGP_PEER_START_SUPPRESSED(peer)) {
|
if (!BGP_PEER_START_SUPPRESSED(peer)) {
|
||||||
bgp_fsm_event_update(peer, 1);
|
bgp_fsm_nht_update(peer, true);
|
||||||
BGP_EVENT_ADD(peer, BGP_Start);
|
BGP_EVENT_ADD(peer, BGP_Start);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2037,24 +2037,24 @@ static int bgp_fsm_exeption(struct peer *peer)
|
|||||||
return (bgp_stop(peer));
|
return (bgp_stop(peer));
|
||||||
}
|
}
|
||||||
|
|
||||||
void bgp_fsm_event_update(struct peer *peer, int valid)
|
void bgp_fsm_nht_update(struct peer *peer, bool has_valid_nexthops)
|
||||||
{
|
{
|
||||||
if (!peer)
|
if (!peer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (peer->status) {
|
switch (peer->status) {
|
||||||
case Idle:
|
case Idle:
|
||||||
if (valid)
|
if (has_valid_nexthops)
|
||||||
BGP_EVENT_ADD(peer, BGP_Start);
|
BGP_EVENT_ADD(peer, BGP_Start);
|
||||||
break;
|
break;
|
||||||
case Connect:
|
case Connect:
|
||||||
if (!valid) {
|
if (!has_valid_nexthops) {
|
||||||
BGP_TIMER_OFF(peer->t_connect);
|
BGP_TIMER_OFF(peer->t_connect);
|
||||||
BGP_EVENT_ADD(peer, TCP_fatal_error);
|
BGP_EVENT_ADD(peer, TCP_fatal_error);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Active:
|
case Active:
|
||||||
if (valid) {
|
if (has_valid_nexthops) {
|
||||||
BGP_TIMER_OFF(peer->t_connect);
|
BGP_TIMER_OFF(peer->t_connect);
|
||||||
BGP_EVENT_ADD(peer, ConnectRetry_timer_expired);
|
BGP_EVENT_ADD(peer, ConnectRetry_timer_expired);
|
||||||
}
|
}
|
||||||
@ -2062,7 +2062,8 @@ void bgp_fsm_event_update(struct peer *peer, int valid)
|
|||||||
case OpenSent:
|
case OpenSent:
|
||||||
case OpenConfirm:
|
case OpenConfirm:
|
||||||
case Established:
|
case Established:
|
||||||
if (!valid && (peer->gtsm_hops == BGP_GTSM_HOPS_CONNECTED))
|
if (!has_valid_nexthops
|
||||||
|
&& (peer->gtsm_hops == BGP_GTSM_HOPS_CONNECTED))
|
||||||
BGP_EVENT_ADD(peer, TCP_fatal_error);
|
BGP_EVENT_ADD(peer, TCP_fatal_error);
|
||||||
case Clearing:
|
case Clearing:
|
||||||
case Deleted:
|
case Deleted:
|
||||||
|
@ -109,7 +109,11 @@
|
|||||||
&& !CHECK_FLAG(peer->cap, PEER_CAP_RESTART_BIT_ADV))
|
&& !CHECK_FLAG(peer->cap, PEER_CAP_RESTART_BIT_ADV))
|
||||||
|
|
||||||
/* Prototypes. */
|
/* Prototypes. */
|
||||||
extern void bgp_fsm_event_update(struct peer *peer, int valid);
|
|
||||||
|
/*
|
||||||
|
* Update FSM for peer based on whether we have valid nexthops or not.
|
||||||
|
*/
|
||||||
|
extern void bgp_fsm_nht_update(struct peer *peer, bool has_valid_nexthops);
|
||||||
extern int bgp_event(struct thread *);
|
extern int bgp_event(struct thread *);
|
||||||
extern int bgp_event_update(struct peer *, enum bgp_fsm_events event);
|
extern int bgp_event_update(struct peer *, enum bgp_fsm_events event);
|
||||||
extern int bgp_stop(struct peer *peer);
|
extern int bgp_stop(struct peer *peer);
|
||||||
|
@ -846,7 +846,7 @@ static void evaluate_paths(struct bgp_nexthop_cache *bnc)
|
|||||||
"%s: Updating peer (%s(%s)) status with NHT",
|
"%s: Updating peer (%s(%s)) status with NHT",
|
||||||
__func__, peer->host,
|
__func__, peer->host,
|
||||||
peer->bgp->name_pretty);
|
peer->bgp->name_pretty);
|
||||||
bgp_fsm_event_update(peer, valid_nexthops);
|
bgp_fsm_nht_update(peer, !!valid_nexthops);
|
||||||
SET_FLAG(bnc->flags, BGP_NEXTHOP_PEER_NOTIFIED);
|
SET_FLAG(bnc->flags, BGP_NEXTHOP_PEER_NOTIFIED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user