[go: up one dir, main page]

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2024-05-10 18:58:01 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2024-08-01 21:09:03 +0000
commit162c10990fdd2f82d479598f39af250191928453 (patch)
treea544cf6f5f7527c2bba19a0b80355ab0fa8c7c44
parent8d9cdf264e43209a367d519b9443888dd0bccdf4 (diff)
downloadsrc-162c10990fdd2f82d479598f39af250191928453.tar.gz
src-162c10990fdd2f82d479598f39af250191928453.zip
sctp: improve heartbeat timer computation
PR: 278666 Reviewed by: Albin Hellqvist Pull Request: https://reviews.freebsd.org/D45107 (cherry picked from commit 5120ea0d8871fd5d56a8fb70117b727b9d8a4e62)
-rw-r--r--sys/netinet/sctputil.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c
index 68484409d038..40a7500fc69c 100644
--- a/sys/netinet/sctputil.c
+++ b/sys/netinet/sctputil.c
@@ -2287,19 +2287,19 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, struct sctp_tcb *stcb,
} else {
to_ticks = net->RTO;
}
- rndval = sctp_select_initial_TSN(&inp->sctp_ep);
- jitter = rndval % to_ticks;
- if (to_ticks > 1) {
- to_ticks >>= 1;
- }
- if (jitter < (UINT32_MAX - to_ticks)) {
- to_ticks += jitter;
- } else {
- to_ticks = UINT32_MAX;
- }
if (!((net->dest_state & SCTP_ADDR_UNCONFIRMED) &&
(net->dest_state & SCTP_ADDR_REACHABLE)) &&
((net->dest_state & SCTP_ADDR_PF) == 0)) {
+ if (to_ticks > 1) {
+ rndval = sctp_select_initial_TSN(&inp->sctp_ep);
+ jitter = rndval % to_ticks;
+ to_ticks >>= 1;
+ if (jitter < (UINT32_MAX - to_ticks)) {
+ to_ticks += jitter;
+ } else {
+ to_ticks = UINT32_MAX;
+ }
+ }
if (net->heart_beat_delay < (UINT32_MAX - to_ticks)) {
to_ticks += net->heart_beat_delay;
} else {