lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #20779] Keep-Alive and SYNs


From: Kieran Mansley
Subject: [lwip-devel] [bug #20779] Keep-Alive and SYNs
Date: Thu, 26 Mar 2009 14:15:57 +0000
User-agent: Opera/9.21 (X11; Linux i686; U; en)

Follow-up Comment #15, bug #20779 (project lwip):

OK, how about this?

diff -r 163ba0f0bd9a core/tcp_in.c
--- a/core/tcp_in.c
+++ b/core/tcp_in.c
@@ -536,6 +536,12 @@ tcp_process(struct tcp_pcb *pcb)
     }
   }
 
+  if ((flags & TCP_SYN) && (pcb->state != SYN_SENT && pcb->state !=
SYN_RCVD)) { 
+    /* Cope with new connection attempt after remote end crashed */
+    tcp_ack_now(pcb);
+    return ERR_OK;
+  }
+  
   /* Update the PCB (in)activity timer. */
   pcb->tmr = tcp_ticks;
   pcb->keep_cnt_sent = 0;
@@ -597,8 +603,7 @@ tcp_process(struct tcp_pcb *pcb)
     }
     break;
   case SYN_RCVD:
-    if (flags & TCP_ACK &&
-       !(flags & TCP_RST)) {
+    if (flags & TCP_ACK) {
       /* expected ACK number? */
       if (TCP_SEQ_BETWEEN(ackno, pcb->lastack+1, pcb->snd_nxt)) {
         u16_t old_cwnd;
@@ -633,6 +638,9 @@ tcp_process(struct tcp_pcb *pcb)
         tcp_rst(ackno, seqno + tcplen, &(iphdr->dest), &(iphdr->src),
                 tcphdr->dest, tcphdr->src);
       }
+    } else if ((flags & TCP_SYN) && (seqno == pcb->rcv_nxt - 1)) {
+      /* Looks like another copy of the SYN - retransmit our SYN-ACK */
+      tcp_rexmit(pcb);
     }
     break;
   case CLOSE_WAIT:


    _______________________________________________________

Reply to this item at:

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

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





reply via email to

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