diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2021-10-16 16:58:16 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2021-10-16 16:58:16 +0200 |
commit | 1ac0d52820e0cfd6c7f301e3f5d5717cda4dea88 (patch) | |
tree | e776010ce8ebf904bed23c1af0001845e8707ed4 /tcp.c | |
parent | 85038e94104717f6c814756fbc798196e319b48f (diff) | |
download | passt-1ac0d52820e0cfd6c7f301e3f5d5717cda4dea88.tar passt-1ac0d52820e0cfd6c7f301e3f5d5717cda4dea88.tar.gz passt-1ac0d52820e0cfd6c7f301e3f5d5717cda4dea88.tar.bz2 passt-1ac0d52820e0cfd6c7f301e3f5d5717cda4dea88.tar.lz passt-1ac0d52820e0cfd6c7f301e3f5d5717cda4dea88.tar.xz passt-1ac0d52820e0cfd6c7f301e3f5d5717cda4dea88.tar.zst passt-1ac0d52820e0cfd6c7f301e3f5d5717cda4dea88.zip |
tcp: Arm tcp_data_noack on insufficient window too, don't reset if ACK doesn't match
...and while at it, reverse the operands in the window equality
comparison to detect the need for fast re-transmit: it's easier
to read this way.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp.c')
-rw-r--r-- | tcp.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -2156,6 +2156,7 @@ static int tcp_data_from_sock(struct ctx *c, struct tcp_tap_conn *conn, if (!conn->wnd_from_tap || already_sent >= conn->wnd_from_tap) { tcp_tap_epoll_mask(c, conn, conn->events | EPOLLET); + conn->tap_data_noack = *now; return 0; } @@ -2374,7 +2375,7 @@ static void tcp_data_from_tap(struct ctx *c, struct tcp_tap_conn *conn, /* Fast re-transmit */ retr = !len && !th->fin && ack_seq == max_ack_seq && - max_ack_seq_wnd == ntohs(th->window); + ntohs(th->window) == max_ack_seq_wnd; max_ack_seq_wnd = ntohs(th->window); max_ack_seq = ack_seq; @@ -2435,7 +2436,8 @@ static void tcp_data_from_tap(struct ctx *c, struct tcp_tap_conn *conn, if (ack) { conn->ts_ack_from_tap = *now; - conn->tap_data_noack = ((struct timespec) { 0, 0 }); + if (max_ack_seq == conn->seq_to_tap) + conn->tap_data_noack = ((struct timespec) { 0, 0 }); tcp_sock_consume(conn, max_ack_seq); } |