COLO-Proxy just focus on packet payload, So we skip vnet header.
Signed-off-by: Zhang Chen <[email protected]>
---
net/colo-compare.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/colo-compare.c b/net/colo-compare.c
index b3e933c..1941ad9 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -187,6 +187,8 @@ static int packet_enqueue(CompareState *s, int mode)
*/
static int colo_packet_compare_common(Packet *ppkt, Packet *spkt, int offset)
{
+ int offset_all;
+
if (trace_event_get_state(TRACE_COLO_COMPARE_MISCOMPARE)) {
char pri_ip_src[20], pri_ip_dst[20], sec_ip_src[20], sec_ip_dst[20];
@@ -200,9 +202,12 @@ static int colo_packet_compare_common(Packet *ppkt, Packet
*spkt, int offset)
sec_ip_src, sec_ip_dst);
}
+ offset_all = ppkt->vnet_hdr_len + offset;
+
if (ppkt->size == spkt->size) {
- return memcmp(ppkt->data + offset, spkt->data + offset,
- spkt->size - offset);
+ return memcmp(ppkt->data + offset_all,
+ spkt->data + offset_all,
+ spkt->size - offset_all);
} else {
trace_colo_compare_main("Net packet size are not the same");
return -1;
--
2.7.4