From nobody Wed Nov 27 21:42:20 2024 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=1697378633; cv=none; d=zohomail.com; s=zohoarc; b=ZWboRBVtz+jT9Xjw0Sn6WovGueGQJ4PuYLmBxoYVvbz3NcAHShIoWMVf/71iO4xNeFHo4zJUVwnVb3sdcY3E/8v/FlhrSyyo95TpTbUDQ/vhl9WPa7t78zjESB3RfzXu5vX5lriDNeGxQ5EzM7G7SO2qqfiA5w9EwocvMtBlfHM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697378633; 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=hKAl37Bq/K8StRlcLTQcmUrwkkvwNqhH18udv1ZF6zlYf7/LhDRi1iCz1oJjIBXnXYc9fLQMVpce9hioaiwbfK472Pjq+peQCc8VfJzR1D6GH2Qsw0zL6H/ZSCkzdWBZHbf7a7wvhB/41wJKMjSCvNcq5Dx13oOD+VjejxmYZMA= 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 1697378633748493.68489071936483; Sun, 15 Oct 2023 07:03:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qs1iF-0001Km-U3; Sun, 15 Oct 2023 10:03:23 -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 1qs1iD-0001KA-Ov for qemu-devel@nongnu.org; Sun, 15 Oct 2023 10:03:21 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qs1i9-0007hv-29 for qemu-devel@nongnu.org; Sun, 15 Oct 2023 10:03:21 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1c9bca1d96cso23745835ad.3 for ; Sun, 15 Oct 2023 07:03:16 -0700 (PDT) Received: from localhost ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with UTF8SMTPSA id e1-20020a170902744100b001bbdd44bbb6sm6826542plt.136.2023.10.15.07.03.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 15 Oct 2023 07:03:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1697378596; x=1697983396; 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=tNwluDxHDgbmDaA1Hh4s0djDbGuJhpMfD66PiPE689gMUxLvwphNrF/+sfJdfszTMu XpqQ/rJ+ZomzuVK6GYXNQyZIWJQg1A9frU263+1nhzQVbwzGGeVR83KQayNLvnCBWYIt BA4zHQHn2mq1XJ8p9FKZVwYiKR3gG1YeaOCA4X8Ypwydd+cDzg84Cyk13NhOb0F5cKUr z4MqsZs4B35cbfbUf4bvgzNAkaes/fvtV9ObXWoCojwI4ZGZOT2QCeQ+u6F77c9ULq80 G/NQZqwP9Dkb88c9ZG81UNyEdZrldUnJQNWt09QDDYnqg9FBGgkVNBovV/SkH/2gdwU6 NmsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697378596; x=1697983396; 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=obCpuLmV4n95IlU6Uc/EXxiVHbsNWRyIkTxTgV48fUnkmDSx8nmjcT9J0xQ17VT1KA qrwrVbYrvMm+HYt79J3E8/OsVO7tmCYuWIxPXYns2PDtjfUIB1cmuo49UTJMthQEMCKJ tgMjVmzzWEN9WhYLSQe5rEN90Q2TMWScrrbFd8Iph1KtxyKfmfgD+f6BQCoAr6hPNWCD pFaLtS+QFBdbbQ0F+sm9vVsf1igj0Znsbjp/PIY22XJUfGWWgW0qvblcjlUhguQthVXL 4oRAo4F5N/PiSel41TGPKFxJJqXkaeKe/6tXJ5Gwza4h75B/4FmO154tVle/RsPAt304 QzlQ== X-Gm-Message-State: AOJu0YxKLLU1+BAWBEiN0fpJQKCGkJDWSejhM+EfV4bkuaH84hMv7Ja4 X/nxtKCEGALrU7Q/wTV86pAcs8XcnypACcWMXXeodw== X-Google-Smtp-Source: AGHT+IFEocnBjSgQ7Yfl2w84Cmlvym1cM0bu+t+keU9zsxwAXZ3gFNFaxceBZT0ATV6Z67V/PXHYJw== X-Received: by 2002:a17:903:120f:b0:1bb:994c:bc43 with SMTP id l15-20020a170903120f00b001bb994cbc43mr31358301plh.18.1697378595685; Sun, 15 Oct 2023 07:03:15 -0700 (PDT) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, Yuri Benditovich , Andrew Melnychenko , "Michael S . Tsirkin" , Jason Wang , Akihiko Odaki Subject: [PATCH v4 03/20] net: Move virtio-net header length assertion Date: Sun, 15 Oct 2023 23:02:35 +0900 Message-ID: <20231015140259.259434-4-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231015140259.259434-1-akihiko.odaki@daynix.com> References: <20231015140259.259434-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::635; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x635.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: 1697378635932100009 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