From f31d6f271fe7b1989fb335a251cfa07a22f83f57 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Fri, 22 Nov 2013 15:37:21 +0100 Subject: [PATCH] Bugfix: if a SYN is received in the SYN_RCVD state we should not send a blank SYN, but a SYNACK in response. --- core/net/uip6.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/net/uip6.c b/core/net/uip6.c index e79486ff1..7f51ce4e9 100644 --- a/core/net/uip6.c +++ b/core/net/uip6.c @@ -1833,8 +1833,12 @@ uip_process(uint8_t flag) UIP_TCP_BUF->seqno[2] != uip_connr->rcv_nxt[2] || UIP_TCP_BUF->seqno[3] != uip_connr->rcv_nxt[3])) { - if(UIP_TCP_BUF->flags & TCP_SYN) { - goto tcp_send_synack; + if((UIP_TCP_BUF->flags & TCP_SYN)) { + if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_SYN_RCVD) { + goto tcp_send_synack; + } else if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_SYN_SENT) { + goto tcp_send_syn; + } } goto tcp_send_ack; }