From e89f5983be6a993efa26f24f31d1d0aa9ace51d4 Mon Sep 17 00:00:00 2001 From: fbernon Date: Sun, 17 Jun 2007 16:15:34 +0000 Subject: [PATCH] tcp_in.c: Fix bug #20126 : Zero ssthresh bug (by Per-Henrik Lundblom and Kieran Mansley). --- src/core/tcp_in.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index e385525c..110d1484 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -701,12 +701,18 @@ tcp_receive(struct tcp_pcb *pcb) /*pcb->ssthresh = LWIP_MAX((pcb->snd_max - pcb->lastack) / 2, 2 * pcb->mss);*/ - /* Set ssthresh to half of the minimum of the currenct cwnd and the advertised window */ + /* Set ssthresh to half of the minimum of the current cwnd and the advertised window */ if (pcb->cwnd > pcb->snd_wnd) pcb->ssthresh = pcb->snd_wnd / 2; else pcb->ssthresh = pcb->cwnd / 2; + /* The minimum value for ssthresh should be 2 MSS */ + if (pcb->ssthresh < 2*pcb->mss) { + LWIP_DEBUGF(TCP_FR_DEBUG, ("tcp_receive: The minimum value for ssthresh %"U16_F" should be min 2 mss %"U16_F"...\n", pcb->ssthresh, 2*pcb->mss)); + pcb->ssthresh = 2*pcb->mss; + } + pcb->cwnd = pcb->ssthresh + 3 * pcb->mss; pcb->flags |= TF_INFR; } else {