summaryrefslogtreecommitdiff
path: root/bgpd/bgp_fsm.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-08-26 21:25:32 -0400
committerDonald Sharp <sharpd@nvidia.com>2023-09-10 08:31:25 -0400
commit33a14ce1f27ef4dff35e7b11c5f5a139984615e0 (patch)
treee0ed449547159e96ec382f8731f39c114c0b2a8a /bgpd/bgp_fsm.c
parent3c7ef0a9c75d3ab2fc4395be31f06b87c1d719eb (diff)
bgpd: convert bgp_stop_with_notify to connection based
The bgp_stop_with_notify function should use a peer_connection pointer as the basis instead of a peer. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'bgpd/bgp_fsm.c')
-rw-r--r--bgpd/bgp_fsm.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index c6e6f08d74..f54f647264 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -1629,10 +1629,13 @@ bgp_stop_with_error(struct peer_connection *connection)
/* something went wrong, send notify and tear down */
static enum bgp_fsm_state_progress
-bgp_stop_with_notify(struct peer *peer, uint8_t code, uint8_t sub_code)
+bgp_stop_with_notify(struct peer_connection *connection, uint8_t code,
+ uint8_t sub_code)
{
+ struct peer *peer = connection->peer;
+
/* Send notify to remote peer */
- bgp_notify_send(peer->connection, code, sub_code);
+ bgp_notify_send(connection, code, sub_code);
if (peer_dynamic_neighbor_no_nsf(peer)) {
if (bgp_debug_neighbor_events(peer))
@@ -1645,7 +1648,7 @@ bgp_stop_with_notify(struct peer *peer, uint8_t code, uint8_t sub_code)
/* Clear start timer value to default. */
peer->v_start = BGP_INIT_START_TIMER;
- return bgp_stop(peer->connection);
+ return bgp_stop(connection);
}
/**
@@ -2013,7 +2016,7 @@ bgp_fsm_event_error(struct peer_connection *connection)
peer->host,
lookup_msg(bgp_status_msg, connection->status, NULL));
- return bgp_stop_with_notify(peer, BGP_NOTIFY_FSM_ERR,
+ return bgp_stop_with_notify(connection, BGP_NOTIFY_FSM_ERR,
bgp_fsm_error_subcode(connection->status));
}
@@ -2036,7 +2039,7 @@ bgp_fsm_holdtime_expire(struct peer_connection *connection)
if (CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_MODE))
SET_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT);
- return bgp_stop_with_notify(peer, BGP_NOTIFY_HOLD_ERR, 0);
+ return bgp_stop_with_notify(connection, BGP_NOTIFY_HOLD_ERR, 0);
}
/* RFC 4271 DelayOpenTimer_Expires event */