diff options
| author | Laurent Vivier <lvivier@redhat.com> | 2026-04-16 18:21:39 +0200 |
|---|---|---|
| committer | Stefano Brivio <sbrivio@redhat.com> | 2026-05-26 18:24:31 +0200 |
| commit | 038c51e324695b65c154bc0eee30bd19a7423ad2 (patch) | |
| tree | c6e838da6cbcdb8e5c148d527766ed9e8838f33b /test | |
| parent | 196a9e555ef3507430948ee4cc46ad574d643965 (diff) | |
| download | passt-038c51e324695b65c154bc0eee30bd19a7423ad2.tar passt-038c51e324695b65c154bc0eee30bd19a7423ad2.tar.gz passt-038c51e324695b65c154bc0eee30bd19a7423ad2.tar.bz2 passt-038c51e324695b65c154bc0eee30bd19a7423ad2.tar.lz passt-038c51e324695b65c154bc0eee30bd19a7423ad2.tar.xz passt-038c51e324695b65c154bc0eee30bd19a7423ad2.tar.zst passt-038c51e324695b65c154bc0eee30bd19a7423ad2.zip | |
vhost_user: Offer VIRTIO_NET_F_GUEST_CSUM2026_05_26.038c51e
According to the virtio-net specification, when the VIRTIO_NET_F_GUEST_CSUM
is negotiated, the device can set VIRTIO_NET_HDR_F_DATA_VALID in the
virtio-net header to indicate that packet checksums have been validated,
allowing the guest to skip verification. Without this feature, the device
must provide fully checksummed packets.
The vhost-user TCP and UDP paths were unconditionally skipping checksum
computation, regardless of whether GUEST_CSUM was negotiated. This
went undetected with Linux guests because Linux's virtio-net driver
honours VIRTIO_NET_HDR_F_DATA_VALID regardless of whether
VIRTIO_NET_F_GUEST_CSUM was negotiated, marking such packets as
CHECKSUM_UNNECESSARY and skipping verification.
iPXE, however, does not negotiate GUEST_CSUM, ignores the DATA_VALID
flag entirely, and always verifies checksums. This caused TCP
connections to fail: the SYN-ACK had a zero TCP checksum, iPXE rejected
it, and the connection timed out in SYN_RCVD.
Adding --pcap happened to mask the bug, because the pcap code path
forces checksum computation to ensure correct captures.
Offer VIRTIO_NET_F_GUEST_CSUM in the device features, and only skip
checksum computation when the guest has actually negotiated it. When
GUEST_CSUM is not negotiated, always compute valid checksums as required
by the specification.
We keep setting VIRTIO_NET_HDR_F_DATA_VALID unconditionally in
VU_HEADER: when GUEST_CSUM is negotiated, the flag lets the guest skip
checksum verification; when it is not, the spec says the guest should
ignore the flags field, so setting it is harmless.
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
[sbrivio: Resolved conflicts, in particular with commit dec66c02b5e4
("udp: Pass iov_tail to udp_update_hdr4()/udp_update_hdr6()")]
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test')
0 files changed, 0 insertions, 0 deletions
