From 513c8c4f74b24c67ed7e56582c5b1e0093e5118e Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sat, 26 Aug 2023 22:20:16 -0400 Subject: [PATCH] bgpd: move t_pmax_restart to peer_connection The t_pmax_restart event pointer belongs in the peer_connection pointer. Signed-off-by: Donald Sharp --- bgpd/bgp_fsm.c | 2 +- bgpd/bgp_route.c | 3 +-- bgpd/bgp_vty.c | 7 ++++--- bgpd/bgpd.c | 8 ++++---- bgpd/bgpd.h | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index b7a7cf75e9..96a46f5f54 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -478,7 +478,7 @@ void bgp_timer_set(struct peer *peer) FOREACH_AFI_SAFI (afi, safi) EVENT_OFF(peer->t_llgr_stale[afi][safi]); - EVENT_OFF(peer->t_pmax_restart); + EVENT_OFF(peer->connection->t_pmax_restart); EVENT_OFF(peer->t_refresh_stalepath); /* fallthru */ case Clearing: diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 849da5c97e..d1556bb05b 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -3727,7 +3727,6 @@ static void bgp_maximum_prefix_restart_timer(struct event *thread) struct peer *peer; peer = EVENT_ARG(thread); - peer->t_pmax_restart = NULL; if (bgp_debug_neighbor_events(peer)) zlog_debug( @@ -3839,7 +3838,7 @@ bool bgp_maximum_prefix_overflow(struct peer *peer, afi_t afi, safi_t safi, "%pBP Maximum-prefix restart timer started for %d secs", peer, peer->v_pmax_restart); - BGP_TIMER_ON(peer->t_pmax_restart, + BGP_TIMER_ON(peer->connection->t_pmax_restart, bgp_maximum_prefix_restart_timer, peer->v_pmax_restart); } diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 1f6e58d787..dc9d00071d 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -14972,21 +14972,22 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json, vty_out(vty, " Peer had exceeded the max. no. of prefixes configured.\n"); - if (p->t_pmax_restart) { + if (p->connection->t_pmax_restart) { if (use_json) { json_object_boolean_true_add( json_neigh, "reducePrefixNumFrom"); json_object_int_add(json_neigh, "restartInTimerMsec", event_timer_remain_second( - p->t_pmax_restart) * + p->connection + ->t_pmax_restart) * 1000); } else vty_out(vty, " Reduce the no. of prefix from %s, will restart in %ld seconds\n", p->host, event_timer_remain_second( - p->t_pmax_restart)); + p->connection->t_pmax_restart)); } else { if (use_json) json_object_boolean_true_add( diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 8cdca56d4e..62c803546c 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -4601,8 +4601,8 @@ static void peer_flag_modify_action(struct peer *peer, uint64_t flag) UNSET_FLAG(peer->sflags, PEER_STATUS_PREFIX_OVERFLOW); - if (peer->t_pmax_restart) { - EVENT_OFF(peer->t_pmax_restart); + if (peer->connection->t_pmax_restart) { + EVENT_OFF(peer->connection->t_pmax_restart); if (bgp_debug_neighbor_events(peer)) zlog_debug( "%pBP Maximum-prefix restart timer canceled", @@ -7537,8 +7537,8 @@ static bool peer_maximum_prefix_clear_overflow(struct peer *peer) return false; UNSET_FLAG(peer->sflags, PEER_STATUS_PREFIX_OVERFLOW); - if (peer->t_pmax_restart) { - EVENT_OFF(peer->t_pmax_restart); + if (peer->connection->t_pmax_restart) { + EVENT_OFF(peer->connection->t_pmax_restart); if (bgp_debug_neighbor_events(peer)) zlog_debug( "%pBP Maximum-prefix restart timer cancelled", diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index ec1d0f2980..c815d97bd1 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -1150,6 +1150,7 @@ struct peer_connection { struct event *t_gr_stale; struct event *t_generate_updgrp_packets; + struct event *t_pmax_restart; struct event *t_routeadv; struct event *t_process_packet; @@ -1561,7 +1562,6 @@ struct peer { _Atomic uint32_t v_gr_restart; /* Threads. */ - struct event *t_pmax_restart; struct event *t_llgr_stale[AFI_MAX][SAFI_MAX]; struct event *t_revalidate_all[AFI_MAX][SAFI_MAX]; struct event *t_refresh_stalepath;