mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-25 07:49:18 +00:00
tcp: Correctly compute the retransmit length for all 64-bit platforms.
When the TCP sequence number subtracted is greater than 2**32 minus the window size, or 2**31 minus the window size, the use of unsigned long as an intermediate variable, may result in an incorrect retransmit length computation on all 64-bit platforms. While at it create a helper macro to facilitate the computation of the difference between two TCP sequence numbers. Differential Revision: https://reviews.freebsd.org/D35388 Reviewed by: rscheff MFC after: 3 days Sponsored by: NVIDIA Networking
This commit is contained in:
parent
1326017849
commit
28173d49dc
@ -328,13 +328,16 @@ tcp_default_output(struct tcpcb *tp)
|
||||
*/
|
||||
p = NULL;
|
||||
goto after_sack_rexmit;
|
||||
} else
|
||||
} else {
|
||||
/* Can rexmit part of the current hole */
|
||||
len = ((int32_t)ulmin(cwin,
|
||||
tp->snd_recover - p->rxmit));
|
||||
} else
|
||||
len = ((int32_t)ulmin(cwin, p->end - p->rxmit));
|
||||
off = p->rxmit - tp->snd_una;
|
||||
SEQ_SUB(tp->snd_recover, p->rxmit)));
|
||||
}
|
||||
} else {
|
||||
len = ((int32_t)ulmin(cwin,
|
||||
SEQ_SUB(p->end, p->rxmit)));
|
||||
}
|
||||
off = SEQ_SUB(p->rxmit, tp->snd_una);
|
||||
KASSERT(off >= 0,("%s: sack block to the left of una : %d",
|
||||
__func__, off));
|
||||
if (len > 0) {
|
||||
|
@ -43,6 +43,7 @@
|
||||
#define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0)
|
||||
#define SEQ_GT(a,b) ((int)((a)-(b)) > 0)
|
||||
#define SEQ_GEQ(a,b) ((int)((a)-(b)) >= 0)
|
||||
#define SEQ_SUB(a,b) ((int)((a)-(b)))
|
||||
|
||||
#define SEQ_MIN(a, b) ((SEQ_LT(a, b)) ? (a) : (b))
|
||||
#define SEQ_MAX(a, b) ((SEQ_GT(a, b)) ? (a) : (b))
|
||||
|
Loading…
Reference in New Issue
Block a user