git: 6a376af0cd21 - main - TCP PRR: Patch div/0 in tcp_prr_partialack

Richard Scheffenegger rscheff at FreeBSD.org
Tue Jan 26 15:09:04 UTC 2021


The branch main has been updated by rscheff:

URL: https://cgit.FreeBSD.org/src/commit/?id=6a376af0cd212be4e16d013d35a0e2eec1dbb8ae

commit 6a376af0cd212be4e16d013d35a0e2eec1dbb8ae
Author:     Richard Scheffenegger <rscheff at FreeBSD.org>
AuthorDate: 2021-01-26 15:06:32 +0000
Commit:     Richard Scheffenegger <rscheff at FreeBSD.org>
CommitDate: 2021-01-26 15:06:32 +0000

    TCP PRR: Patch div/0 in tcp_prr_partialack
    
    With clearing of recover_fs in bc7ee8e5bc555, div/0
    was observed while processing partial_acks.
    
    Suspect that rewind of an erraneous RTO may be
    causing this - with the above change, recover_fs
    would no longer retained at the last calculated
    value, and reset. But CC_RTO_ERR can reenable
    IN_RECOVERY(), without setting this again.
    
    Adding a safety net prior to the division in that
    function, which I missed in D28114.
---
 sys/netinet/tcp_input.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 4b8f91ed9d0b..459b78cd444a 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -510,7 +510,6 @@ cc_post_recovery(struct tcpcb *tp, struct tcphdr *th)
 	}
 	/* XXXLAS: EXIT_RECOVERY ? */
 	tp->t_bytes_acked = 0;
-	tp->sackhint.recover_fs = 0;
 }
 
 /*
@@ -3948,10 +3947,13 @@ tcp_prr_partialack(struct tcpcb *tp, struct tcphdr *th)
 	/*
 	 * Proportional Rate Reduction
 	 */
-	if (pipe > tp->snd_ssthresh)
+	if (pipe > tp->snd_ssthresh) {
+		if (tp->sackhint.recover_fs == 0)
+			tp->sackhint.recover_fs =
+			    max(1, tp->snd_nxt - tp->snd_una);
 		snd_cnt = (tp->sackhint.prr_delivered * tp->snd_ssthresh /
 		    tp->sackhint.recover_fs) - tp->sackhint.sack_bytes_rexmit;
-	else {
+	} else {
 		if (V_tcp_do_prr_conservative)
 			limit = tp->sackhint.prr_delivered -
 			    tp->sackhint.sack_bytes_rexmit;


More information about the dev-commits-src-all mailing list