COLO-compare: Fix incorrect `if` logic
PATCH 1/1 COLO-compare: Fix incorrect `if` logic
'colo_mark_tcp_pkt' should return 'true' when packets are the same, and 'false' otherwise. However, it returns 'true' when 'colo_compare_packet_payload' returns non-zero while 'colo_compare_packet_payload' is just a 'memcmp'. The result is that COLO-compare reports inconsistent TCP packets when they are actually the same.
--- net/colo-compare.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/colo-compare.c +3 -3
@@ -319,7 +319,7 @@ static bool colo_mark_tcp_pkt(Packet *ppkt, Packet *spkt, *mark =0 ;if (ppkt->tcp_seq == spkt->tcp_seq && ppkt->seq_end == spkt->seq_end) { -if (colo_compare_packet_payload (ppkt, spkt, +if (!colo_compare_packet_payload (ppkt, spkt, ppkt->header_size, spkt->header_size, ppkt->payload_size)) { *mark =COLO_COMPARE_FREE_SECONDARY |COLO_COMPARE_FREE_PRIMARY ;
@@ -329,7 +329,7 @@ static bool colo_mark_tcp_pkt(Packet *ppkt, Packet *spkt,/* one part of secondary packet payload still need to be compared */ if (!after (ppkt->seq_end, spkt->seq_end)) { -if (colo_compare_packet_payload (ppkt, spkt, +if (!colo_compare_packet_payload (ppkt, spkt, ppkt->header_size + ppkt->offset, spkt->header_size + spkt->offset, ppkt->payload_size - ppkt->offset)) {
@@ -348,7 +348,7 @@ static bool colo_mark_tcp_pkt(Packet *ppkt, Packet *spkt,/* primary packet is longer than secondary packet, compare * the same part and mark the primary packet offset */ -if (colo_compare_packet_payload (ppkt, spkt, +if (!colo_compare_packet_payload (ppkt, spkt, ppkt->header_size + ppkt->offset, spkt->header_size + spkt->offset, spkt->payload_size - spkt->offset)) {
Signature · 1 line
2.17.1
Hi Fan,
you forgot to Cc the maintainers (doing that for you):
./scripts/get_maintainer.pl -f net/colo-compare.c
Zhang Chen <[email protected]> (supporter:COLO Proxy) Li Zhijian <[email protected]> (supporter:COLO Proxy) Jason Wang <[email protected]> (maintainer:Network device ba...) [email protected] (open list:All patches CC here)
Quoted 7 lines · Fan Yang
'
colo_mark_tcp_pkt' should return 'true' when packets are the same, and 'false' otherwise. However, it returns 'true' when 'colo_compare_packet_payload' returns non-zero while 'colo_compare_packet_payload' is just a 'memcmp'. The result is that COLO-compare reports inconsistent TCP packets when they are actually the same.
Quoted 37 lines
Signed-off-by Fan Yang <[email protected]>--- net/colo-compare.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)net/colo-compare.c +3
-3@@ -319,7 +319,7 @@ static bool colo_mark_tcp_pkt(Packet *ppkt, Packet *spkt, *mark =0 ;if (ppkt->tcp_seq == spkt->tcp_seq && ppkt->seq_end == spkt->seq_end) { -if (colo_compare_packet_payload (ppkt, spkt, +if (!colo_compare_packet_payload (ppkt, spkt, ppkt->header_size, spkt->header_size, ppkt->payload_size)) { *mark =COLO_COMPARE_FREE_SECONDARY |COLO_COMPARE_FREE_PRIMARY ;@@ -329,7 +329,7 @@ static bool colo_mark_tcp_pkt(Packet *ppkt, Packet *spkt,/* one part of secondary packet payload still need to be compared */ if (!after (ppkt->seq_end, spkt->seq_end)) { -if (colo_compare_packet_payload (ppkt, spkt, +if (!colo_compare_packet_payload (ppkt, spkt, ppkt->header_size + ppkt->offset, spkt->header_size + spkt->offset, ppkt->payload_size - ppkt->offset)) {@@ -348,7 +348,7 @@ static bool colo_mark_tcp_pkt(Packet *ppkt, Packet *spkt,/* primary packet is longer than secondary packet, compare * the same part and mark the primary packet offset */ -if (colo_compare_packet_payload (ppkt, spkt, +if (!colo_compare_packet_payload (ppkt, spkt, ppkt->header_size + ppkt->offset, spkt->header_size + spkt->offset, spkt->payload_size - spkt->offset)) {
Jason Wang
AppliedQuoted 18 lines · Philippe Mathieu-Daudé
Hi Fan,
you forgot to Cc the maintainers (doing that for you):
./scripts/get_maintainer.pl-fnet/colo-compare.c
Zhang Chen <[email protected]> (supporter:COLO Proxy) Li Zhijian <[email protected]> (supporter:COLO Proxy) Jason Wang <[email protected]> (maintainer:Network device ba...) [email protected] (open list:All patches CC here)Quoted 7 lines · Fan Yang
'
colo_mark_tcp_pkt' should return 'true' when packets are the same, and 'false' otherwise. However, it returns 'true' when 'colo_compare_packet_payload' returns non-zero while 'colo_compare_packet_payload' is just a 'memcmp'. The result is that COLO-compare reports inconsistent TCP packets when they are actually the same.
Quoted 2 lines
Fixes f449c9e549cReviewed-by Philippe Mathieu-Daudé <[email protected]>
Applied.
Thanks
Quoted 38 lines
Quoted 38 lines
Signed-off-by Fan Yang <[email protected]>--- net/colo-compare.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)net/colo-compare.c +3
-3@@ -319,7 +319,7 @@ static bool colo_mark_tcp_pkt(Packet *ppkt, Packet *spkt, *mark =0 ;if (ppkt->tcp_seq == spkt->tcp_seq && ppkt->seq_end == spkt->seq_end) { -if (colo_compare_packet_payload (ppkt, spkt, +if (!colo_compare_packet_payload (ppkt, spkt, ppkt->header_size, spkt->header_size, ppkt->payload_size)) { *mark =COLO_COMPARE_FREE_SECONDARY |COLO_COMPARE_FREE_PRIMARY ;@@ -329,7 +329,7 @@ static bool colo_mark_tcp_pkt(Packet *ppkt, Packet *spkt,/* one part of secondary packet payload still need to be compared */ if (!after (ppkt->seq_end, spkt->seq_end)) { -if (colo_compare_packet_payload (ppkt, spkt, +if (!colo_compare_packet_payload (ppkt, spkt, ppkt->header_size + ppkt->offset, spkt->header_size + spkt->offset, ppkt->payload_size - ppkt->offset)) {@@ -348,7 +348,7 @@ static bool colo_mark_tcp_pkt(Packet *ppkt, Packet *spkt,/* primary packet is longer than secondary packet, compare * the same part and mark the primary packet offset */ -if (colo_compare_packet_payload (ppkt, spkt, +if (!colo_compare_packet_payload (ppkt, spkt, ppkt->header_size + ppkt->offset, spkt->header_size + spkt->offset, spkt->payload_size - spkt->offset)) {
OK, thank you all :)
Quoted 66 lines · Jason Wang
Quoted 18 lines · Philippe Mathieu-Daudé
Hi Fan,
you forgot to Cc the maintainers (doing that for you):
./scripts/get_maintainer.pl-fnet/colo-compare.c
Zhang Chen <[email protected]> (supporter:COLO Proxy) Li Zhijian <[email protected]> (supporter:COLO Proxy) Jason Wang <[email protected]> (maintainer:Network device ba...) [email protected] (open list:All patches CC here)Quoted 7 lines · Fan Yang
'
colo_mark_tcp_pkt' should return 'true' when packets are the same, and 'false' otherwise. However, it returns 'true' when 'colo_compare_packet_payload' returns non-zero while 'colo_compare_packet_payload' is just a 'memcmp'. The result is that COLO-compare reports inconsistent TCP packets when they are actually the same.Quoted 2 lines
Fixes f449c9e549cReviewed-by Philippe Mathieu-Daudé <[email protected]>Applied.
Thanks
Quoted 38 lines
Quoted 38 lines
Signed-off-by Fan Yang <[email protected]>--- net/colo-compare.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)net/colo-compare.c +3
-3@@ -319,7 +319,7 @@ static bool colo_mark_tcp_pkt(Packet *ppkt, Packet *spkt, *mark =0 ;if (ppkt->tcp_seq == spkt->tcp_seq && ppkt->seq_end == spkt->seq_end) { -if (colo_compare_packet_payload (ppkt, spkt, +if (!colo_compare_packet_payload (ppkt, spkt, ppkt->header_size, spkt->header_size, ppkt->payload_size)) { *mark =COLO_COMPARE_FREE_SECONDARY |COLO_COMPARE_FREE_PRIMARY ;@@ -329,7 +329,7 @@ static bool colo_mark_tcp_pkt(Packet *ppkt, Packet *spkt,/* one part of secondary packet payload still need to be compared */ if (!after (ppkt->seq_end, spkt->seq_end)) { -if (colo_compare_packet_payload (ppkt, spkt, +if (!colo_compare_packet_payload (ppkt, spkt, ppkt->header_size + ppkt->offset, spkt->header_size + spkt->offset, ppkt->payload_size - ppkt->offset)) {@@ -348,7 +348,7 @@ static bool colo_mark_tcp_pkt(Packet *ppkt, Packet *spkt,/* primary packet is longer than secondary packet, compare * the same part and mark the primary packet offset */ -if (colo_compare_packet_payload (ppkt, spkt, +if (!colo_compare_packet_payload (ppkt, spkt, ppkt->header_size + ppkt->offset, spkt->header_size + spkt->offset, spkt->payload_size - spkt->offset)) {