mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-28 00:27:07 +00:00
bgpd: move t_gr_restart and _stale into peer_connection
The t_gr_restart and t_gr_stale event pointers belong into the peer_connection pointer. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
e79443fcd8
commit
13ae845b94
@ -472,8 +472,8 @@ void bgp_timer_set(struct peer *peer)
|
||||
}
|
||||
break;
|
||||
case Deleted:
|
||||
EVENT_OFF(peer->t_gr_restart);
|
||||
EVENT_OFF(peer->t_gr_stale);
|
||||
EVENT_OFF(peer->connection->t_gr_restart);
|
||||
EVENT_OFF(peer->connection->t_gr_stale);
|
||||
|
||||
FOREACH_AFI_SAFI (afi, safi)
|
||||
EVENT_OFF(peer->t_llgr_stale[afi][safi]);
|
||||
@ -651,7 +651,7 @@ static void bgp_graceful_restart_timer_off(struct peer *peer)
|
||||
return;
|
||||
|
||||
UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT);
|
||||
EVENT_OFF(peer->t_gr_stale);
|
||||
EVENT_OFF(peer->connection->t_gr_stale);
|
||||
|
||||
if (peer_dynamic_neighbor(peer) &&
|
||||
!(CHECK_FLAG(peer->flags, PEER_FLAG_DELETE))) {
|
||||
@ -1418,8 +1418,8 @@ enum bgp_fsm_state_progress bgp_stop(struct peer_connection *connection)
|
||||
}
|
||||
|
||||
/* graceful restart */
|
||||
if (peer->t_gr_stale) {
|
||||
EVENT_OFF(peer->t_gr_stale);
|
||||
if (connection->t_gr_stale) {
|
||||
EVENT_OFF(connection->t_gr_stale);
|
||||
if (bgp_debug_neighbor_events(peer))
|
||||
zlog_debug(
|
||||
"%pBP graceful restart stalepath timer stopped",
|
||||
@ -1434,10 +1434,10 @@ enum bgp_fsm_state_progress bgp_stop(struct peer_connection *connection)
|
||||
"%pBP graceful restart stalepath timer started for %d sec",
|
||||
peer, peer->bgp->stalepath_time);
|
||||
}
|
||||
BGP_TIMER_ON(peer->t_gr_restart,
|
||||
BGP_TIMER_ON(connection->t_gr_restart,
|
||||
bgp_graceful_restart_timer_expire,
|
||||
peer->v_gr_restart);
|
||||
BGP_TIMER_ON(peer->t_gr_stale,
|
||||
BGP_TIMER_ON(connection->t_gr_stale,
|
||||
bgp_graceful_stale_timer_expire,
|
||||
peer->bgp->stalepath_time);
|
||||
} else {
|
||||
@ -2271,8 +2271,8 @@ bgp_establish(struct peer_connection *connection)
|
||||
SET_FLAG(peer->sflags, PEER_STATUS_NSF_MODE);
|
||||
else {
|
||||
UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_MODE);
|
||||
if (peer->t_gr_stale) {
|
||||
EVENT_OFF(peer->t_gr_stale);
|
||||
if (connection->t_gr_stale) {
|
||||
EVENT_OFF(connection->t_gr_stale);
|
||||
if (bgp_debug_neighbor_events(peer))
|
||||
zlog_debug(
|
||||
"%pBP graceful restart stalepath timer stopped",
|
||||
@ -2280,8 +2280,8 @@ bgp_establish(struct peer_connection *connection)
|
||||
}
|
||||
}
|
||||
|
||||
if (peer->t_gr_restart) {
|
||||
EVENT_OFF(peer->t_gr_restart);
|
||||
if (connection->t_gr_restart) {
|
||||
EVENT_OFF(connection->t_gr_restart);
|
||||
if (bgp_debug_neighbor_events(peer))
|
||||
zlog_debug("%pBP graceful restart timer stopped", peer);
|
||||
}
|
||||
|
@ -10982,10 +10982,10 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
|
||||
str, label2vni(&attr->label));
|
||||
}
|
||||
|
||||
if (path->peer->t_gr_restart &&
|
||||
if (path->peer->connection->t_gr_restart &&
|
||||
CHECK_FLAG(path->flags, BGP_PATH_STALE)) {
|
||||
unsigned long gr_remaining =
|
||||
event_timer_remain_second(path->peer->t_gr_restart);
|
||||
unsigned long gr_remaining = event_timer_remain_second(
|
||||
path->peer->connection->t_gr_restart);
|
||||
|
||||
if (json_paths) {
|
||||
json_object_int_add(json_path,
|
||||
|
@ -12623,11 +12623,12 @@ static void bgp_show_neighbor_graceful_restart_capability_per_afi_safi(
|
||||
json_object_int_add(json_timer, "stalePathTimer",
|
||||
peer->bgp->stalepath_time);
|
||||
|
||||
if (peer->t_gr_stale != NULL) {
|
||||
if (peer->connection->t_gr_stale != NULL) {
|
||||
json_object_int_add(json_timer,
|
||||
"stalePathTimerRemaining",
|
||||
event_timer_remain_second(
|
||||
peer->t_gr_stale));
|
||||
peer->connection
|
||||
->t_gr_stale));
|
||||
}
|
||||
|
||||
/* Display Configured Selection
|
||||
@ -12657,11 +12658,11 @@ static void bgp_show_neighbor_graceful_restart_capability_per_afi_safi(
|
||||
" Configured Stale Path Time(sec): %u\n",
|
||||
peer->bgp->stalepath_time);
|
||||
|
||||
if (peer->t_gr_stale != NULL)
|
||||
if (peer->connection->t_gr_stale != NULL)
|
||||
vty_out(vty,
|
||||
" Stale Path Remaining(sec): %ld\n",
|
||||
event_timer_remain_second(
|
||||
peer->t_gr_stale));
|
||||
peer->connection->t_gr_stale));
|
||||
/* Display Configured Selection
|
||||
* Deferral only when when
|
||||
* Gr mode is enabled.
|
||||
@ -12706,10 +12707,10 @@ static void bgp_show_neighbor_graceful_restart_time(struct vty *vty,
|
||||
json_object_int_add(json_timer, "receivedRestartTimer",
|
||||
p->v_gr_restart);
|
||||
|
||||
if (p->t_gr_restart != NULL)
|
||||
json_object_int_add(
|
||||
json_timer, "restartTimerRemaining",
|
||||
event_timer_remain_second(p->t_gr_restart));
|
||||
if (p->connection->t_gr_restart != NULL)
|
||||
json_object_int_add(json_timer, "restartTimerRemaining",
|
||||
event_timer_remain_second(
|
||||
p->connection->t_gr_restart));
|
||||
|
||||
json_object_object_add(json, "timers", json_timer);
|
||||
} else {
|
||||
@ -12720,12 +12721,14 @@ static void bgp_show_neighbor_graceful_restart_time(struct vty *vty,
|
||||
|
||||
vty_out(vty, " Received Restart Time(sec): %u\n",
|
||||
p->v_gr_restart);
|
||||
if (p->t_gr_restart != NULL)
|
||||
if (p->connection->t_gr_restart != NULL)
|
||||
vty_out(vty, " Restart Time Remaining(sec): %ld\n",
|
||||
event_timer_remain_second(p->t_gr_restart));
|
||||
if (p->t_gr_restart != NULL) {
|
||||
event_timer_remain_second(
|
||||
p->connection->t_gr_restart));
|
||||
if (p->connection->t_gr_restart != NULL) {
|
||||
vty_out(vty, " Restart Time Remaining(sec): %ld\n",
|
||||
event_timer_remain_second(p->t_gr_restart));
|
||||
event_timer_remain_second(
|
||||
p->connection->t_gr_restart));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -14682,17 +14685,19 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
|
||||
json_grace_recv);
|
||||
|
||||
|
||||
if (p->t_gr_restart)
|
||||
json_object_int_add(
|
||||
json_grace, "gracefulRestartTimerMsecs",
|
||||
event_timer_remain_second(p->t_gr_restart) *
|
||||
1000);
|
||||
if (p->connection->t_gr_restart)
|
||||
json_object_int_add(json_grace,
|
||||
"gracefulRestartTimerMsecs",
|
||||
event_timer_remain_second(
|
||||
p->connection->t_gr_restart) *
|
||||
1000);
|
||||
|
||||
if (p->t_gr_stale)
|
||||
json_object_int_add(
|
||||
json_grace, "gracefulStalepathTimerMsecs",
|
||||
event_timer_remain_second(p->t_gr_stale) *
|
||||
1000);
|
||||
if (p->connection->t_gr_stale)
|
||||
json_object_int_add(json_grace,
|
||||
"gracefulStalepathTimerMsecs",
|
||||
event_timer_remain_second(
|
||||
p->connection->t_gr_stale) *
|
||||
1000);
|
||||
/* more gr info in new format */
|
||||
BGP_SHOW_PEER_GR_CAPABILITY(vty, p, json_grace);
|
||||
json_object_object_add(json_neigh, "gracefulRestartInfo",
|
||||
@ -14729,15 +14734,17 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
|
||||
vty_out(vty, "\n");
|
||||
}
|
||||
|
||||
if (p->t_gr_restart)
|
||||
if (p->connection->t_gr_restart)
|
||||
vty_out(vty,
|
||||
" The remaining time of restart timer is %ld\n",
|
||||
event_timer_remain_second(p->t_gr_restart));
|
||||
event_timer_remain_second(
|
||||
p->connection->t_gr_restart));
|
||||
|
||||
if (p->t_gr_stale)
|
||||
if (p->connection->t_gr_stale)
|
||||
vty_out(vty,
|
||||
" The remaining time of stalepath timer is %ld\n",
|
||||
event_timer_remain_second(p->t_gr_stale));
|
||||
event_timer_remain_second(
|
||||
p->connection->t_gr_stale));
|
||||
|
||||
/* more gr info in new format */
|
||||
BGP_SHOW_PEER_GR_CAPABILITY(vty, p, NULL);
|
||||
|
@ -2542,13 +2542,13 @@ void peer_nsf_stop(struct peer *peer)
|
||||
EVENT_OFF(peer->t_llgr_stale[afi][safi]);
|
||||
}
|
||||
|
||||
if (peer->t_gr_restart) {
|
||||
EVENT_OFF(peer->t_gr_restart);
|
||||
if (peer->connection->t_gr_restart) {
|
||||
EVENT_OFF(peer->connection->t_gr_restart);
|
||||
if (bgp_debug_neighbor_events(peer))
|
||||
zlog_debug("%pBP graceful restart timer stopped", peer);
|
||||
}
|
||||
if (peer->t_gr_stale) {
|
||||
EVENT_OFF(peer->t_gr_stale);
|
||||
if (peer->connection->t_gr_stale) {
|
||||
EVENT_OFF(peer->connection->t_gr_stale);
|
||||
if (bgp_debug_neighbor_events(peer))
|
||||
zlog_debug(
|
||||
"%pBP graceful restart stalepath timer stopped",
|
||||
|
@ -1146,6 +1146,9 @@ struct peer_connection {
|
||||
struct event *t_connect_check_r;
|
||||
struct event *t_connect_check_w;
|
||||
|
||||
struct event *t_gr_restart;
|
||||
struct event *t_gr_stale;
|
||||
|
||||
struct event *t_routeadv;
|
||||
struct event *t_process_packet;
|
||||
struct event *t_process_packet_error;
|
||||
@ -1557,8 +1560,6 @@ struct peer {
|
||||
|
||||
/* Threads. */
|
||||
struct event *t_pmax_restart;
|
||||
struct event *t_gr_restart;
|
||||
struct event *t_gr_stale;
|
||||
struct event *t_llgr_stale[AFI_MAX][SAFI_MAX];
|
||||
struct event *t_revalidate_all[AFI_MAX][SAFI_MAX];
|
||||
struct event *t_generate_updgrp_packets;
|
||||
|
Loading…
Reference in New Issue
Block a user