1
0
mirror of https://passt.top/passt synced 2024-07-05 09:15:48 +00:00

tcp: Properly time out ACK wait from tap

Seen with iperf3: a control connection is established, no data flows
for a while, all segments are acknowledged. The socket starts closing
it, and we immediately time out because the last ACK from tap was one
minute before that.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2021-09-14 16:51:23 +02:00
parent 7c82ea4dd9
commit 621c589d36

6
tcp.c
View File

@ -3004,9 +3004,9 @@ static void tcp_timer_one(struct ctx *c, struct tcp_tap_conn *conn,
tcp_send_to_tap(c, conn, 0, NULL, 0); tcp_send_to_tap(c, conn, 0, NULL, 0);
} }
if (ack_tap_ms > ACK_TIMEOUT) { if (sock_ms - ack_tap_ms > ACK_TIMEOUT) {
if (conn->seq_ack_from_tap < conn->seq_to_tap) { if (conn->seq_ack_from_tap < conn->seq_to_tap) {
if (ack_tap_ms > 10 * ACK_TIMEOUT) { if (sock_ms - ack_tap_ms > 10 * ACK_TIMEOUT) {
tcp_rst(c, conn); tcp_rst(c, conn);
break; break;
} }
@ -3026,7 +3026,7 @@ static void tcp_timer_one(struct ctx *c, struct tcp_tap_conn *conn,
break; break;
case CLOSE_WAIT: case CLOSE_WAIT:
case FIN_WAIT_1_SOCK_FIN: case FIN_WAIT_1_SOCK_FIN:
if (ack_tap_ms > FIN_TIMEOUT) if (sock_ms - ack_tap_ms > FIN_TIMEOUT)
tcp_rst(c, conn); tcp_rst(c, conn);
break; break;
case FIN_WAIT_1: case FIN_WAIT_1: