* [PATCH 1/2] net/colo-compare.c: Fix ACK track reverse issue
@ 2021-11-18 3:20 Zhang Chen
2021-11-18 3:20 ` [PATCH 2/2] net/colo-compare.c: Fix incorrect return when input wrong size Zhang Chen
2021-11-19 3:19 ` [PATCH 1/2] net/colo-compare.c: Fix ACK track reverse issue Jason Wang
0 siblings, 2 replies; 4+ messages in thread
From: Zhang Chen @ 2021-11-18 3:20 UTC (permalink / raw)
To: Jason Wang, Li Zhijian; +Cc: Zhang Chen, qemu-dev
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>
---
net/colo-compare.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/colo-compare.c b/net/colo-compare.c
index b8876d7fd9..1225f40e41 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)) {
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] net/colo-compare.c: Fix incorrect return when input wrong size
2021-11-18 3:20 [PATCH 1/2] net/colo-compare.c: Fix ACK track reverse issue Zhang Chen
@ 2021-11-18 3:20 ` Zhang Chen
2021-11-19 3:19 ` Jason Wang
2021-11-19 3:19 ` [PATCH 1/2] net/colo-compare.c: Fix ACK track reverse issue Jason Wang
1 sibling, 1 reply; 4+ messages in thread
From: Zhang Chen @ 2021-11-18 3:20 UTC (permalink / raw)
To: Jason Wang, Li Zhijian; +Cc: Zhang Chen, qemu-dev
Signed-off-by: Zhang Chen <chen.zhang@intel.com>
---
net/colo-compare.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/colo-compare.c b/net/colo-compare.c
index 1225f40e41..b966e7e514 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -807,7 +807,7 @@ static int compare_chr_send(CompareState *s,
}
if (!size) {
- return 0;
+ return -1;
}
entry = g_slice_new(SendEntry);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] net/colo-compare.c: Fix ACK track reverse issue
2021-11-18 3:20 [PATCH 1/2] net/colo-compare.c: Fix ACK track reverse issue Zhang Chen
2021-11-18 3:20 ` [PATCH 2/2] net/colo-compare.c: Fix incorrect return when input wrong size Zhang Chen
@ 2021-11-19 3:19 ` Jason Wang
1 sibling, 0 replies; 4+ messages in thread
From: Jason Wang @ 2021-11-19 3:19 UTC (permalink / raw)
To: Zhang Chen, Li Zhijian; +Cc: qemu-dev
在 2021/11/18 上午11:20, Zhang Chen 写道:
> 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>
> ---
Applied.
Thanks
> net/colo-compare.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/colo-compare.c b/net/colo-compare.c
> index b8876d7fd9..1225f40e41 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)) {
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] net/colo-compare.c: Fix incorrect return when input wrong size
2021-11-18 3:20 ` [PATCH 2/2] net/colo-compare.c: Fix incorrect return when input wrong size Zhang Chen
@ 2021-11-19 3:19 ` Jason Wang
0 siblings, 0 replies; 4+ messages in thread
From: Jason Wang @ 2021-11-19 3:19 UTC (permalink / raw)
To: Zhang Chen, Li Zhijian; +Cc: qemu-dev
在 2021/11/18 上午11:20, Zhang Chen 写道:
> Signed-off-by: Zhang Chen <chen.zhang@intel.com>
> ---
Applied.
Thanks
> net/colo-compare.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/colo-compare.c b/net/colo-compare.c
> index 1225f40e41..b966e7e514 100644
> --- a/net/colo-compare.c
> +++ b/net/colo-compare.c
> @@ -807,7 +807,7 @@ static int compare_chr_send(CompareState *s,
> }
>
> if (!size) {
> - return 0;
> + return -1;
> }
>
> entry = g_slice_new(SendEntry);
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-19 3:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-18 3:20 [PATCH 1/2] net/colo-compare.c: Fix ACK track reverse issue Zhang Chen
2021-11-18 3:20 ` [PATCH 2/2] net/colo-compare.c: Fix incorrect return when input wrong size Zhang Chen
2021-11-19 3:19 ` Jason Wang
2021-11-19 3:19 ` [PATCH 1/2] net/colo-compare.c: Fix ACK track reverse issue Jason Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).