mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-24 17:44:17 +01:00
sctp: improve heartbeat timer computation
PR: 278666 Reviewed by: Albin Hellqvist MFC after: 3 days Pull Request: https://reviews.freebsd.org/D45107
This commit is contained in:
parent
88cbbbb607
commit
5120ea0d88
@ -2289,19 +2289,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 {
|
||||
|
Loading…
Reference in New Issue
Block a user