aboutgitcodebugslistschat
path: root/tcp.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-07-17 17:57:11 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-07-17 17:57:11 +0200
commit4667226bb08b06c70df9e4508d8304ffb4ba0e2d (patch)
tree20fcb4300e6441c1b3cb73ca1f97d73bb47ae665 /tcp.c
parent33482d5bf29312464b208beb01a5302257e82fe6 (diff)
downloadpasst-4667226bb08b06c70df9e4508d8304ffb4ba0e2d.tar
passt-4667226bb08b06c70df9e4508d8304ffb4ba0e2d.tar.gz
passt-4667226bb08b06c70df9e4508d8304ffb4ba0e2d.tar.bz2
passt-4667226bb08b06c70df9e4508d8304ffb4ba0e2d.tar.lz
passt-4667226bb08b06c70df9e4508d8304ffb4ba0e2d.tar.xz
passt-4667226bb08b06c70df9e4508d8304ffb4ba0e2d.tar.zst
passt-4667226bb08b06c70df9e4508d8304ffb4ba0e2d.zip
tcp: Fix partial (ACK) message coalescing, ACK timeout, MSG_MORE flag setting
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp.c')
-rw-r--r--tcp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tcp.c b/tcp.c
index dec2df3..86cb92c 100644
--- a/tcp.c
+++ b/tcp.c
@@ -363,7 +363,7 @@
#define WINDOW_DEFAULT 14600 /* RFC 6928 */
#define SYN_TIMEOUT 240000 /* ms */
-#define ACK_TIMEOUT 10000
+#define ACK_TIMEOUT 2000
#define ACK_INTERVAL 50
#define ACT_TIMEOUT 7200000
#define FIN_TIMEOUT 240000
@@ -1403,6 +1403,9 @@ int tcp_tap_handler(struct ctx *c, int af, void *addr,
if (off < sizeof(*th) || off > __len)
break;
+ if (!i && (!th->ack || len != off))
+ break;
+
__this = ntohl(th->ack_seq);
if (!i || __this - __seq_max < MAX_WINDOW)
@@ -1515,7 +1518,7 @@ int tcp_tap_handler(struct ctx *c, int af, void *addr,
if (skip < len - off &&
tcp_send_to_sock(c, conn,
msg[0].l4h + off + skip, len - off - skip,
- th->psh ? 0 : MSG_MORE))
+ (count > 1) ? MSG_MORE : 0))
return 1;
if (count == 1)