tcp: fix computation of offset

Only update the offset if actually retransmitting from the
scoreboard. If not done correctly, this may result in
trying to (re)-transmit data not being being in the socket
buffe and therefore resulting in a panic.

PR:			264257
PR:			263445
PR:			260393
Reviewed by:		rscheff@
MFC after:		3 days
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D36626
This commit is contained in:
Michael Tuexen 2022-09-19 12:42:43 +02:00
parent 55760984d5
commit 6d9e911fba

View File

@ -338,10 +338,10 @@ tcp_default_output(struct tcpcb *tp)
len = ((int32_t)ulmin(cwin, len = ((int32_t)ulmin(cwin,
SEQ_SUB(p->end, p->rxmit))); 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) { if (len > 0) {
off = SEQ_SUB(p->rxmit, tp->snd_una);
KASSERT(off >= 0,("%s: sack block to the left of una : %d",
__func__, off));
sack_rxmit = 1; sack_rxmit = 1;
sendalot = 1; sendalot = 1;
TCPSTAT_INC(tcps_sack_rexmits); TCPSTAT_INC(tcps_sack_rexmits);