From nobody Wed Feb 11 00:58:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1697515948; cv=none; d=zohomail.com; s=zohoarc; b=beQEpFbuK5hE7Q3ndSNjMTL59yg5udMfJocKv/GRMGucQg/gwrl4Cv5x8IdoMX0k4Uuh9ZghlMH5GQ6GgDFC4+7Lk3T9DDPY0Aq4hBX7MjEZ6/RueEe+LdM40QORoKODvyqgCpXRnucfEtG2fuj5fBXexIn/zoeyOBsm3Q7myhM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697515948; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:Message-Id:Reply-To:To; bh=4JchmClXziD2vBgzcNf/LgEpJ92hmMKWZAZONhdY+WI=; b=FSHBgHHPbdsUGKxYS9/AnNT6BHj7DUqPTjokhYDL/c5EVY4afAD4X0uxw/eG/b/Kt4xJZzdWhZWobziWWhI87q0nKQIptBWXeipVeyfmoN+B+e/8klMkJoMHMZw1m+jvotbKWng9/DYOcFZhSVfRBb/A/tHbCKPXYCCgxd0Pkc8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697515948299277.5621381058602; Mon, 16 Oct 2023 21:12:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsbOz-0007P9-7q; Tue, 17 Oct 2023 00:09:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qsbOw-0007ON-U8 for qemu-devel@nongnu.org; Tue, 17 Oct 2023 00:09:50 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsbOv-00047O-CG for qemu-devel@nongnu.org; Tue, 17 Oct 2023 00:09:50 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6bce254ba56so1690627b3a.1 for ; Mon, 16 Oct 2023 21:09:49 -0700 (PDT) Received: from localhost ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with UTF8SMTPSA id z21-20020aa79f95000000b0069323619f69sm358989pfr.143.2023.10.16.21.09.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 Oct 2023 21:09:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1697515788; x=1698120588; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4JchmClXziD2vBgzcNf/LgEpJ92hmMKWZAZONhdY+WI=; b=xyIQZ5yYaGAMI3zEcRhfDKgy0hDI4JGL2nlHhXONlZz1FgZm8p2fY2QlbHTuAGbNFe m77JHYenQz05/WfFHODzGiesIcxzF7IGwpqbpSR5Xuzv2WePwJ1qVkzlnilAXCpX0Nfo X4V9bfQPMRiOGaybMhC4Jt7vGLlTimhyoNTCl5LUCAJGxSmR3azVv5yFDyrHJB7Qs6p/ joWXCnh6aHcocbkWLQAnZvvrh6kB9GmNzcemwgmZMXq6SVzT78UNNsaBB+cavjbrftbx Dmdc1rgdgJPPHvCNZRzNEHGJS4JuS54jQJGZg1nwk1jZq/iNCR4Kv04G5iFBEctiMyRd oJQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697515788; x=1698120588; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4JchmClXziD2vBgzcNf/LgEpJ92hmMKWZAZONhdY+WI=; b=MQKZLSEMYx0prJzT9TvnlBge01AY40fjzYx3HQzURh7zvez5cuYkD+d3D0wexhbsUC vQgfdaLGuEo7/i7qc11oiby5UxFRGPyzLGjSrJIMrTbZqqPoQKI086ND8/9XXh8jSXCP Wu4xIPyuO1nhAewCsucEcEEXQnU3dq9qpXdBtdgJOGz9JxdGx0Jjll1b31RXjBPaCyT1 Nl8khPkedfYh30VxiNCzTDBac2j/fmFFTgYpXaZ4utOhHQMWkLvMfDQm8rZBu7KbOqTA JtxtneIUcvNsnHW1icXTo1kk7TtTXVb+m7O0XVF3VDJkZdxgj0gI8ps/LZmSmrgirFbT pUlA== X-Gm-Message-State: AOJu0YzMODUf5w7leG5B/wUfEXfPYKscgembQsR8LH4lzt7blbvmprMI ZA+VNh/D1n23OlzzfCHWHerHuRtycgKObdpc4Dtv6A== X-Google-Smtp-Source: AGHT+IHeTpq9y5rVjwxlIlPBFrBYFysVxfREOmw1JwYLXFPBV6og2lkwXPz55N0baWuBYWN2+A/Otw== X-Received: by 2002:a05:6a00:22c4:b0:6bb:b574:4f60 with SMTP id f4-20020a056a0022c400b006bbb5744f60mr1152777pfj.15.1697515787929; Mon, 16 Oct 2023 21:09:47 -0700 (PDT) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, Yuri Benditovich , Andrew Melnychenko , "Michael S . Tsirkin" , Jason Wang , Akihiko Odaki Subject: [PATCH v5 03/21] net: Move virtio-net header length assertion Date: Tue, 17 Oct 2023 13:09:09 +0900 Message-ID: <20231017040932.62997-4-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231017040932.62997-1-akihiko.odaki@daynix.com> References: <20231017040932.62997-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::429; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x429.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1697515949207100001 Content-Type: text/plain; charset="utf-8" The virtio-net header length assertion should happen for any clients. Signed-off-by: Akihiko Odaki --- net/net.c | 5 +++++ net/tap.c | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/net/net.c b/net/net.c index 1bb4f33a63..6d2fa8d40f 100644 --- a/net/net.c +++ b/net/net.c @@ -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" =20 /* Net bridge is currently not supported for W32. */ #if !defined(_WIN32) @@ -540,6 +541,10 @@ void qemu_set_vnet_hdr_len(NetClientState *nc, int len) return; } =20 + assert(len =3D=3D sizeof(struct virtio_net_hdr_mrg_rxbuf) || + len =3D=3D sizeof(struct virtio_net_hdr) || + len =3D=3D sizeof(struct virtio_net_hdr_v1_hash)); + nc->vnet_hdr_len =3D len; nc->info->set_vnet_hdr_len(nc, len); } diff --git a/net/tap.c b/net/tap.c index 4667933ffe..57389cacc3 100644 --- a/net/tap.c +++ b/net/tap.c @@ -263,9 +263,6 @@ static void tap_set_vnet_hdr_len(NetClientState *nc, in= t len) TAPState *s =3D DO_UPCAST(TAPState, nc, nc); =20 assert(nc->info->type =3D=3D NET_CLIENT_DRIVER_TAP); - assert(len =3D=3D sizeof(struct virtio_net_hdr_mrg_rxbuf) || - len =3D=3D sizeof(struct virtio_net_hdr) || - len =3D=3D sizeof(struct virtio_net_hdr_v1_hash)); =20 tap_fd_set_vnet_hdr_len(s->fd, len); s->host_vnet_hdr_len =3D len; --=20 2.42.0