tcp: Never send ACK because of pending unacknowleged data when sending SYN
With a kernel older than 5.3 (no_snd_wnd set), ack_pending in tcp_send_to_tap() might be true at the beginning of a new connection initiated by a socket. This means we send the first SYN segment to the tap together with ACK set, which is clearly invalid and triggers the receiver to reply with an RST segment right away. Set ack_pending to 0 whenever we're sending a SYN segment. In case of a SYN, ACK segment sent by the caller, the caller passes the ACK flag explicitly. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
f2e3b9defd
commit
cc2ebfd5f2
1 changed files with 3 additions and 1 deletions
4
tcp.c
4
tcp.c
|
@ -1137,7 +1137,9 @@ static int tcp_send_to_tap(struct ctx *c, struct tcp_tap_conn *conn,
|
||||||
conn->seq_to_tap += len;
|
conn->seq_to_tap += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conn->no_snd_wnd) {
|
if (flags & SYN) {
|
||||||
|
ack_pending = 0;
|
||||||
|
} else if (conn->no_snd_wnd) {
|
||||||
ack_pending = (conn->seq_from_tap - conn->seq_ack_to_tap) <
|
ack_pending = (conn->seq_from_tap - conn->seq_ack_to_tap) <
|
||||||
MAX_WINDOW;
|
MAX_WINDOW;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue