tcp: Fix setting window from maximum ACK sequence in batch

If we're at the first message in a batch, it's safe to get the
window value from it, and there's no need to subtract anything for
a comparison on that's not even done -- we'll override it later in
any case if we find messages with a higher ACK sequence number.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2021-09-16 08:20:50 +02:00
parent 3be131280d
commit a7eb8bb2f6

8
tcp.c
View file

@ -2002,12 +2002,8 @@ static void tcp_data_from_tap(struct ctx *c, struct tcp_tap_conn *conn,
seq = ntohl(th->seq);
ack_seq = ntohl(th->ack_seq);
if (!i) {
if (count == 1)
max_ack_seq_wnd = ntohs(th->window);
else
max_ack_seq_wnd = ntohs(th->window) - 1;
}
if (!i)
max_ack_seq_wnd = ntohs(th->window);
if (th->ack) {
ack = 1;