tap: Shrink zeroed virtio-net header
authorAkihiko Odaki <akihiko.odaki@daynix.com>
Sun, 28 Apr 2024 07:00:49 +0000 (16:00 +0900)
committerJason Wang <jasowang@redhat.com>
Tue, 4 Jun 2024 07:14:26 +0000 (15:14 +0800)
tap prepends a zeroed virtio-net header when writing a packet to a
tap with virtio-net header enabled but not in use. This only happens
when s->host_vnet_hdr_len == sizeof(struct virtio_net_hdr).

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
net/tap.c

index 9825518ff1f3a39d9838bd6c893b46c3cdf77621..51f7aec39d9e1e9ec3320d5c6bcb5a9b69036992 100644 (file)
--- a/net/tap.c
+++ b/net/tap.c
@@ -119,7 +119,7 @@ static ssize_t tap_receive_iov(NetClientState *nc, const struct iovec *iov,
     TAPState *s = DO_UPCAST(TAPState, nc, nc);
     const struct iovec *iovp = iov;
     g_autofree struct iovec *iov_copy = NULL;
-    struct virtio_net_hdr_mrg_rxbuf hdr = { };
+    struct virtio_net_hdr hdr = { };
 
     if (s->host_vnet_hdr_len && !s->using_vnet_hdr) {
         iov_copy = g_new(struct iovec, iovcnt + 1);