aboutgitcodebugslistschat
path: root/test/tcp
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2026-05-13 13:52:18 +0200
committerStefano Brivio <sbrivio@redhat.com>2026-05-20 01:21:55 +0200
commitdb798fc60f4c5869cb53168354e068fb4dabd91a (patch)
tree1d275d4ba0d26de0bb58b6d0dcf676260e63efb8 /test/tcp
parentde6387aa0bed9e01c99e58a0f3e01f617bc7fe33 (diff)
downloadpasst-db798fc60f4c5869cb53168354e068fb4dabd91a.tar
passt-db798fc60f4c5869cb53168354e068fb4dabd91a.tar.gz
passt-db798fc60f4c5869cb53168354e068fb4dabd91a.tar.bz2
passt-db798fc60f4c5869cb53168354e068fb4dabd91a.tar.lz
passt-db798fc60f4c5869cb53168354e068fb4dabd91a.tar.xz
passt-db798fc60f4c5869cb53168354e068fb4dabd91a.tar.zst
passt-db798fc60f4c5869cb53168354e068fb4dabd91a.zip
vhost-user: Centralise Ethernet frame padding in vu_collect() and vu_pad()
The previous per-protocol padding done by vu_pad() in tcp_vu.c and udp_vu.c was only correct for single-buffer frames: it assumed the padding area always fell within the first iov, writing past its end with a plain memset(). It also required each caller to compute MAX(..., ETH_ZLEN + VNET_HLEN) for vu_collect() and to call vu_pad() at the right point, duplicating the minimum-size logic across protocols. Move the Ethernet minimum size enforcement into vu_collect() itself, so that enough buffer space is always reserved for padding regardless of the requested frame size. Rewrite vu_pad() to take a full iovec array and use iov_memset(), making it safe for multi-buffer (mergeable rx buffer) frames. In tcp_vu_sock_recv(), replace iov_truncate() with iov_skip_bytes(): now that all consumers receive explicit data lengths, truncating the iovecs is no longer needed. In tcp_vu_data_from_sock(), cap each frame's data length against the remaining bytes actually received from the socket, so that the last partial frame gets correct headers and sequence number advancement. Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Jon Maloy <jmaloy@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test/tcp')
0 files changed, 0 insertions, 0 deletions