summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-08-27 01:28:39 +0200
committerDonald Sharp <sharpd@nvidia.com>2023-09-09 22:28:05 +0200
commit904c98c4d99fb054be928b16b26a9d58b1cfb03c (patch)
treea4f78b190442f665bbbf47df818044d93ad90805 /bgpd
parentbgpd: move t_delayopen from peer to peer_connection (diff)
downloadfrr-904c98c4d99fb054be928b16b26a9d58b1cfb03c.tar.xz
frr-904c98c4d99fb054be928b16b26a9d58b1cfb03c.zip
bgpd: move t_start into peer_connection
The t_start event pointer belongs on the peer_connection Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_fsm.c18
-rw-r--r--bgpd/bgp_network.c6
-rw-r--r--bgpd/bgp_vty.c15
-rw-r--r--bgpd/bgpd.h2
4 files changed, 22 insertions, 19 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index b9ba477cc..28f85d76c 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -358,9 +358,9 @@ void bgp_timer_set(struct peer *peer)
inactive. All other timer must be turned off */
if (BGP_PEER_START_SUPPRESSED(peer) || !peer_active(peer)
|| peer->bgp->vrf_id == VRF_UNKNOWN) {
- EVENT_OFF(peer->t_start);
+ EVENT_OFF(peer->connection->t_start);
} else {
- BGP_TIMER_ON(peer->t_start, bgp_start_timer,
+ BGP_TIMER_ON(peer->connection->t_start, bgp_start_timer,
peer->v_start);
}
EVENT_OFF(peer->connection->t_connect);
@@ -374,7 +374,7 @@ void bgp_timer_set(struct peer *peer)
/* After start timer is expired, the peer moves to Connect
status. Make sure start timer is off and connect timer is
on. */
- EVENT_OFF(peer->t_start);
+ EVENT_OFF(peer->connection->t_start);
if (CHECK_FLAG(peer->flags, PEER_FLAG_TIMER_DELAYOPEN))
BGP_TIMER_ON(peer->connection->t_connect,
bgp_connect_timer,
@@ -391,7 +391,7 @@ void bgp_timer_set(struct peer *peer)
case Active:
/* Active is waiting connection from remote peer. And if
connect timer is expired, change status to Connect. */
- EVENT_OFF(peer->t_start);
+ EVENT_OFF(peer->connection->t_start);
/* If peer is passive mode, do not set connect timer. */
if (CHECK_FLAG(peer->flags, PEER_FLAG_PASSIVE)
|| CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT)) {
@@ -413,7 +413,7 @@ void bgp_timer_set(struct peer *peer)
case OpenSent:
/* OpenSent status. */
- EVENT_OFF(peer->t_start);
+ 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,
@@ -428,7 +428,7 @@ void bgp_timer_set(struct peer *peer)
case OpenConfirm:
/* OpenConfirm status. */
- EVENT_OFF(peer->t_start);
+ EVENT_OFF(peer->connection->t_start);
EVENT_OFF(peer->connection->t_connect);
/*
@@ -452,7 +452,7 @@ void bgp_timer_set(struct peer *peer)
case Established:
/* In Established status start and connect timer is turned
off. */
- EVENT_OFF(peer->t_start);
+ EVENT_OFF(peer->connection->t_start);
EVENT_OFF(peer->connection->t_connect);
EVENT_OFF(peer->connection->t_delayopen);
@@ -482,7 +482,7 @@ void bgp_timer_set(struct peer *peer)
EVENT_OFF(peer->t_refresh_stalepath);
/* fallthru */
case Clearing:
- EVENT_OFF(peer->t_start);
+ EVENT_OFF(peer->connection->t_start);
EVENT_OFF(peer->connection->t_connect);
EVENT_OFF(peer->t_holdtime);
bgp_keepalives_off(peer);
@@ -1513,7 +1513,7 @@ enum bgp_fsm_state_progress bgp_stop(struct peer_connection *connection)
EVENT_OFF(peer->t_connect_check_w);
/* Stop all timers. */
- EVENT_OFF(peer->t_start);
+ EVENT_OFF(connection->t_start);
EVENT_OFF(connection->t_connect);
EVENT_OFF(peer->t_holdtime);
EVENT_OFF(peer->t_routeadv);
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
index c5e7f7be6..0d9aa570c 100644
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -436,8 +436,8 @@ static void bgp_accept(struct event *thread)
sockopt_tcp_mss_set(bgp_sock, peer1->tcp_mss);
bgp_fsm_change_status(peer1, Active);
- EVENT_OFF(
- peer1->t_start); /* created in peer_create() */
+ EVENT_OFF(peer1->connection
+ ->t_start); /* created in peer_create() */
if (peer_active(peer1)) {
if (CHECK_FLAG(peer1->flags,
@@ -569,7 +569,7 @@ static void bgp_accept(struct event *thread)
}
bgp_peer_reg_with_nht(peer);
bgp_fsm_change_status(peer, Active);
- EVENT_OFF(peer->t_start); /* created in peer_create() */
+ EVENT_OFF(peer->connection->t_start); /* created in peer_create() */
SET_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER);
/* Make dummy peer until read Open packet. */
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index b06f79322..534bdc83e 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -15128,10 +15128,12 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
p->rtt_keepalive_rcv);
}
}
- if (p->t_start)
- json_object_int_add(
- json_neigh, "nextStartTimerDueInMsecs",
- event_timer_remain_second(p->t_start) * 1000);
+ if (p->connection->t_start)
+ json_object_int_add(json_neigh,
+ "nextStartTimerDueInMsecs",
+ event_timer_remain_second(
+ p->connection->t_start) *
+ 1000);
if (p->connection->t_connect)
json_object_int_add(json_neigh,
"nextConnectTimerDueInMsecs",
@@ -15172,9 +15174,10 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
"Shutdown when RTT > %dms, count > %u\n",
p->rtt_expected, p->rtt_keepalive_rcv);
}
- if (p->t_start)
+ if (p->connection->t_start)
vty_out(vty, "Next start timer due in %ld seconds\n",
- event_timer_remain_second(p->t_start));
+ event_timer_remain_second(
+ p->connection->t_start));
if (p->connection->t_connect)
vty_out(vty, "Next connect timer due in %ld seconds\n",
event_timer_remain_second(
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 0d869b150..46d7aca6a 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -1140,6 +1140,7 @@ struct peer_connection {
struct event *t_write;
struct event *t_connect;
struct event *t_delayopen;
+ struct event *t_start;
struct event *t_process_packet;
struct event *t_process_packet_error;
@@ -1550,7 +1551,6 @@ struct peer {
_Atomic uint32_t v_gr_restart;
/* Threads. */
- struct event *t_start;
struct event *t_connect_check_r;
struct event *t_connect_check_w;
struct event *t_holdtime;