From 25675cca79330f968b3fb106793a5265615f4df7 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Thu, 10 Oct 2019 22:10:44 +0200 Subject: [PATCH] Correctly handle incoming retransmissions of SYN packets. --- utcp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utcp.c b/utcp.c index ac162fe..f35f965 100644 --- a/utcp.c +++ b/utcp.c @@ -1055,6 +1055,7 @@ ssize_t utcp_recv(struct utcp *utcp, const void *data, size_t len) { c->flags = UTCP_TCP; } +synack: // Return SYN+ACK, go to SYN_RECEIVED state c->snd.wnd = hdr.wnd; c->rcv.irs = hdr.seq; @@ -1410,6 +1411,9 @@ skip_ack: break; case SYN_RECEIVED: + // This is a retransmit of a SYN, send back the SYNACK. + goto synack; + case ESTABLISHED: case FIN_WAIT_1: case FIN_WAIT_2: -- 2.39.5