Skip to content
Snippets Groups Projects
Commit fb5eca4a authored by Zhang Chen's avatar Zhang Chen Committed by Jason Wang
Browse files

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: default avatarZhang Chen <chen.zhang@intel.com>
Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
parent d05dcd94
No related branches found
No related tags found
No related merge requests found
...@@ -209,7 +209,8 @@ static void fill_pkt_tcp_info(void *data, uint32_t *max_ack) ...@@ -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_seq = ntohl(tcphd->th_seq);
pkt->tcp_ack = ntohl(tcphd->th_ack); 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 pkt->header_size = pkt->transport_header - (uint8_t *)pkt->data
+ (tcphd->th_off << 2); + (tcphd->th_off << 2);
pkt->payload_size = pkt->size - pkt->header_size; pkt->payload_size = pkt->size - pkt->header_size;
...@@ -413,7 +414,8 @@ static void colo_compare_tcp(CompareState *s, Connection *conn) ...@@ -413,7 +414,8 @@ static void colo_compare_tcp(CompareState *s, Connection *conn)
* can ensure that the packet's payload is acknowledged by * can ensure that the packet's payload is acknowledged by
* primary and secondary. * 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: pri:
if (g_queue_is_empty(&conn->primary_list)) { if (g_queue_is_empty(&conn->primary_list)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment