From 2d5908f4dedeac4ae2f568bd6f06ea218de5a125 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Thu, 1 Nov 2007 16:53:43 +0000 Subject: [PATCH] Fixed bug #21494: The send mss (pcb->mss) is set to 536 (or TCP_MSS if that is smaller) as long as no MSS option is received from the remote host. --- CHANGELOG | 5 +++++ src/core/tcp.c | 4 ++-- src/core/tcp_in.c | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 04ffac8d..bbff6d30 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -435,6 +435,11 @@ HISTORY ++ Bug fixes: + 2007-11-01 Simon Goldschmidt + * tcp.c, tcp_in.c: Fixed bug #21494: The send mss (pcb->mss) is set to 536 (or + TCP_MSS if that is smaller) as long as no MSS option is received from the + remote host. + 2007-11-01 Simon Goldschmidt * tcp.h, tcp.c, tcp_in.c: Fixed bug #21491: The MSS option sent (with SYN) is now based on TCP_MSS instead of pcb->mss (on passive open now effectively diff --git a/src/core/tcp.c b/src/core/tcp.c index 1e23033f..422f0eb3 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -492,7 +492,7 @@ tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port, pcb->rcv_wnd = TCP_WND; pcb->snd_wnd = TCP_WND; /* The send MSS is updated when an MSS option is received. */ - pcb->mss = TCP_MSS; + pcb->mss = (TCP_MSS > 536) ? 536 : TCP_MSS; pcb->cwnd = 1; pcb->ssthresh = pcb->mss * 10; pcb->state = SYN_SENT; @@ -932,7 +932,7 @@ tcp_alloc(u8_t prio) pcb->tos = 0; pcb->ttl = TCP_TTL; /* The send MSS is updated when an MSS option is received. */ - pcb->mss = TCP_MSS; + pcb->mss = (TCP_MSS > 536) ? 536 : TCP_MSS; pcb->rto = 3000 / TCP_SLOW_INTERVAL; pcb->sa = 0; pcb->sv = 3000 / TCP_SLOW_INTERVAL; diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index 74e4f6fc..d8d813ce 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -519,6 +519,10 @@ tcp_process(struct tcp_pcb *pcb) * can be changed by the received options! */ tcp_parseopt(pcb); + /* Set ssthresh again after changing pcb->mss (already set in tcp_connect + * but for the default value of pcb->mss) */ + pcb->ssthresh = pcb->mss * 10; + pcb->cwnd = ((pcb->cwnd == 1) ? (pcb->mss * 2) : pcb->mss); LWIP_ASSERT("pcb->snd_queuelen > 0", (pcb->snd_queuelen > 0)); --pcb->snd_queuelen;