aboutgitcodebugslistschat
path: root/tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'tcp.c')
-rw-r--r--tcp.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/tcp.c b/tcp.c
index ca0c185..f55cf26 100644
--- a/tcp.c
+++ b/tcp.c
@@ -2724,8 +2724,19 @@ void tcp_timer_handler(const struct ctx *c, union epoll_ref ref,
flow_dbg(conn, "handshake timeout");
tcp_rst(c, conn, now);
} else {
+ int flags = SYN;
+
flow_trace(conn, "SYN timeout, retry");
- if (tcp_send_flag(c, conn, SYN, now)) {
+
+ /* Retransmit what we sent: a SYN-ACK if the
+ * guest initiated the connection, a SYN
+ * otherwise. Rewind to ISN at each retry.
+ */
+ if (conn->events & TAP_SYN_RCVD)
+ flags |= ACK;
+ conn->seq_to_tap = conn->seq_ack_from_tap;
+
+ if (tcp_send_flag(c, conn, flags, now)) {
tcp_rst(c, conn, now);
return;
}