summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsilby <silby@FreeBSD.org>2004-11-25 19:04:20 +0000
committersilby <silby@FreeBSD.org>2004-11-25 19:04:20 +0000
commite463fe44657664bf80a440c908f66051d74d135a (patch)
treeb80df82514cc044e498de88da36afc62df7155a6
parent8b37a26c64866fc472a011388a1f3a6729e88d37 (diff)
downloadFreeBSD-src-e463fe44657664bf80a440c908f66051d74d135a.zip
FreeBSD-src-e463fe44657664bf80a440c908f66051d74d135a.tar.gz
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
-rw-r--r--sys/netinet/tcp_input.c5
-rw-r--r--sys/netinet/tcp_reass.c5
2 files changed, 6 insertions, 4 deletions
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:
OpenPOWER on IntegriCloud