From nobody Mon Feb 2 07:29:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1768498701; cv=none; d=zohomail.com; s=zohoarc; b=gwVG+bMGliCin/gSKYnEPNxrOUyDU3aNG9e+VwLSckQzxEXpvkSX8B79RBCUwNFGobfMj0+R6OxtfB87WSHoALsZiZb90vAly4K+jBvVkNLtz17ZFSMUEYiP1hmA/luNCsRdH6xMuHLTrcdcDoh3pBex5EBFuchgMLkeZ4Uh1bk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768498701; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=Ycvmcw08Tu/576G7dqmon8+xrCk6BW51dJ81GNazLGw=; b=VHNjtn+KB690pUcQoE+kkDVEO7/9cynlv6WoiiJk2KEpN/BJxl+B3DHGY5EcAO5g8f80wmSn2rGnxc/RjpoTaS3DjFIo5TgsgxP/oGXWxCl0QVrwKb/H4nXItvm0WHzHMoS2iwhyyPVm/0rIONW6SIC/XmYw3DE2cw4a7v+qxIU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1768498701059944.474428654671; Thu, 15 Jan 2026 09:38:21 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 27A864188D; Thu, 15 Jan 2026 12:38:20 -0500 (EST) Received: from [172.19.199.83] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 24E7541B8D; Thu, 15 Jan 2026 12:36:26 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 4AC7C41AA5; Thu, 15 Jan 2026 12:36:09 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 639FF41AA9 for ; Thu, 15 Jan 2026 12:36:07 -0500 (EST) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-580-tGxa4caKOVGUzF6DTP82hg-1; Thu, 15 Jan 2026 12:36:05 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BEE4C1956050 for ; Thu, 15 Jan 2026 17:36:04 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.64.106]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 661543001DBB for ; Thu, 15 Jan 2026 17:36:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1768498567; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ycvmcw08Tu/576G7dqmon8+xrCk6BW51dJ81GNazLGw=; b=BVpbEtIRioA3LLmwuXa9UURHMOwo+sm8EjKapDI0cHBmUM3lAZbi8UFE3UCZcUgQU4Drk7 An/x7xHduF9KNGl8ZpJLQ86oxNJTSYn59fpk8h4zD2yM9eeDLwloK/raFBrZ7RZ2P57zNt HoNQN6rNBg6KRFEI5WWUKYnSCG8l6hs= X-MC-Unique: tGxa4caKOVGUzF6DTP82hg-1 X-Mimecast-MFC-AGG-ID: tGxa4caKOVGUzF6DTP82hg_1768498564 To: devel@lists.libvirt.org Subject: [PATCH 3/4] conf: validate that specified interface type supports vlan tags Date: Thu, 15 Jan 2026 12:36:00 -0500 Message-ID: <20260115173601.514507-4-laine@redhat.com> In-Reply-To: <20260115173601.514507-1-laine@redhat.com> References: <20260115173601.514507-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: QssUryoXpUteOM02qTALvF0XUqev8ksYHFu68bcWZyI_1768498564 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: Y4KHUSLXKEDYVDWHXYM3KAIO4EXZHPZZ X-Message-ID-Hash: Y4KHUSLXKEDYVDWHXYM3KAIO4EXZHPZZ X-MailFrom: laine@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Laine Stump via Devel Reply-To: Laine Stump X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1768498703261158500 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Laine Stump Somehow this was never done in virDomainNetDefValidate() (which is run immediately post-parse) - it was only in virDomainActualNetDefValidate() (which isn't done until the interface is actually attached to the domain). While it is true that we *might* not know if vlan tagging is supported for the interface if the interface type =3D=3D 'network', we otherwise will always know right away, so we may as well check sooner than later. Signed-off-by: Laine Stump --- src/conf/domain_validate.c | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 7346a61731..4589965923 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -2377,6 +2377,47 @@ virDomainNetDefValidate(const virDomainNetDef *net) return -1; } =20 + if (net->vlan.nTags > 0) { + /* vlan configuration via libvirt is only supported for PCI + * Passthrough SR-IOV devices (hostdev or macvtap passthru + * mode) and openvswitch/linux host bridges. (Also allow it in + * the case where we don't yet know what the exact connection + * type will be, i.e. NET_TYPE_NETWORK). + */ + bool vlanAllowed =3D false; + + switch (net->type) { + case VIR_DOMAIN_NET_TYPE_HOSTDEV: + case VIR_DOMAIN_NET_TYPE_NETWORK: + case VIR_DOMAIN_NET_TYPE_BRIDGE: + vlanAllowed =3D true; + break; + case VIR_DOMAIN_NET_TYPE_DIRECT: + if (net->data.direct.mode =3D=3D VIR_NETDEV_MACVLAN_MODE_PASST= HRU) + vlanAllowed =3D true; + break; + case VIR_DOMAIN_NET_TYPE_ETHERNET: + case VIR_DOMAIN_NET_TYPE_USER: + case VIR_DOMAIN_NET_TYPE_VHOSTUSER: + case VIR_DOMAIN_NET_TYPE_SERVER: + case VIR_DOMAIN_NET_TYPE_CLIENT: + case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_INTERNAL: + case VIR_DOMAIN_NET_TYPE_UDP: + case VIR_DOMAIN_NET_TYPE_VDPA: + case VIR_DOMAIN_NET_TYPE_NULL: + case VIR_DOMAIN_NET_TYPE_VDS: + case VIR_DOMAIN_NET_TYPE_LAST: + break; + } + if (!vlanAllowed) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("interface %1$s - vlan tag not supported for = this connection type"), + macstr); + return -1; + } + } + return 0; } =20 --=20 2.52.0