Skip to content

Commit 1e907a3

Browse files
Raphus-cucullatusjasowang
authored andcommitted
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. Fixes: f449c9e ("colo: compare the packet based on the tcp sequence number") Cc: [email protected] Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Fan Yang <[email protected]> Signed-off-by: Jason Wang <[email protected]>
1 parent 7788c3f commit 1e907a3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

net/colo-compare.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ static bool colo_mark_tcp_pkt(Packet *ppkt, Packet *spkt,
319319
*mark = 0;
320320

321321
if (ppkt->tcp_seq == spkt->tcp_seq && ppkt->seq_end == spkt->seq_end) {
322-
if (colo_compare_packet_payload(ppkt, spkt,
322+
if (!colo_compare_packet_payload(ppkt, spkt,
323323
ppkt->header_size, spkt->header_size,
324324
ppkt->payload_size)) {
325325
*mark = COLO_COMPARE_FREE_SECONDARY | COLO_COMPARE_FREE_PRIMARY;
@@ -329,7 +329,7 @@ static bool colo_mark_tcp_pkt(Packet *ppkt, Packet *spkt,
329329

330330
/* one part of secondary packet payload still need to be compared */
331331
if (!after(ppkt->seq_end, spkt->seq_end)) {
332-
if (colo_compare_packet_payload(ppkt, spkt,
332+
if (!colo_compare_packet_payload(ppkt, spkt,
333333
ppkt->header_size + ppkt->offset,
334334
spkt->header_size + spkt->offset,
335335
ppkt->payload_size - ppkt->offset)) {
@@ -348,7 +348,7 @@ static bool colo_mark_tcp_pkt(Packet *ppkt, Packet *spkt,
348348
/* primary packet is longer than secondary packet, compare
349349
* the same part and mark the primary packet offset
350350
*/
351-
if (colo_compare_packet_payload(ppkt, spkt,
351+
if (!colo_compare_packet_payload(ppkt, spkt,
352352
ppkt->header_size + ppkt->offset,
353353
spkt->header_size + spkt->offset,
354354
spkt->payload_size - spkt->offset)) {

0 commit comments

Comments
 (0)