From 18ab274af32dd0e8410fb0b5e13f841da57545db Mon Sep 17 00:00:00 2001 From: goldsimon Date: Thu, 22 Oct 2009 13:37:44 +0000 Subject: [PATCH] Fixed bug #26251: RST process in TIME_WAIT TCP state --- CHANGELOG | 3 +++ src/core/tcp_in.c | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 861423f5..b2a12a43 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -43,6 +43,9 @@ HISTORY ++ Bugfixes: + 2009-10-22: Simon Goldschmidt + * tcp_in.c: Fixed bug #26251: RST process in TIME_WAIT TCP state + 2009-10-21: Simon Goldschmidt * tcp_in.c: Fixed bug #27215: TCP sent() callback gives leading and trailing 1 byte len (SYN/FIN) diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index 5fcb4cac..febafff0 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -480,13 +480,13 @@ tcp_listen_input(struct tcp_pcb_listen *pcb) static err_t tcp_timewait_input(struct tcp_pcb *pcb) { - if (TCP_SEQ_GT(seqno + tcplen, pcb->rcv_nxt)) { - pcb->rcv_nxt = seqno + tcplen; + u16_t flags = TCPH_FLAGS(tcphdr); + /* RFC 1337: in TIME_WAIT, ignore RST and ACK FINs + any 'acceptable' segments */ + if (((flags & TCP_RST) == 0) && ((flags & TCP_FIN) || (tcplen > 0))) { + pcb->flags |= TF_ACK_NOW; + return tcp_output(pcb); } - if (tcplen > 0) { - tcp_ack_now(pcb); - } - return tcp_output(pcb); + return ERR_OK; } /**