Oops, I meant to cc Bin on this series as it's the result of
a previous thread on the topic, but forgot...
https://lore.kernel.org/qemu-devel/CAFEAcA_UhmCxJc16CHE=4ZR1+PA0=4-29=fee+d+iumhltz...@mail.gmail.com/

-- PMM

On Tue, 27 Oct 2026 at 17:46, Peter Maydell <[email protected]> wrote:
>
> The net core code design is that by default packets are padded out to
> the ethernet frame minimum before being handed to a network device
> model, unless that device explicitly opted in by setting do_not_pad.
> This avoids a whole class of bugs where network device receive code
> has to be very careful about handling short packets.
>
> However, at the moment we do this check manually in the network
> backend code before it calls qemu_send_packet() or
> qemu_send_packet_async(), and we forgot to do it in all backends.  So
> you get the padding for the slirp, tap and vmnet backends, but not
> for the "minor" backends like 'passt', 'socket' and 'dgram', or if
> you configure two network devices connected by an emulated hub.
>
> This series fixes this by moving the padding code to
> qemu_send_packet()/qemu_sendv_packet(), so that it always happens
> regardless of the backend.
>
> The main bug this is fixing is
> https://gitlab.com/qemu-project/qemu/-/work_items/2362
> but it's been re-reported multiple times for various combinations
> of network devices and backends.
>
> The whole series is cc stable because without the padding you can
> provoke various bugs in different network device models.
>
> thanks
> -- PMM
>
> Peter Maydell (4):
>   tests/qtest: Make netfilter tests accept padded ethernet packets
>   net: Set do_not_pad for net backends
>   net: Pad short packets in qemu_send_packet and qemu_sendv_packet
>   net: Remove padding code from net backends
>
>  include/net/eth.h                    | 22 +++++++++++++++++++
>  include/net/net.h                    |  3 ++-
>  net/eth.c                            | 18 ++++++++++++++++
>  net/net.c                            | 32 ++++++++++++++++++++++++----
>  net/slirp.c                          |  9 --------
>  net/tap-win32.c                      | 15 ++-----------
>  net/tap.c                            | 11 +---------
>  tests/qtest/test-filter-buffer.c     |  4 +++-
>  tests/qtest/test-filter-mirror.c     |  4 +++-
>  tests/qtest/test-filter-redirector.c |  4 +++-
>  net/vmnet-common.m                   | 11 ----------
>  11 files changed, 82 insertions(+), 51 deletions(-)

Reply via email to