]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: t_holdtime move to peer_connection
authorDonald Sharp <sharpd@nvidia.com>
Sat, 26 Aug 2023 23:36:34 +0000 (19:36 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Sat, 9 Sep 2023 20:28:05 +0000 (16:28 -0400)
The t_holdtime event pointer belongs in the peer connection

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

index 28f85d76cbce827a3a6f425cf3a9be04d4732d43..706088333c2115521a1218aa5605a38b5cbdd38e 100644 (file)
@@ -364,7 +364,7 @@ void bgp_timer_set(struct peer *peer)
                                     peer->v_start);
                }
                EVENT_OFF(peer->connection->t_connect);
-               EVENT_OFF(peer->t_holdtime);
+               EVENT_OFF(peer->connection->t_holdtime);
                bgp_keepalives_off(peer);
                EVENT_OFF(peer->t_routeadv);
                EVENT_OFF(peer->connection->t_delayopen);
@@ -383,7 +383,7 @@ void bgp_timer_set(struct peer *peer)
                        BGP_TIMER_ON(peer->connection->t_connect,
                                     bgp_connect_timer, peer->v_connect);
 
-               EVENT_OFF(peer->t_holdtime);
+               EVENT_OFF(peer->connection->t_holdtime);
                bgp_keepalives_off(peer);
                EVENT_OFF(peer->t_routeadv);
                break;
@@ -406,7 +406,7 @@ void bgp_timer_set(struct peer *peer)
                                BGP_TIMER_ON(peer->connection->t_connect,
                                             bgp_connect_timer, peer->v_connect);
                }
-               EVENT_OFF(peer->t_holdtime);
+               EVENT_OFF(peer->connection->t_holdtime);
                bgp_keepalives_off(peer);
                EVENT_OFF(peer->t_routeadv);
                break;
@@ -416,10 +416,10 @@ void bgp_timer_set(struct peer *peer)
                EVENT_OFF(peer->connection->t_start);
                EVENT_OFF(peer->connection->t_connect);
                if (peer->v_holdtime != 0) {
-                       BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer,
-                                    peer->v_holdtime);
+                       BGP_TIMER_ON(peer->connection->t_holdtime,
+                                    bgp_holdtime_timer, peer->v_holdtime);
                } else {
-                       EVENT_OFF(peer->t_holdtime);
+                       EVENT_OFF(peer->connection->t_holdtime);
                }
                bgp_keepalives_off(peer);
                EVENT_OFF(peer->t_routeadv);
@@ -437,12 +437,12 @@ void bgp_timer_set(struct peer *peer)
                 * Additionally if a different hold timer has been negotiated
                 * than we must stop then start the timer again
                 */
-               EVENT_OFF(peer->t_holdtime);
+               EVENT_OFF(peer->connection->t_holdtime);
                if (peer->v_holdtime == 0)
                        bgp_keepalives_off(peer);
                else {
-                       BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer,
-                                    peer->v_holdtime);
+                       BGP_TIMER_ON(peer->connection->t_holdtime,
+                                    bgp_holdtime_timer, peer->v_holdtime);
                        bgp_keepalives_on(peer);
                }
                EVENT_OFF(peer->t_routeadv);
@@ -462,12 +462,12 @@ void bgp_timer_set(struct peer *peer)
                 * Additionally if a different hold timer has been negotiated
                 * then we must stop then start the timer again
                 */
-               EVENT_OFF(peer->t_holdtime);
+               EVENT_OFF(peer->connection->t_holdtime);
                if (peer->v_holdtime == 0)
                        bgp_keepalives_off(peer);
                else {
-                       BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer,
-                                    peer->v_holdtime);
+                       BGP_TIMER_ON(peer->connection->t_holdtime,
+                                    bgp_holdtime_timer, peer->v_holdtime);
                        bgp_keepalives_on(peer);
                }
                break;
@@ -484,7 +484,7 @@ void bgp_timer_set(struct peer *peer)
        case Clearing:
                EVENT_OFF(peer->connection->t_start);
                EVENT_OFF(peer->connection->t_connect);
-               EVENT_OFF(peer->t_holdtime);
+               EVENT_OFF(peer->connection->t_holdtime);
                bgp_keepalives_off(peer);
                EVENT_OFF(peer->t_routeadv);
                EVENT_OFF(peer->connection->t_delayopen);
@@ -560,7 +560,7 @@ static void bgp_holdtime_timer(struct event *thread)
        inq_count = atomic_load_explicit(&peer->connection->ibuf->count,
                                         memory_order_relaxed);
        if (inq_count)
-               BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer,
+               BGP_TIMER_ON(peer->connection->t_holdtime, bgp_holdtime_timer,
                             peer->v_holdtime);
 
        EVENT_VAL(thread) = Hold_Timer_expired;
@@ -1515,7 +1515,7 @@ enum bgp_fsm_state_progress bgp_stop(struct peer_connection *connection)
        /* Stop all timers. */
        EVENT_OFF(connection->t_start);
        EVENT_OFF(connection->t_connect);
-       EVENT_OFF(peer->t_holdtime);
+       EVENT_OFF(connection->t_holdtime);
        EVENT_OFF(peer->t_routeadv);
        EVENT_OFF(peer->connection->t_delayopen);
 
@@ -2366,7 +2366,7 @@ bgp_establish(struct peer_connection *connection)
 static enum bgp_fsm_state_progress
 bgp_fsm_keepalive(struct peer_connection *connection)
 {
-       EVENT_OFF(connection->peer->t_holdtime);
+       EVENT_OFF(connection->t_holdtime);
        return BGP_FSM_SUCCESS;
 }
 
@@ -2374,7 +2374,7 @@ bgp_fsm_keepalive(struct peer_connection *connection)
 static enum bgp_fsm_state_progress
 bgp_fsm_update(struct peer_connection *connection)
 {
-       EVENT_OFF(connection->peer->t_holdtime);
+       EVENT_OFF(connection->t_holdtime);
        return BGP_FSM_SUCCESS;
 }
 
index 46d7aca6ade89924d63f8314148b50a360b715fa..b682607994b38a8d8370cd6428d4aa23ea1e1d2f 100644 (file)
@@ -1141,6 +1141,7 @@ struct peer_connection {
        struct event *t_connect;
        struct event *t_delayopen;
        struct event *t_start;
+       struct event *t_holdtime;
 
        struct event *t_process_packet;
        struct event *t_process_packet_error;
@@ -1553,7 +1554,6 @@ struct peer {
        /* Threads. */
        struct event *t_connect_check_r;
        struct event *t_connect_check_w;
-       struct event *t_holdtime;
        struct event *t_routeadv;
        struct event *t_pmax_restart;
        struct event *t_gr_restart;