From e463fe44657664bf80a440c908f66051d74d135a Mon Sep 17 00:00:00 2001 From: silby Date: Thu, 25 Nov 2004 19:04:20 +0000 Subject: Fix a problem where our TCP stack would ignore RST packets if the receive window was 0 bytes in size. This may have been the cause of unsolved "connection not closing" reports over the years. Thanks to Michiel Boland for providing the fix and providing a concise test program for the problem. Submitted by: Michiel Boland MFC after: 2 weeks --- sys/netinet/tcp_input.c | 5 +++-- sys/netinet/tcp_reass.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'sys/netinet') diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 0639698..92032cc 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1514,8 +1514,9 @@ trimthenstep6: * RFC 1337. */ if (thflags & TH_RST) { - if (SEQ_GEQ(th->th_seq, tp->last_ack_sent) && - SEQ_LT(th->th_seq, tp->last_ack_sent + tp->rcv_wnd)) { + if ((SEQ_GEQ(th->th_seq, tp->last_ack_sent) && + SEQ_LT(th->th_seq, tp->last_ack_sent + tp->rcv_wnd)) || + (tp->rcv_wnd == 0 && tp->last_ack_sent == th->th_seq)) { switch (tp->t_state) { case TCPS_SYN_RECEIVED: diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c index 0639698..92032cc 100644 --- a/sys/netinet/tcp_reass.c +++ b/sys/netinet/tcp_reass.c @@ -1514,8 +1514,9 @@ trimthenstep6: * RFC 1337. */ if (thflags & TH_RST) { - if (SEQ_GEQ(th->th_seq, tp->last_ack_sent) && - SEQ_LT(th->th_seq, tp->last_ack_sent + tp->rcv_wnd)) { + if ((SEQ_GEQ(th->th_seq, tp->last_ack_sent) && + SEQ_LT(th->th_seq, tp->last_ack_sent + tp->rcv_wnd)) || + (tp->rcv_wnd == 0 && tp->last_ack_sent == th->th_seq)) { switch (tp->t_state) { case TCPS_SYN_RECEIVED: -- cgit v1.1