aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-10-16 16:58:16 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-10-16 16:58:16 +0200
commit1ac0d52820e0cfd6c7f301e3f5d5717cda4dea88 (patch)
treee776010ce8ebf904bed23c1af0001845e8707ed4
parent85038e94104717f6c814756fbc798196e319b48f (diff)
downloadpasst-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>
-rw-r--r--tcp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tcp.c b/tcp.c
index 35e2093..6b256bf 100644
--- a/tcp.c
+++ b/tcp.c
@@ -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);
}