]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Convert bgp_fsm_nht_update to take a connection
authorDonald Sharp <sharpd@nvidia.com>
Mon, 28 Aug 2023 14:47:41 +0000 (10:47 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Sun, 10 Sep 2023 12:31:25 +0000 (08:31 -0400)
Convert this function over to using a connection.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd/bgp_bfd.c
bgpd/bgp_fsm.c
bgpd/bgp_fsm.h
bgpd/bgp_nht.c

index e14626f3f7a1982c3f50ef16b29d98cecb99d8b0..6bc1c094f5b911172ddd376941022552b598cdc7 100644 (file)
@@ -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);
                }
        }
index 586776b03e767fa3eda8e48ba3ca0ce770687531..64eefb62c418505fbec810f616c51722126b3d84 100644 (file)
@@ -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:
index 7a99623a52493eccbc979339fd5493e1bdab9e5b..fd46b7994e3a3f38da60635655cd7b58f84bc8db 100644 (file)
@@ -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);
index 3bf7ac91b39626669693354b016f4918d12d6126..8bc5846b2030aff9adcca83a62a66132d65b21f8 100644 (file)
@@ -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);
                }
        }