From nobody Wed Jan 15 10:05:46 2025 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; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 172543922676438.08913416913015; Wed, 4 Sep 2024 01:40:26 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 9B5C714AE; Wed, 4 Sep 2024 04:40:25 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id A6D5114C2; Wed, 4 Sep 2024 04:39:54 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 545AF1126; Wed, 4 Sep 2024 04:39:51 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 8144E1126 for ; Wed, 4 Sep 2024 04:39:50 -0400 (EDT) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-341-0fdv5EnQMFmnGWGFy4bg6Q-1; Wed, 04 Sep 2024 04:39:49 -0400 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-42c827c4d3aso5392735e9.2 for ; Wed, 04 Sep 2024 01:39:48 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bbd46b60bsm126315085e9.1.2024.09.04.01.39.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 01:39:46 -0700 (PDT) Received: from wheatley.brq.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id E8D6B1FD3324 for ; Wed, 04 Sep 2024 10:39:45 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725439190; 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=7uULVEHEDGlCohYk65lfZwbmLOZgDtr3AxVpf6Xzoi4=; b=f/dSSs/WPgVvzlB1BUzUqz0j/Uq0oXJp0KL9vN5UTBs4ZdjDOkQSxYRGhhkjPiQpN162Hc Akg2sRkcszAxGdKOszzxniWN+T4yV0aBZOF4o+TaYcVVxvZ55nwkuiUfaGHWksjfvk0dv0 csVFXz0k7l18yAGhtWZ/wV5XVM/V8bo= X-MC-Unique: 0fdv5EnQMFmnGWGFy4bg6Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725439188; x=1726043988; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7uULVEHEDGlCohYk65lfZwbmLOZgDtr3AxVpf6Xzoi4=; b=X4MIPH4yiQrSueujE5qmD1wPX6MzUJYm2lYSfpsJDUI0Ctd84cCPH4BK5qEvD22sZW nr/1VdukgudiB8Cs5GAxiKAZBqSlsXS0EoQvlDKIHFaw2SkYlekmOHIhkF5TFd6BVxYp PRipD1vlk1ho2kwO6Te3DuC49LKBzFIuUr4IL/43co+7CH4wcpRB7+kGhQMuDwVpyxbT QkjLRAs4eeVWjKmH1UIn6Yb+748UrK8RwgRlDorEJ8HKGA6jkroZ8O8xX2EQ3mYw6CeB JgFHM0lsX2OWJ6NQP4J00DQf4qXD6LU9EjXJgCrpv5inB7RzRynQYJtmdV5ta51GvbPx wxbg== X-Gm-Message-State: AOJu0Yxe8xN/zDogat+oNSl43y2gtQ/+O+WnV8RXT4K/5vhqOVEBr4vu ejJh9CZ/XCaNLVfyR/2i90YIyquw7JGKor8rH/RKdvVhTvI74TrKf1yIlJIIQlKpazJ1hVcLUyf /dcjulj3D9581XoCDfgzZE2rT0asAAtjOuROaR/S/eT3PWTBhUYRTbXSRpUu4skXS7DottUt5Ir DXGCSGzp4zdKg8w5qgYoWy784LQlbldtMzA5/PIzo= X-Received: by 2002:a5d:550d:0:b0:374:c8cc:1bb1 with SMTP id ffacd0b85a97d-37770c70570mr1188830f8f.39.1725439187843; Wed, 04 Sep 2024 01:39:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE/hrniUb72Ed/WX9MW+mbbJz3UThMga3Fq5WBL6W3pULQoVu7EfrrtJaPCNkpZ3TORsmj7Aw== X-Received: by 2002:a5d:550d:0:b0:374:c8cc:1bb1 with SMTP id ffacd0b85a97d-37770c70570mr1188794f8f.39.1725439186924; Wed, 04 Sep 2024 01:39:46 -0700 (PDT) From: Martin Kletzander To: devel@lists.libvirt.org Subject: [PATCH 1/2] virnetdevtap: Do (not) use NULLSTR consistently Date: Wed, 4 Sep 2024 10:39:43 +0200 Message-ID: <5668c854d9e656aaaa78b6517d4ccaa75c80f142.1725439083.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: UH2RS3H3GA4XBY2BMX72C7T7XGRXB3OO X-Message-ID-Hash: UH2RS3H3GA4XBY2BMX72C7T7XGRXB3OO X-MailFrom: mkletzan@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1725439228916116600 Content-Type: text/plain; charset="utf-8"; x-default="true" The function generates *ifname from the get go and most functions do not wrap the string in a NULLSTR as it is not necessary. The few leftovers are outliers that are changed to fit the theme better. Signed-off-by: Martin Kletzander Reviewed-by: Michal Privoznik --- src/util/virnetdevtap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c index 9a4866a4e4df..55536b5f4be2 100644 --- a/src/util/virnetdevtap.c +++ b/src/util/virnetdevtap.c @@ -232,7 +232,7 @@ int virNetDevTapCreate(char **ifname, if (ioctl(fd, TUNSETIFF, &ifr) < 0) { virReportSystemError(errno, _("Unable to create tap device %1$s"), - NULLSTR(*ifname)); + *ifname); goto cleanup; } =20 @@ -247,7 +247,7 @@ int virNetDevTapCreate(char **ifname, ioctl(fd, TUNSETPERSIST, 1) < 0) { virReportSystemError(errno, _("Unable to set tap device %1$s to persi= stent"), - NULLSTR(*ifname)); + *ifname); goto cleanup; } tapfd[i] =3D fd; --=20 2.46.0 From nobody Wed Jan 15 10:05:46 2025 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; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1725439241960387.3350969319042; Wed, 4 Sep 2024 01:40:41 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id ECA4E1447; Wed, 4 Sep 2024 04:40:40 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 2C5B11540; Wed, 4 Sep 2024 04:39:56 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id AD03B1126; Wed, 4 Sep 2024 04:39:51 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 001CC1404 for ; Wed, 4 Sep 2024 04:39:50 -0400 (EDT) Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-114-DNZsgI1APgC7ZTzUoBqz9Q-1; Wed, 04 Sep 2024 04:39:49 -0400 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-42bbff6a0aeso42804995e9.3 for ; Wed, 04 Sep 2024 01:39:49 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bc00877c4sm150839115e9.6.2024.09.04.01.39.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 01:39:46 -0700 (PDT) Received: from wheatley.brq.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 018DC1FD3325 for ; Wed, 04 Sep 2024 10:39:46 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725439190; 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=5yCeXEzZFJ+YU+TC2gZXpVQFEaC+9uZYy5xQUj0v1CA=; b=LtEYNVpNp/5PdEgwFeUigFEnmuH+ese+5sHgZ8Rg0SwaoLPQ7ZiM40gxce64h0wtpyJ6n0 uP8OT0zTub+0B4AO1CInoEynkSSeTR4rNjlh5buzbOajA8BpTTFyAbsPJcQ3LwkPPgu8KZ 7zrMMmD7CBm1xsY3svbeZ80Ok4KTj8s= X-MC-Unique: DNZsgI1APgC7ZTzUoBqz9Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725439188; x=1726043988; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5yCeXEzZFJ+YU+TC2gZXpVQFEaC+9uZYy5xQUj0v1CA=; b=lIp3K8snl+UPjrg6h5H+2mp/NCc0D+8qLgoF4gjm5xzEiSOAwS7HTlxXOmJ2cfBHvH y1dY8A3TmJ8ugmRcn0NjkV7hflGLFOqyqAs0Kb3qbVHeZIj8EHD+Cokx4RTQOuKEhkk2 3mgw1kPDdtWmHHawsLnkRSVZMSCCqn/4SAgtkP/FyMIzC+qprZMPjh1vddq920hisvoo ZcDuHIFScZ9MRqW+9J5cKCkD7CbQMXON72piewTV7/ASVDgyZi1OrPoJ5v7ZlKguewDq 0JS6A6x8B1N8ddkDAzxdQNtxymUdiGNkdOKAhGpTcgIGDPbpivg+598a7umRWRzxYP9x JIVg== X-Gm-Message-State: AOJu0YzkUA4ipBJnvrFreAPbxXEVcIHTKV2Vlnitpj/v/aOSUiz+MVdF WrVXRXwuBXpuEhIlPfL0cv57SW/5CiKCUWRrFVeQJpPRW53BWL4eOQ8PuwqrAf+8bJzfrrV07ee onFfU0Lpy1oq1TFwj3cN5b/IdAEpn+uKienXjTgg9TnyODQ9Q68P6KX6RumZt4TVlpJXUntUtj5 219cmMe601ZfjVrCSpIkJ+r+hMzEUd2muGK25VysE= X-Received: by 2002:a05:600c:154e:b0:427:9922:4526 with SMTP id 5b1f17b1804b1-42c8de5f5e9mr24482395e9.7.1725439188344; Wed, 04 Sep 2024 01:39:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHeXv7dOQvmUzE7AAnzvzCoRDLPM30+TRdydOScr4fRm7NqdkbNTpVVKFUVZdmg/QahCsieIA== X-Received: by 2002:a05:600c:154e:b0:427:9922:4526 with SMTP id 5b1f17b1804b1-42c8de5f5e9mr24481965e9.7.1725439187158; Wed, 04 Sep 2024 01:39:47 -0700 (PDT) From: Martin Kletzander To: devel@lists.libvirt.org Subject: [PATCH 2/2] virnetdevtap: Add better error message for a possible common user error Date: Wed, 4 Sep 2024 10:39:44 +0200 Message-ID: <2bf1a9815b5390209906706be046ad1bcb8140de.1725439083.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: JJBHMKEP2GVJVTUVNPVHP25ORVGNWI65 X-Message-ID-Hash: JJBHMKEP2GVJVTUVNPVHP25ORVGNWI65 X-MailFrom: mkletzan@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1725439242715116600 Content-Type: text/plain; charset="utf-8"; x-default="true" When users pre-create a tap device to use with multiqueue interface that has `managed=3D"no"`, change the error so that it does not indicate we are trying to create the device, and on top of that hint at the most probable error cause. Resolves: https://issues.redhat.com/browse/RHEL-55749 Signed-off-by: Martin Kletzander Reviewed-by: Michal Privoznik --- src/util/virnetdevtap.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c index 55536b5f4be2..3df4dc129f0c 100644 --- a/src/util/virnetdevtap.c +++ b/src/util/virnetdevtap.c @@ -230,9 +230,16 @@ int virNetDevTapCreate(char **ifname, } =20 if (ioctl(fd, TUNSETIFF, &ifr) < 0) { - virReportSystemError(errno, - _("Unable to create tap device %1$s"), - *ifname); + if (flags & VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING && + tapfdSize > 0) { + virReportSystemError(errno, + _("Unable to create multiple fds for = tap device %1$s (maybe existing device was created without multi_queue flag= )"), + *ifname); + } else { + virReportSystemError(errno, + _("Unable to create tap device %1$s"), + *ifname); + } goto cleanup; } =20 @@ -247,7 +254,7 @@ int virNetDevTapCreate(char **ifname, ioctl(fd, TUNSETPERSIST, 1) < 0) { virReportSystemError(errno, _("Unable to set tap device %1$s to persi= stent"), - *ifname); + NULLSTR(*ifname)); goto cleanup; } tapfd[i] =3D fd; --=20 2.46.0