mirror of
https://passt.top/passt
synced 2025-05-22 17:25:35 +02:00
tcp: Flush socket before checking for more data in active close state
Otherwise, if all the pending data is acknowledged: - tcp_update_seqack_from_tap() updates the current tap-side ACK sequence (conn->seq_ack_from_tap) - next, we compare the sequence we sent (conn->seq_to_tap) to the ACK sequence (conn->seq_ack_from_tap) in tcp_data_from_sock() to understand if there's more data we can send. If they match, we conclude that we haven't sent any of that data, and keep re-sending it. We need, instead, to flush the socket (drop acknowledged data) before calling tcp_update_seqack_from_tap(), so that once we update conn->seq_ack_from_tap, we can be sure that all data until there is gone from the socket. Link: https://bugs.passt.top/show_bug.cgi?id=114 Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> Fixes:30f1e082c3
("tcp: Keep updating window and checking for socket data after FIN from guest") Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> (cherry picked from commitebdd46367c
)
This commit is contained in:
parent
53f2ed715e
commit
37550961ea
1 changed files with 1 additions and 0 deletions
1
tcp.c
1
tcp.c
|
@ -2047,6 +2047,7 @@ int tcp_tap_handler(const struct ctx *c, uint8_t pif, sa_family_t af,
|
|||
|
||||
/* Established connections not accepting data from tap */
|
||||
if (conn->events & TAP_FIN_RCVD) {
|
||||
tcp_sock_consume(conn, ntohl(th->ack_seq));
|
||||
tcp_update_seqack_from_tap(c, conn, ntohl(th->ack_seq));
|
||||
tcp_tap_window_update(conn, ntohs(th->window));
|
||||
tcp_data_from_sock(c, conn);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue