mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 10:49:24 +00:00
Merge pull request #12142 from opensourcerouting/fix/sendholdtimer
bgpd: Honor default holdtime when triggering session reset for SendHoldTimer
This commit is contained in:
commit
b19cb23104
@ -124,6 +124,7 @@ static void bgp_packet_add(struct peer *peer, struct stream *s)
|
|||||||
{
|
{
|
||||||
intmax_t delta;
|
intmax_t delta;
|
||||||
uint32_t holdtime;
|
uint32_t holdtime;
|
||||||
|
intmax_t sendholdtime;
|
||||||
|
|
||||||
frr_with_mutex (&peer->io_mtx) {
|
frr_with_mutex (&peer->io_mtx) {
|
||||||
/* if the queue is empty, reset the "last OK" timestamp to
|
/* if the queue is empty, reset the "last OK" timestamp to
|
||||||
@ -136,8 +137,14 @@ static void bgp_packet_add(struct peer *peer, struct stream *s)
|
|||||||
stream_fifo_push(peer->obuf, s);
|
stream_fifo_push(peer->obuf, s);
|
||||||
|
|
||||||
delta = monotime(NULL) - peer->last_sendq_ok;
|
delta = monotime(NULL) - peer->last_sendq_ok;
|
||||||
|
|
||||||
|
if (CHECK_FLAG(peer->flags, PEER_FLAG_TIMER))
|
||||||
holdtime = atomic_load_explicit(&peer->holdtime,
|
holdtime = atomic_load_explicit(&peer->holdtime,
|
||||||
memory_order_relaxed);
|
memory_order_relaxed);
|
||||||
|
else
|
||||||
|
holdtime = peer->bgp->default_holdtime;
|
||||||
|
|
||||||
|
sendholdtime = holdtime * 2;
|
||||||
|
|
||||||
/* Note that when we're here, we're adding some packet to the
|
/* Note that when we're here, we're adding some packet to the
|
||||||
* OutQ. That includes keepalives when there is nothing to
|
* OutQ. That includes keepalives when there is nothing to
|
||||||
@ -149,18 +156,18 @@ static void bgp_packet_add(struct peer *peer, struct stream *s)
|
|||||||
*/
|
*/
|
||||||
if (!holdtime) {
|
if (!holdtime) {
|
||||||
/* no holdtime, do nothing. */
|
/* no holdtime, do nothing. */
|
||||||
} else if (delta > 2 * (intmax_t)holdtime) {
|
} else if (delta > sendholdtime) {
|
||||||
flog_err(
|
flog_err(
|
||||||
EC_BGP_SENDQ_STUCK_PROPER,
|
EC_BGP_SENDQ_STUCK_PROPER,
|
||||||
"%s has not made any SendQ progress for 2 holdtimes, terminating session",
|
"%pBP has not made any SendQ progress for 2 holdtimes (%jds), terminating session",
|
||||||
peer->host);
|
peer, sendholdtime);
|
||||||
BGP_EVENT_ADD(peer, TCP_fatal_error);
|
BGP_EVENT_ADD(peer, TCP_fatal_error);
|
||||||
} else if (delta > (intmax_t)holdtime &&
|
} else if (delta > (intmax_t)holdtime &&
|
||||||
monotime(NULL) - peer->last_sendq_warn > 5) {
|
monotime(NULL) - peer->last_sendq_warn > 5) {
|
||||||
flog_warn(
|
flog_warn(
|
||||||
EC_BGP_SENDQ_STUCK_WARN,
|
EC_BGP_SENDQ_STUCK_WARN,
|
||||||
"%s has not made any SendQ progress for 1 holdtime, peer overloaded?",
|
"%pBP has not made any SendQ progress for 1 holdtime (%us), peer overloaded?",
|
||||||
peer->host);
|
peer, holdtime);
|
||||||
peer->last_sendq_warn = monotime(NULL);
|
peer->last_sendq_warn = monotime(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user