[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 01/18] net/filter-rewriter.c: Fix rewirter checksum b
From: |
Jason Wang |
Subject: |
[Qemu-devel] [PULL 01/18] net/filter-rewriter.c: Fix rewirter checksum bug when use virtio-net |
Date: |
Fri, 8 Sep 2017 10:05:07 +0800 |
From: Zhang Chen <address@hidden>
Because vnet_hdr have a offset to net packet, we must add it when use
virtio-net.
Signed-off-by: Zhang Chen <address@hidden>
Signed-off-by: Jason Wang <address@hidden>
---
net/filter-rewriter.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c
index 9812009..2be388f 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);
}
}
--
2.7.4
- [Qemu-devel] [PULL 00/18] Net patches, Jason Wang, 2017/09/07
- [Qemu-devel] [PULL 01/18] net/filter-rewriter.c: Fix rewirter checksum bug when use virtio-net,
Jason Wang <=
- [Qemu-devel] [PULL 02/18] net/rocker: Remove the dead error handling, Jason Wang, 2017/09/07
- [Qemu-devel] [PULL 03/18] net/rocker: Plug memory leak in pci_rocker_init(), Jason Wang, 2017/09/07
- [Qemu-devel] [PULL 04/18] net/rocker: Convert to realize(), Jason Wang, 2017/09/07
- [Qemu-devel] [PULL 05/18] net/rocker: Fix the unusual macro name, Jason Wang, 2017/09/07
- [Qemu-devel] [PULL 06/18] net: rtl8139: do not use old_mmio accesses, Jason Wang, 2017/09/07
- [Qemu-devel] [PULL 07/18] MAINTAINERS: Update mail address for COLO Proxy, Jason Wang, 2017/09/07
- [Qemu-devel] [PULL 08/18] net/socket: Don't treat odd socket type as SOCK_STREAM, Jason Wang, 2017/09/07
- [Qemu-devel] [PULL 09/18] net/socket: Convert several helper functions to Error, Jason Wang, 2017/09/07
- [Qemu-devel] [PULL 10/18] net/net: Convert parse_host_port() to Error, Jason Wang, 2017/09/07
- [Qemu-devel] [PULL 12/18] e1000: Rename the SEC symbol to SEQEC, Jason Wang, 2017/09/07