From a6ca9aa306606fbd0f30dd8ba17a3085018dfbd0 Mon Sep 17 00:00:00 2001 From: kieranm Date: Thu, 16 Aug 2007 15:57:31 +0000 Subject: [PATCH] * tcp_in.c: Fix for bug #19953 - correct TCP state machine when * receiving FIN+ACK in SYN_RECV state --- src/core/tcp_in.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index 7318c962..64e83d79 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -568,14 +568,20 @@ tcp_process(struct tcp_pcb *pcb) old_cwnd = pcb->cwnd; /* If there was any data contained within this ACK, * we'd better pass it on to the application as well. */ - tcp_receive(pcb); + accepted_inseq = tcp_receive(pcb); + pcb->cwnd = ((old_cwnd == 1) ? (pcb->mss * 2) : pcb->mss); + + if ((flags & TCP_FIN) && accepted_inseq) { + tcp_ack_now(pcb); + pcb->state = CLOSE_WAIT; + } } /* incorrect ACK number */ else { /* send RST */ tcp_rst(ackno, seqno + tcplen, &(iphdr->dest), &(iphdr->src), - tcphdr->dest, tcphdr->src); + tcphdr->dest, tcphdr->src); } } break;