aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-09-14 16:51:23 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-09-14 16:57:50 +0200
commit621c589d3695b8a4a781beaab255bbd1ab68c154 (patch)
treeb4c4ef210588f8151b87fb83ecacd8e16689b269
parent7c82ea4dd910bd68214c41d9c872e73cf2dc8554 (diff)
downloadpasst-621c589d3695b8a4a781beaab255bbd1ab68c154.tar
passt-621c589d3695b8a4a781beaab255bbd1ab68c154.tar.gz
passt-621c589d3695b8a4a781beaab255bbd1ab68c154.tar.bz2
passt-621c589d3695b8a4a781beaab255bbd1ab68c154.tar.lz
passt-621c589d3695b8a4a781beaab255bbd1ab68c154.tar.xz
passt-621c589d3695b8a4a781beaab255bbd1ab68c154.tar.zst
passt-621c589d3695b8a4a781beaab255bbd1ab68c154.zip
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>
-rw-r--r--tcp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tcp.c b/tcp.c
index 9f9b62d..4c6bfd0 100644
--- a/tcp.c
+++ b/tcp.c
@@ -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);
}
- 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 (ack_tap_ms > 10 * ACK_TIMEOUT) {
+ if (sock_ms - ack_tap_ms > 10 * ACK_TIMEOUT) {
tcp_rst(c, conn);
break;
}
@@ -3026,7 +3026,7 @@ static void tcp_timer_one(struct ctx *c, struct tcp_tap_conn *conn,
break;
case CLOSE_WAIT:
case FIN_WAIT_1_SOCK_FIN:
- if (ack_tap_ms > FIN_TIMEOUT)
+ if (sock_ms - ack_tap_ms > FIN_TIMEOUT)
tcp_rst(c, conn);
break;
case FIN_WAIT_1: