diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-10-17 13:34:41 +0300 | 
|---|---|---|
| committer | Mergify <37929162+mergify[bot]@users.noreply.github.com> | 2022-10-25 13:47:45 +0000 | 
| commit | d958def533cc2e17dc3becfb7279a407639dc01d (patch) | |
| tree | 624bd28750b52ca343e5d61088879eabf69003ca /bgpd | |
| parent | eff9477df2534fa0c432540a9e6efc523a41e03c (diff) | |
bgpd: Honor default holdtime when triggering session reset for SendHoldTimer
If the timer is not explicitly configured for a peer, the default timer
is not taken into account and SendHoldTimer mechanism does not work at all.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 460ed839b57199cfb7fc9e71d4f861e22454ae18)
Diffstat (limited to 'bgpd')
| -rw-r--r-- | bgpd/bgp_packet.c | 21 | 
1 files changed, 14 insertions, 7 deletions
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 8ae31bf2e6..769f9613da 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -124,6 +124,7 @@ static void bgp_packet_add(struct peer *peer, struct stream *s)  {  	intmax_t delta;  	uint32_t holdtime; +	intmax_t sendholdtime;  	frr_with_mutex (&peer->io_mtx) {  		/* 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);  		delta = monotime(NULL) - peer->last_sendq_ok; -		holdtime = atomic_load_explicit(&peer->holdtime, -						memory_order_relaxed); + +		if (CHECK_FLAG(peer->flags, PEER_FLAG_TIMER)) +			holdtime = atomic_load_explicit(&peer->holdtime, +							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  		 * 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) {  			/* no holdtime, do nothing. */ -		} else if (delta > 2 * (intmax_t)holdtime) { +		} else if (delta > sendholdtime) {  			flog_err(  				EC_BGP_SENDQ_STUCK_PROPER, -				"%s has not made any SendQ progress for 2 holdtimes, terminating session", -				peer->host); +				"%pBP has not made any SendQ progress for 2 holdtimes (%jds), terminating session", +				peer, sendholdtime);  			BGP_EVENT_ADD(peer, TCP_fatal_error);  		} else if (delta > (intmax_t)holdtime &&  			   monotime(NULL) - peer->last_sendq_warn > 5) {  			flog_warn(  				EC_BGP_SENDQ_STUCK_WARN, -				"%s has not made any SendQ progress for 1 holdtime, peer overloaded?", -				peer->host); +				"%pBP has not made any SendQ progress for 1 holdtime (%us), peer overloaded?", +				peer, holdtime);  			peer->last_sendq_warn = monotime(NULL);  		}  	}  | 
