diff options
Diffstat (limited to 'tcp.c')
| -rw-r--r-- | tcp.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -220,7 +220,7 @@ * @seq_from_tap: next sequence for packets from tap/guest (expected) * @seq_ack_to_tap: last ACK number sent to tap/guest * - * @seq_init_from_tap: initial sequence number from tap/guest + * @seq_init_from_tap: guest sequence base for bytes acknowledged by the peer * @seq_init_to_tap: initial sequence number from tap/guest * * @wnd_from_tap: last window size received from tap, never scaled @@ -3942,6 +3942,17 @@ int tcp_flow_migrate_target_ext(struct ctx *c, struct tcp_tap_conn *conn, return -EINVAL; } + /* The target socket's tcpi_bytes_acked starts at zero after migration. + * Subtract the length of the current sending queue from the accepted + * guest sequence to recover the amount of bytes the peer had already + * acknowledged. + * + * Replace the initial sequence number with this quantity to adjust the + * acknowledgement sequence number we send to the guest, as calculated by + * tcp_update_seqack_wnd(). + */ + conn->seq_init_from_tap = conn->seq_from_tap - t.sndq; + if (read_all_buf(fd, tcp_migrate_snd_queue, t.sndq)) { rc = -errno; flow_perror(conn, "Failed to read send queue data"); |
