aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang Chen <zhangchen.fnst@cn.fujitsu.com>2017-07-04 14:53:54 +0800
committerJason Wang <jasowang@redhat.com>2017-07-17 20:13:52 +0800
commitd63b366a26b46bd8109a64bf4a2ecc5e16242a8b (patch)
tree8ccd32040044194919ed9a95b8612b636bfef3fa
parent5cc444d367078e3582b8e7e0136c53d3632c544b (diff)
net/colo-compare.c: Add vnet packet's tcp/udp/icmp compare
COLO-Proxy just focus on packet payload, so we skip vnet header. Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
-rw-r--r--net/colo-compare.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/colo-compare.c b/net/colo-compare.c
index 95911a260f..ca67c68615 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -201,8 +201,11 @@ static int colo_packet_compare_common(Packet *ppkt, Packet *spkt, int offset)
sec_ip_src, sec_ip_dst);
}
+ offset = ppkt->vnet_hdr_len + offset;
+
if (ppkt->size == spkt->size) {
- return memcmp(ppkt->data + offset, spkt->data + offset,
+ return memcmp(ppkt->data + offset,
+ spkt->data + offset,
spkt->size - offset);
} else {
trace_colo_compare_main("Net packet size are not the same");
@@ -261,8 +264,9 @@ static int colo_packet_compare_tcp(Packet *spkt, Packet *ppkt)
*/
if (ptcp->th_off > 5) {
ptrdiff_t tcp_offset;
+
tcp_offset = ppkt->transport_header - (uint8_t *)ppkt->data
- + (ptcp->th_off * 4);
+ + (ptcp->th_off * 4) - ppkt->vnet_hdr_len;
res = colo_packet_compare_common(ppkt, spkt, tcp_offset);
} else if (ptcp->th_sum == stcp->th_sum) {
res = colo_packet_compare_common(ppkt, spkt, ETH_HLEN);