netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tcp: missing check ACK flag of received segment in FIN-WAIT-2 state
@ 2009-06-25  8:29 Wei Yongjun
  2009-06-26  3:09 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2009-06-25  8:29 UTC (permalink / raw)
  To: David Miller, netdev

RFC0793 defined that in FIN-WAIT-2 state if the ACK bit is off drop
the segment and return[Page 72]. But this check is missing in function
tcp_timewait_state_process(). This cause the segment with FIN flag but
no ACK has two diffent action:

Case 1:
    Node A                      Node B
              <-------------    FIN,ACK
                                (enter FIN-WAIT-1)
    ACK       ------------->
                                (enter FIN-WAIT-2)
    FIN       ------------->    discard
                                (move sk to tw list)

Case 2:
    Node A                      Node B
              <-------------    FIN,ACK
                                (enter FIN-WAIT-1)
    ACK       ------------->
                                (enter FIN-WAIT-2)
                                (move sk to tw list)
    FIN       ------------->

              <-------------    ACK

This patch fixed the problem.

Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
 net/ipv4/tcp_minisocks.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 43bbba7..f8d67cc 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -128,7 +128,8 @@ tcp_timewait_state_process(struct inet_timewait_sock *tw, struct sk_buff *skb,
 			goto kill_with_rst;
 
 		/* Dup ACK? */
-		if (!after(TCP_SKB_CB(skb)->end_seq, tcptw->tw_rcv_nxt) ||
+		if (!th->ack ||
+		    !after(TCP_SKB_CB(skb)->end_seq, tcptw->tw_rcv_nxt) ||
 		    TCP_SKB_CB(skb)->end_seq == TCP_SKB_CB(skb)->seq) {
 			inet_twsk_put(tw);
 			return TCP_TW_SUCCESS;
-- 
1.6.2.2





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tcp: missing check ACK flag of received segment in FIN-WAIT-2 state
  2009-06-25  8:29 [PATCH] tcp: missing check ACK flag of received segment in FIN-WAIT-2 state Wei Yongjun
@ 2009-06-26  3:09 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-06-26  3:09 UTC (permalink / raw)
  To: yjwei; +Cc: netdev

From: Wei Yongjun <yjwei@cn.fujitsu.com>
Date: Thu, 25 Jun 2009 16:29:31 +0800

> RFC0793 defined that in FIN-WAIT-2 state if the ACK bit is off drop
> the segment and return[Page 72]. But this check is missing in function
> tcp_timewait_state_process(). This cause the segment with FIN flag but
> no ACK has two diffent action:
...
> This patch fixed the problem.
> 
> Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>

Patch applied, thank you.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-06-26  3:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-25  8:29 [PATCH] tcp: missing check ACK flag of received segment in FIN-WAIT-2 state Wei Yongjun
2009-06-26  3:09 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).