diff options
| -rw-r--r-- | tcp.c | 13 | ||||
| -rw-r--r-- | tcp_conn.h | 4 |
2 files changed, 14 insertions, 3 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"); @@ -34,7 +34,7 @@ * @seq_ack_from_tap: Last ACK number received from tap * @seq_from_tap: Next sequence for packets from tap (not actually sent) * @seq_ack_to_tap: Last ACK number sent to tap - * @seq_init_from_tap: Initial sequence number from tap + * @seq_init_from_tap: Guest sequence base for bytes acknowledged by the peer */ struct tcp_tap_conn { /* Must be first element */ @@ -136,7 +136,7 @@ struct tcp_tap_conn { * @seq_ack_from_tap: Last ACK number received from tap * @seq_from_tap: Next sequence for packets from tap (not actually sent) * @seq_ack_to_tap: Last ACK number sent to tap - * @seq_init_from_tap: Initial sequence number from tap + * @seq_init_from_tap: Guest sequence base for bytes acknowledged by the peer */ struct tcp_tap_transfer { uint8_t pif[SIDES]; |
