aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorZhang Chen <zhangchen.fnst@cn.fujitsu.com>2017-07-28 18:03:10 +0800
committerJason Wang <jasowang@redhat.com>2017-09-08 08:17:35 +0800
commit6ce310b5356abb7edc3aa8b8b097d0b8cc76f83f (patch)
tree657bc1f187698dc375c2e1a669ed956f23d21de8 /net
parentcda4a338c4243fa3bff4498b935340ac7121cc76 (diff)
net/filter-rewriter.c: Fix rewirter checksum bug when use virtio-net
Because vnet_hdr have a offset to net packet, we must add it when use virtio-net. Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'net')
-rw-r--r--net/filter-rewriter.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c
index 98120095de..2be388f539 100644
--- a/net/filter-rewriter.c
+++ b/net/filter-rewriter.c
@@ -99,7 +99,8 @@ static int handle_primary_tcp_pkt(NetFilterState *nf,
/* handle packets to the secondary from the primary */
tcp_pkt->th_ack = htonl(ntohl(tcp_pkt->th_ack) + conn->offset);
- net_checksum_calculate((uint8_t *)pkt->data, pkt->size);
+ net_checksum_calculate((uint8_t *)pkt->data + pkt->vnet_hdr_len,
+ pkt->size - pkt->vnet_hdr_len);
}
}
@@ -138,7 +139,8 @@ static int handle_secondary_tcp_pkt(NetFilterState *nf,
/* handle packets to the primary from the secondary*/
tcp_pkt->th_seq = htonl(ntohl(tcp_pkt->th_seq) - conn->offset);
- net_checksum_calculate((uint8_t *)pkt->data, pkt->size);
+ net_checksum_calculate((uint8_t *)pkt->data + pkt->vnet_hdr_len,
+ pkt->size - pkt->vnet_hdr_len);
}
}