lwip-users
[Top][All Lists]
Advanced

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

SV: [lwip-users] sending a RST when the connection is in anon-synchroniz


From: Jan Wester
Subject: SV: [lwip-users] sending a RST when the connection is in anon-synchronized state(SYN-SENT, SYN-RECEIVED)
Date: Tue, 31 May 2005 08:49:07 +0200

Hello
I also add a patch for RST problem, it is not written by my self, it was
mailed by someone
/Jan


WHI KONSULT
Jan Wester
Scheelegatan 11
SE-112 28 Stockholm
+46 8 449 05 30


-----Ursprungligt meddelande-----
Från: address@hidden
[mailto:address@hidden För Olaf Peters
Skickat: den 30 maj 2005 17:27
Till: address@hidden
Ämne: [lwip-users] sending a RST when the connection is in anon-synchronized
state(SYN-SENT, SYN-RECEIVED)

Hi,

During TCP tests between lwIP 1.1.0 and Windows-XP I discovered that lwIP
doesn't send a RST segment when the connection is in a non-synchronized
state (SYN-SENT, SYN-RECEIVED) and an incoming segment acknowledges
something not yet sent. See item 2 in the section "Reset Generation",
RFC793, page 36.

I discovered this when I had a half open connection, i.e. I restarted my
system when my app had an open connection with XP (so XP still thinks it is
connected). In this half open connection state, my application on top of
lwIP tried to connect to XP, and XP did send an ACK to me (see also
figure-10 in RFC793). Anybody else did run into the same problem?

Olaf.


Below are patches for the changes I applied to lwIP 1.1.0 to solve my
problems, please have a look and comment:


*** lwip-1.1.0-org/src/core/tcp_in.c    Wed Nov 24 17:05:42 2004
--- lwip-1.1.0/src/core/tcp_in.c        Tue May 24 17:40:20 2005
*************** tcp_process(struct tcp_pcb *pcb)
*** 561,566 ****
--- 562,579 ----
        TCP_EVENT_CONNECTED(pcb, ERR_OK, err);
        tcp_ack(pcb);
      }
+     else {
+       /* When we received an ACK, we might deal with an half-open
+          connection (the other side might be in a synchronized/connected
+          state). Send a RST to bring the other side in a non-synchronized 
+          state. */
+       if (flags & TCP_ACK) {
+          tcp_rst(ackno, seqno + tcplen, &(iphdr->dest), &(iphdr->src),
+                  tcphdr->dest, tcphdr->src);
+       }
+     }
      break;
    case SYN_RCVD:
      if (flags & TCP_ACK &&
*************** tcp_process(struct tcp_pcb *pcb)
*** 586,591 ****
--- 599,613 ----
          tcp_receive(pcb);
          pcb->cwnd = pcb->mss;
        }
+       else {
+         /* We received an ACK but with an incorrect ack number. Send a RST
+            to inform the other side about this situation. */
+         tcp_rst(ackno, seqno + tcplen, &(iphdr->dest), &(iphdr->src),
+                 tcphdr->dest, tcphdr->src);
+       }
      }
      break;
    case CLOSE_WAIT:




_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users

Attachment: tcp_connection_start_patch1.txt
Description: Text document


reply via email to

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