summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-08-28 10:47:41 -0400
committerDonald Sharp <sharpd@nvidia.com>2023-09-10 08:31:25 -0400
commitb57e023cc2da413990c28c8495e23e0fd06e02dc (patch)
tree3e639a4a0d48d27a3470535d50f6d33f8d4632a5
parent7094cc7f4202f6cfd045de57ef4d82d559f2e981 (diff)
bgpd: Convert bgp_fsm_nht_update to take a connection
Convert this function over to using a connection. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
-rw-r--r--bgpd/bgp_bfd.c2
-rw-r--r--bgpd/bgp_fsm.c18
-rw-r--r--bgpd/bgp_fsm.h3
-rw-r--r--bgpd/bgp_nht.c3
4 files changed, 14 insertions, 12 deletions
diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c
index e14626f3f7..6bc1c094f5 100644
--- a/bgpd/bgp_bfd.c
+++ b/bgpd/bgp_bfd.c
@@ -66,7 +66,7 @@ static void bfd_session_status_update(struct bfd_session_params *bsp,
if (bss->state == BSS_UP && bss->previous_state != BSS_UP &&
!peer_established(peer->connection)) {
if (!BGP_PEER_START_SUPPRESSED(peer)) {
- bgp_fsm_nht_update(peer, true);
+ bgp_fsm_nht_update(peer->connection, peer, true);
BGP_EVENT_ADD(peer->connection, BGP_Start);
}
}
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 586776b03e..64eefb62c4 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -2372,27 +2372,27 @@ bgp_fsm_exception(struct peer_connection *connection)
return bgp_stop(connection);
}
-void bgp_fsm_nht_update(struct peer *peer, bool has_valid_nexthops)
+void bgp_fsm_nht_update(struct peer_connection *connection, struct peer *peer,
+ bool has_valid_nexthops)
{
if (!peer)
return;
- switch (peer->connection->status) {
+ switch (connection->status) {
case Idle:
if (has_valid_nexthops)
- BGP_EVENT_ADD(peer->connection, BGP_Start);
+ BGP_EVENT_ADD(connection, BGP_Start);
break;
case Connect:
if (!has_valid_nexthops) {
- EVENT_OFF(peer->connection->t_connect);
- BGP_EVENT_ADD(peer->connection, TCP_fatal_error);
+ EVENT_OFF(connection->t_connect);
+ BGP_EVENT_ADD(connection, TCP_fatal_error);
}
break;
case Active:
if (has_valid_nexthops) {
- EVENT_OFF(peer->connection->t_connect);
- BGP_EVENT_ADD(peer->connection,
- ConnectRetry_timer_expired);
+ EVENT_OFF(connection->t_connect);
+ BGP_EVENT_ADD(connection, ConnectRetry_timer_expired);
}
break;
case OpenSent:
@@ -2401,7 +2401,7 @@ void bgp_fsm_nht_update(struct peer *peer, bool has_valid_nexthops)
if (!has_valid_nexthops
&& (peer->gtsm_hops == BGP_GTSM_HOPS_CONNECTED
|| peer->bgp->fast_convergence))
- BGP_EVENT_ADD(peer->connection, TCP_fatal_error);
+ BGP_EVENT_ADD(connection, TCP_fatal_error);
case Clearing:
case Deleted:
case BGP_STATUS_MAX:
diff --git a/bgpd/bgp_fsm.h b/bgpd/bgp_fsm.h
index 7a99623a52..fd46b7994e 100644
--- a/bgpd/bgp_fsm.h
+++ b/bgpd/bgp_fsm.h
@@ -106,7 +106,8 @@ enum bgp_fsm_state_progress {
/*
* 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 void bgp_fsm_nht_update(struct peer_connection *connection,
+ struct peer *peer, bool has_valid_nexthops);
extern void bgp_event(struct event *event);
extern int bgp_event_update(struct peer_connection *connection,
enum bgp_fsm_events event);
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index 3bf7ac91b3..8bc5846b20 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -1407,7 +1407,8 @@ void evaluate_paths(struct bgp_nexthop_cache *bnc)
__func__, peer->host,
peer->bgp->name_pretty,
!!valid_nexthops);
- bgp_fsm_nht_update(peer, !!valid_nexthops);
+ bgp_fsm_nht_update(peer->connection, peer,
+ !!valid_nexthops);
SET_FLAG(bnc->flags, BGP_NEXTHOP_PEER_NOTIFIED);
}
}