Skip to content
Snippets Groups Projects
Commit 6ce310b5 authored by Zhang Chen's avatar Zhang Chen Committed by Jason Wang
Browse files

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: default avatarZhang Chen <zhangchen.fnst@cn.fujitsu.com>
Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
parent cda4a338
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment