qemu/hw/net
Alexey Dobriyan 2c3e4e2de6 virtio-net: drop too short packets early
Reproducer from https://gitlab.com/qemu-project/qemu/-/issues/1451
creates small packet (1 segment, len = 10 == n->guest_hdr_len),
then destroys queue.

"if (n->host_hdr_len != n->guest_hdr_len)" is triggered, if body creates
zero length/zero segment packet as there is nothing after guest header.

qemu_sendv_packet_async() tries to send it.

slirp discards it because it is smaller than Ethernet header,
but returns 0 because tx hooks are supposed to return total length of data.

0 is propagated upwards and is interpreted as "packet has been sent"
which is terrible because queue is being destroyed, nobody is waiting for TX
to complete and assert it triggered.

Fix is discard such empty packets instead of sending them.

Length 1 packets will go via different codepath:

	virtqueue_push(q->tx_vq, elem, 0);
	virtio_notify(vdev, q->tx_vq);
	g_free(elem);

and aren't problematic.

Signed-off-by: Alexey Dobriyan <adobriyan@yandex-team.ru>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2024-06-04 15:14:26 +08:00
..
can
fsl_etsec
rocker
allwinner_emac.c
allwinner-sun8i-emac.c
cadence_gem.c
dp8393x.c
e1000_common.h
e1000_regs.h
e1000.c
e1000e_core.c
e1000e_core.h
e1000e.c tap: Remove qemu_using_vnet_hdr() 2024-06-04 15:14:25 +08:00
e1000x_common.c
e1000x_common.h
e1000x_regs.h
eepro100.c
etraxfs_eth.c
ftgmac100.c
i82596.c
i82596.h
igb_common.h
igb_core.c
igb_core.h
igb_regs.h
igb.c tap: Remove qemu_using_vnet_hdr() 2024-06-04 15:14:25 +08:00
igbvf.c
imx_fec.c
Kconfig
lan9118.c
lance.c
lasi_i82596.c
mcf_fec.c
meson.build
mipsnet.c
msf2-emac.c
mv88w8618_eth.c
ne2000-isa.c
ne2000-pci.c
ne2000.c
ne2000.h
net_rx_pkt.c
net_rx_pkt.h
net_tx_pkt.c tap: Remove qemu_using_vnet_hdr() 2024-06-04 15:14:25 +08:00
net_tx_pkt.h
npcm7xx_emc.c
npcm_gmac.c
opencores_eth.c
pcnet-pci.c
pcnet.c
pcnet.h
rtl8139.c
smc91c111.c
spapr_llan.c
stellaris_enet.c
sungem.c
sunhme.c
trace-events
trace.h
tulip.c
tulip.h
vhost_net-stub.c
vhost_net.c
virtio-net.c virtio-net: drop too short packets early 2024-06-04 15:14:26 +08:00
vmware_utils.h
vmxnet3_defs.h
vmxnet3.c tap: Remove qemu_using_vnet_hdr() 2024-06-04 15:14:25 +08:00
vmxnet3.h
vmxnet_debug.h
xen_nic.c
xgmac.c
xilinx_axienet.c
xilinx_ethlite.c