From: Donald Sharp Date: Sun, 27 Aug 2023 01:25:32 +0000 (-0400) Subject: bgpd: convert bgp_stop_with_notify to connection based X-Git-Tag: base_9.1~86^2~12 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=33a14ce1f27ef4dff35e7b11c5f5a139984615e0;p=mirror%2Ffrr.git 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 --- 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 */