diff options
author | Zhang Chen <chen.zhang@intel.com> | 2021-11-18 11:20:10 +0800 |
---|---|---|
committer | Jason Wang <jasowang@redhat.com> | 2021-11-19 11:44:22 +0800 |
commit | fb5eca4a571e303aafac7130abd66adc184aae72 (patch) | |
tree | ac8ddf64ae248d986f62269539cb37e484a1a7b7 /net | |
parent | d05dcd94aee88728facafb993c7280547eb4d645 (diff) | |
download | qemu-fb5eca4a571e303aafac7130abd66adc184aae72.zip qemu-fb5eca4a571e303aafac7130abd66adc184aae72.tar.gz qemu-fb5eca4a571e303aafac7130abd66adc184aae72.tar.bz2 |
net/colo-compare.c: Fix ACK track reverse issue
The TCP protocol ACK maybe bigger than uint32_t MAX.
At this time, the ACK will reverse to 0. This patch
fix the max_ack and min_ack track issue.
Signed-off-by: Zhang Chen <chen.zhang@intel.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/colo-compare.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/colo-compare.c b/net/colo-compare.c index b8876d7..1225f40 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -209,7 +209,8 @@ static void fill_pkt_tcp_info(void *data, uint32_t *max_ack) pkt->tcp_seq = ntohl(tcphd->th_seq); pkt->tcp_ack = ntohl(tcphd->th_ack); - *max_ack = *max_ack > pkt->tcp_ack ? *max_ack : pkt->tcp_ack; + /* Need to consider ACK will bigger than uint32_t MAX */ + *max_ack = pkt->tcp_ack - *max_ack > 0 ? pkt->tcp_ack : *max_ack; pkt->header_size = pkt->transport_header - (uint8_t *)pkt->data + (tcphd->th_off << 2); pkt->payload_size = pkt->size - pkt->header_size; @@ -413,7 +414,8 @@ static void colo_compare_tcp(CompareState *s, Connection *conn) * can ensure that the packet's payload is acknowledged by * primary and secondary. */ - uint32_t min_ack = conn->pack > conn->sack ? conn->sack : conn->pack; + uint32_t min_ack = conn->pack - conn->sack > 0 ? + conn->sack : conn->pack; pri: if (g_queue_is_empty(&conn->primary_list)) { |