lwip-users
[Top][All Lists]
Advanced

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

SV: [lwip-users] TCP connect problem


From: Jan Wester
Subject: SV: [lwip-users] TCP connect problem
Date: Thu, 24 Feb 2005 16:11:24 +0100

Hi
I make my restart after the connection is closed, maybe it has something
with TIME_WAIT state.
I have a saved text from a mail, maybe this solved my problem?

RCS file: lwip/src/core/tcp_in.c,v
retrieving revision 1.2
diff -u -r1.2 tcp_in.c
--- tcp_in.c    5 Mar 2004 03:36:30 -0000       1.2
+++ tcp_in.c    16 Mar 2004 06:07:04 -0000
@@ -540,8 +540,16 @@
   case SYN_SENT:
     LWIP_DEBUGF(TCP_INPUT_DEBUG, ("SYN-SENT: ackno %lu pcb->snd_nxt %lu
unacked %lu\n", ackno,
      pcb->snd_nxt, ntohl(pcb->unacked->tcphdr->seqno)));
-    if ((flags & TCP_ACK) && (flags & TCP_SYN)
-        && ackno == ntohl(pcb->unacked->tcphdr->seqno) + 1) {
+    if (flags & (TCP_ACK | TCP_SYN))
+    {
+        if ( ackno != ntohl(pcb->unacked->tcphdr->seqno) + 1) {
+          tcp_rst( ackno, ackno, &(pcb->local_ip), &(pcb->remote_ip),
pcb->local_port, pcb->remote_port);
+          return ERR_OK;          
+        }
+    } else
+    {
+        return ERR_OK;
+    }
       pcb->rcv_nxt = seqno + 1;
       pcb->lastack = ackno;
       pcb->snd_wnd = tcphdr->wnd;
@@ -561,7 +569,6 @@
        * connected. */
       TCP_EVENT_CONNECTED(pcb, ERR_OK, err);
       tcp_ack(pcb);
-    }
     break;
   case SYN_RCVD:
     if (flags & TCP_ACK && 


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 Adam Dunkels
Skickat: den 24 februari 2005 15:52
Till: address@hidden; Mailing list for lwIP users
Ämne: Re: [lwip-users] TCP connect problem

On Thu, 2005-02-24 at 14:23 +0000, Kieran Mansley wrote:
> On Thu, 2005-02-24 at 15:19 +0100, Jan Wester wrote:
> > Hi
> > Normaly I can do many TCP connect-close sequence, but if I restart 
> > my system and try to do TCP connect I often got tcp_error.
> > Is it any problem with seq no ? I using 0.7.2 On the sniffer I can 
> > see SYN SEQ=6525
> >         ACK=6533        Only ack ?
> > And after lot of try it connect
> > SYN SEQ=6595
> > SYN ACK=6596        Connect
> 
> Sounds like one of the machines is interpreting the SYN as relating to 
> a connection that existed before the reboot.  As it thinks it's 
> already open, it responds with an ACK rather than a SYN-ACK, although 
> I'm not sure this is correct behaviour: I'd have to check the RFC to be
sure.
> Eventually, the connection times out and then the SYN succeeds.  

If I remember correctly, yhis is the intended behavior according to the RFC,
but with a small addition: the ACK should trigger an RST from the side that
sent the SYN. This will abort the connection. (But I'm not sure that lwIP
follows the RFC in this case.)

Regards,

/adam
--
Adam Dunkels, Swedish Institute of Computer Science
http://www.sics.se/~adam/, <address@hidden>




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






reply via email to

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