On Tue, Nov 14, 2017 at 6:57 PM, Ed Swierk <eswi...@skyportsystems.com> wrote: > diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c > index 20b2549..dc95f12 100644 > --- a/hw/net/net_tx_pkt.c > +++ b/hw/net/net_tx_pkt.c > @@ -126,12 +126,12 @@ void net_tx_pkt_update_ip_checksums(struct NetTxPkt > *pkt) > > /* Calculate IP pseudo header checksum */ > cntr = eth_calc_ip4_pseudo_hdr_csum(ip_hdr, pkt->payload_len, &cso); > - csum = cpu_to_be16(~net_checksum_finish(cntr)); > + csum = cpu_to_be16(~net_checksum_finish_hdr(cntr)); > } else if (gso_type == VIRTIO_NET_HDR_GSO_TCPV6) { > /* Calculate IP pseudo header checksum */ > cntr = eth_calc_ip6_pseudo_hdr_csum(ip_hdr, pkt->payload_len, > IP_PROTO_TCP, &cso); > - csum = cpu_to_be16(~net_checksum_finish(cntr)); > + csum = cpu_to_be16(~net_checksum_finish_hdr(cntr)); > } else { > return; > }
Actually this change looks wrong. The checksum here is just the partial sum of the IP pseudo-header fields, to be incorporated into the actual UDP or TCP checksum (including the packet payload) at some later stage. The partial sum should never be zero (if net_rx_pkt_fix_l4_csum() is to be believed), but changing 0x0000 to 0xFFFF and then storing the complement ensures just that. Unless someone with more of a clue says otherwise, I'll drop this change in v3. --Ed