diff options
author | Akihiko Odaki <akihiko.odaki@daynix.com> | 2024-04-28 16:00:46 +0900 |
---|---|---|
committer | Jason Wang <jasowang@redhat.com> | 2024-06-04 15:14:26 +0800 |
commit | a67753710d5fe6c0eef95229ff5fd9cafb78d862 (patch) | |
tree | 16a8b5f3a2b83f7f74ac89698ae8a2b03f2cb380 /net/net.c | |
parent | 4b52d63249a508dd927222ffac1a868d38681fc5 (diff) |
net: Move virtio-net header length assertion
The virtio-net header length assertion should happen for any clients.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'net/net.c')
-rw-r--r-- | net/net.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -56,6 +56,7 @@ #include "net/filter.h" #include "qapi/string-output-visitor.h" #include "qapi/qobject-input-visitor.h" +#include "standard-headers/linux/virtio_net.h" /* Net bridge is currently not supported for W32. */ #if !defined(_WIN32) @@ -550,6 +551,10 @@ void qemu_set_vnet_hdr_len(NetClientState *nc, int len) return; } + assert(len == sizeof(struct virtio_net_hdr_mrg_rxbuf) || + len == sizeof(struct virtio_net_hdr) || + len == sizeof(struct virtio_net_hdr_v1_hash)); + nc->vnet_hdr_len = len; nc->info->set_vnet_hdr_len(nc, len); } |