]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: convert bgp_stop_with_notify to connection based
authorDonald Sharp <sharpd@nvidia.com>
Sun, 27 Aug 2023 01:25:32 +0000 (21:25 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Sun, 10 Sep 2023 12:31:25 +0000 (08:31 -0400)
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>
bgpd/bgp_fsm.c

index c6e6f08d740398c5aabe5afbb5ec5c0dd9731ada..f54f6472649bbdd9b0f2014341fc31f7522092d9 100644 (file)
@@ -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 */