lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #26301] Out of order FIN closes half-closed connection


From: Ben Hastings
Subject: [lwip-devel] [bug #26301] Out of order FIN closes half-closed connection
Date: Wed, 22 Apr 2009 23:02:06 +0000
User-agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648)

URL:
  <http://savannah.nongnu.org/bugs/?26301>

                 Summary: Out of order FIN closes half-closed connection
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: hastings
            Submitted on: Wed 22 Apr 2009 07:02:05 PM EDT
                Category: TCP
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 
            lwIP version: CVS Head

    _______________________________________________________

Details:

After lwip initiates closing a connection, an out-of-order FIN will
transition the state from FIN_WAIT_1 or FIN_WAIT_2 to TIME_WAIT.  Any
retransmitted segments that arrive after the FIN are then ACK'ed but never
delivered to the application.

The following patch for tcp_in.c (1.3.0-STABLE) uses the same transition
criteria as the ESTABLISHED state, and appears to fix the problem.

@@ -640,8 +640,8 @@
     }
     break;
   case FIN_WAIT_1:
-    tcp_receive(pcb);
-    if (flags & TCP_FIN) {
+    accepted_inseq = tcp_receive(pcb);
+    if ((flags & TCP_FIN) && accepted_inseq) {
       if (flags & TCP_ACK && ackno == pcb->snd_nxt) {
         LWIP_DEBUGF(TCP_DEBUG,
           ("TCP connection closed %"U16_F" -> %"U16_F".\n",
inseg.tcphdr->src, inseg.tcphdr->dest));
@@ -659,8 +659,8 @@
     }
     break;
   case FIN_WAIT_2:
-    tcp_receive(pcb);
-    if (flags & TCP_FIN) {
+    accepted_inseq = tcp_receive(pcb);
+    if ((flags & TCP_FIN) && accepted_inseq) {
       LWIP_DEBUGF(TCP_DEBUG, ("TCP connection closed %"U16_F" ->
%"U16_F".\n", inseg.tcphdr->src, inseg.tcphdr->dest));
       tcp_ack_now(pcb);
       tcp_pcb_purge(pcb);





    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?26301>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]