From nobody Sun May 19 00:47:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674471898; cv=none; d=zohomail.com; s=zohoarc; b=mEhdvF+ZsYrs7YLhmUzrvy49ale6CGTnhvrzif0wjgY515UvOuY3JFxFucSsC3K30wxt7onUnfoKW0H/Fqo329TXPjsZLJxG6mMpDTALHdZkhzX73IaSawR7xGjrz6c4aJUJB7eeIXpCE7oW8flOyK0bCLpjb06zQUh+lFiFfwg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674471898; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=x7R1QYLogSwGJLoM3Ca8mDZ0QFOmSUjHV8HxGtbc5x4=; b=UHU2M91zdfRhRJWzXKz9Q956uhwSZDrvXTmcncdwyEbHjcN7gO4Tm1aasYj3sU2tAyFNoSin2S+hyP9/IiOSrVXUXmWxjPD4ROjwC8HIm2hAHA4Up+ftVd1lFKxBjfmZY4lz2zi9r1iv0f12wI2osDah4nrctgoCuU0Jt9BgWtY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1674471897880482.7012211615772; Mon, 23 Jan 2023 03:04:57 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-470-pBV66EhPM0CZmzkcoKwFJw-1; Mon, 23 Jan 2023 06:04:47 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BD120802DD4; Mon, 23 Jan 2023 11:03:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A46692027008; Mon, 23 Jan 2023 11:03:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AB4721946A76; Mon, 23 Jan 2023 11:03:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CC971194658D for ; Mon, 23 Jan 2023 11:03:45 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 6135C492C3F; Mon, 23 Jan 2023 11:03:45 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 083E4492C1B for ; Mon, 23 Jan 2023 11:03:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674471896; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=x7R1QYLogSwGJLoM3Ca8mDZ0QFOmSUjHV8HxGtbc5x4=; b=a72VyjfDWh+rJzLeS6B81ratNxDMdJ7un+Nhlx1xEs4iPmZLH580K/3k6rPKymaK9DpToJ nKmgYodn4j3EC6ItJAbpUV68runUwlDZDVOn+rGiRqz2F2Zy28TMOlN+PMmnhlWF7wj/j2 IJZvi2w/GHFmp03FKrICuESPfsCxuuw= X-MC-Unique: pBV66EhPM0CZmzkcoKwFJw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/2] virnetdevtap: Clarify virNetDevTapCreate() behavior wrt VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING Date: Mon, 23 Jan 2023 12:03:42 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674471899766100001 Content-Type: text/plain; charset="utf-8"; x-default="true" The VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING flag is documented as: /* The device is allowed to exist before creation */ VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING =3D 1 << 4, and yet, the documentation to virNetDevTapCreate() documents its behavior when the flag is passed as: * VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING * - The device creation fails if @ifname already exists Fortunately, the function is implemented so that it follows the expected behavior (i.e. the former flag documentation). Fix the function documentation then. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/util/virnetdevtap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c index a4ead0ae93..2101d7847c 100644 --- a/src/util/virnetdevtap.c +++ b/src/util/virnetdevtap.c @@ -156,7 +156,7 @@ virNetDevTapGetRealDeviceName(char *ifname G_GNUC_UNUSE= D) * VIR_NETDEV_TAP_CREATE_PERSIST * - The device will persist after the file descriptor is closed * VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING - * - The device creation fails if @ifname already exists + * - The device creation does not fail if @ifname already exists * * Creates a tap interface. The caller must use virNetDevTapDelete to * remove a persistent TAP device when it is no longer needed. In case --=20 2.39.1 From nobody Sun May 19 00:47:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674471903; cv=none; d=zohomail.com; s=zohoarc; b=eKt1VVx0Te6NWeDxKdwtrjDb/qcanZZ5dFqUsRnq85zDZ9V3Y9MSgJmNBCD5aIMoH/T3Ml/usONH8Jl+qP10Xh2uv2RrDM+aHQezUbpWR7mjGktm27DjLyqv5gvPXR0LBrO0V51JX379cYaVf5ziE4C8nVj0pUlvAgI984k8wGk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674471903; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ik4AjQ7+Ja8pUdV01pbTQRmHK3Ur8QTBywal3Lz2fWM=; b=L132JaQLEQpnUhAND6V777jvFZXb3u2VJFCgKQAKb+63WJTOoBEnMdqNa+yn9QB8jV6lyRjkGK8wpcJ+LhqihVzelghI3cMaorgUpkUXz/4ZAr+R0AoQlpfHN56bajJ2APV6PWlERVV2xdlzaO4znwVDJQMtu4zzTZHbRF6E0Sk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1674471903387112.01014136196716; Mon, 23 Jan 2023 03:05:03 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-477-XnmBwlRoP6CcdftbITgpXA-1; Mon, 23 Jan 2023 06:03:56 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 88C3B8030D3; Mon, 23 Jan 2023 11:03:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7219B40C2005; Mon, 23 Jan 2023 11:03:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 735AD19465B5; Mon, 23 Jan 2023 11:03:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CC79E194658C for ; Mon, 23 Jan 2023 11:03:46 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id F146E492B00; Mon, 23 Jan 2023 11:03:45 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98536492C1B for ; Mon, 23 Jan 2023 11:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674471902; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Ik4AjQ7+Ja8pUdV01pbTQRmHK3Ur8QTBywal3Lz2fWM=; b=GcJXNsbbWWAwXoLHvkD5YKbOVAxJ7kjCRWo45M1/sr1W9jx9dmVn4QLS5gP2tc0dCI/ZGk ld95i7fTvOPKspWP5fDzydRoKl7dgWYqLyHaVX3cqRSnkodd4kli5Xy/RihK4zjc55D1ez yDCozo1RoEYpkXG16YMY5W9xkfNiO+E= X-MC-Unique: XnmBwlRoP6CcdftbITgpXA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/2] qemu_interface: Fix managed='no' case when creating an ethernet interface Date: Mon, 23 Jan 2023 12:03:43 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674471903825100001 Content-Type: text/plain; charset="utf-8"; x-default="true" In a recent commit of v9.0.0-rc1~192 I've tried to forbid case where a TAP device already exists, but at the same time it's managed by Libvirt ( ). NB, if @managed attribute is missing then it's assumed to be managed by Libvirt. Anyway, I've mistakenly put setting of VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING flag into managed=3D'yes' branch instead of managed=3D'no' branch in qemuInterfaceEthernetConnect(). Move the setting of the flag into the correct branch. Fixes: a2ae3d299cf9c5ada8aa42ec4271748eb479dc27 Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/qemu/qemu_interface.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c index b6895cedde..ed2c209167 100644 --- a/src/qemu/qemu_interface.c +++ b/src/qemu/qemu_interface.c @@ -443,6 +443,9 @@ qemuInterfaceEthernetConnect(virDomainDef *def, _("target managed=3D'no' but specified dev does= n't exist")); goto cleanup; } + + tap_create_flags |=3D VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING; + if (virNetDevMacVLanIsMacvtap(net->ifname)) { auditdev =3D net->ifname; if (virNetDevMacVLanTapOpen(net->ifname, tapfd, tapfdSize) < 0) @@ -461,8 +464,6 @@ qemuInterfaceEthernetConnect(virDomainDef *def, if (!net->ifname) template_ifname =3D true; =20 - tap_create_flags |=3D VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING; - if (virNetDevTapCreate(&net->ifname, tunpath, tapfd, tapfdSize, tap_create_flags) < 0) { goto cleanup; --=20 2.39.1