tcp: Fix partial (ACK) message coalescing, ACK timeout, MSG_MORE flag setting

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2021-07-17 17:57:11 +02:00
parent 33482d5bf2
commit 4667226bb0

7
tcp.c
View file

@ -363,7 +363,7 @@
#define WINDOW_DEFAULT 14600 /* RFC 6928 */ #define WINDOW_DEFAULT 14600 /* RFC 6928 */
#define SYN_TIMEOUT 240000 /* ms */ #define SYN_TIMEOUT 240000 /* ms */
#define ACK_TIMEOUT 10000 #define ACK_TIMEOUT 2000
#define ACK_INTERVAL 50 #define ACK_INTERVAL 50
#define ACT_TIMEOUT 7200000 #define ACT_TIMEOUT 7200000
#define FIN_TIMEOUT 240000 #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) if (off < sizeof(*th) || off > __len)
break; break;
if (!i && (!th->ack || len != off))
break;
__this = ntohl(th->ack_seq); __this = ntohl(th->ack_seq);
if (!i || __this - __seq_max < MAX_WINDOW) 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 && if (skip < len - off &&
tcp_send_to_sock(c, conn, tcp_send_to_sock(c, conn,
msg[0].l4h + off + skip, len - off - skip, msg[0].l4h + off + skip, len - off - skip,
th->psh ? 0 : MSG_MORE)) (count > 1) ? MSG_MORE : 0))
return 1; return 1;
if (count == 1) if (count == 1)