summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2026-07-31 10:36:18 +0100
committerMichael Tokarev <mjt@tls.msk.ru>2026-08-17 19:23:02 +0300
commit3c817cabbe558b03074a42f049b64d2c83b95a95 (patch)
treea7d0a2628d5ce2218818df5f7ac63ea4ecb3ad0a
parentec3fd5a927175a6b227fed835c91380f3d9dad44 (diff)
downloadqemu-3c817cabbe558b03074a42f049b64d2c83b95a95.tar.gz
qemu-3c817cabbe558b03074a42f049b64d2c83b95a95.zip
hw/net/rtl8139: Send whole of vlan-tagged packet when doing loopback
In rtl8139_transfer_frame(), if we are transmitting a frame over loopback then we do this by calling qemu_receive_packet(). If we have an iovec rather than a simple buffer (which happens only when we're sending a packet where we are inserting a vlan tag), we have to convert this into a simple buffer first using iov_to_buf(). However, when we do this we forget to also update the 'size' local variable to the size of the new simple buffer, so we will truncate the packet by 4 bytes (the size of the vlan tag). Correct the logic so we don't truncate vlan-tagged packets when sending them over loopback. Cc: qemu-stable@nongnu.org Reported-by: Bin Meng <bmeng.cn@gmail.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Bin Meng <bin.meng@processmission.com> Message-ID: <20260731093618.2961031-3-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> (cherry picked from commit f3a10c1c454789ad6bb0633118019f4c6544b4b3) Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r--hw/net/rtl8139.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
index e00201991a..4936dc0b82 100644
--- a/hw/net/rtl8139.c
+++ b/hw/net/rtl8139.c
@@ -1772,6 +1772,7 @@ static void rtl8139_transfer_frame(RTL8139State *s, uint8_t *buf, int size,
buf2 = g_malloc(buf2_size);
iov_to_buf(iov, 3, 0, buf2, buf2_size);
buf = buf2;
+ size = buf2_size;
}
DPRINTF("+++ transmit loopback mode\n");