]> git.meshlink.io Git - utcp/commitdiff
Correctly handle incoming retransmissions of SYN packets.
authorGuus Sliepen <guus@sliepen.org>
Thu, 10 Oct 2019 20:10:44 +0000 (22:10 +0200)
committerGuus Sliepen <guus@sliepen.org>
Thu, 10 Oct 2019 20:10:44 +0000 (22:10 +0200)
utcp.c

diff --git a/utcp.c b/utcp.c
index ac162fe708a0d657abffb4cb62ecd4881a7fc79a..f35f96560af29eaafcf67a95030884414d8e3cfd 100644 (file)
--- 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: