From nobody Sun Feb 8 12:50:00 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) 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 1715011216064790.5585482717757; Mon, 6 May 2024 09:00:16 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 043F91DB5; Mon, 6 May 2024 12:00:15 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 153BA1B8C; Mon, 6 May 2024 11:58:57 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1D6C41B6C; Mon, 6 May 2024 11:58:48 -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 602E31B77 for ; Mon, 6 May 2024 11:58:47 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-660-h77R0zigN2eVX9Zia-7FQA-1; Mon, 06 May 2024 11:58:45 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 19128834FBE for ; Mon, 6 May 2024 15:58:45 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7AA06EC6A0 for ; Mon, 6 May 2024 15:58:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: h77R0zigN2eVX9Zia-7FQA-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 2/2] udevListInterfacesByStatus: Don't try to return NULL names Date: Mon, 6 May 2024 17:58:41 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: WRE6ZQINK3I6A2S23PUYRAAAYQSDD2GK X-Message-ID-Hash: WRE6ZQINK3I6A2S23PUYRAAAYQSDD2GK X-MailFrom: pkrempa@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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1715011216926100001 In case when the interface is being detached/reattached it may happen that udev will return NULL from 'udev_device_get_sysname()'. As the RPC code requires nonnull strings in the return array it fails to serialize such reply: libvirt: XML-RPC error : Unable to encode message payload Fix this by simply ignoring such interfaces as there's nothing we can report in such case. A similar fix was done to 'udevConnectListAllInterfaces' in commit 2ca94317ac6. Resolves: https://issues.redhat.com/browse/RHEL-34615 Signed-off-by: Peter Krempa --- src/interface/interface_backend_udev.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/interface/interface_backend_udev.c b/src/interface/interfa= ce_backend_udev.c index 826f486049..8bb19d7764 100644 --- a/src/interface/interface_backend_udev.c +++ b/src/interface/interface_backend_udev.c @@ -185,6 +185,7 @@ udevListInterfacesByStatus(virConnectPtr conn, udev_list_entry_foreach(dev_entry, devices) { struct udev_device *dev; const char *path; + const char *name; g_autoptr(virInterfaceDef) def =3D NULL; /* Ensure we won't exceed the size of our array */ @@ -194,10 +195,17 @@ udevListInterfacesByStatus(virConnectPtr conn, path =3D udev_list_entry_get_name(dev_entry); dev =3D udev_device_new_from_syspath(udev, path); + if (!(name =3D udev_device_get_sysname(dev))) { + /* Name can be NULL in case when the interface is being unbound + * from the driver. The list API requires names to be present = */ + VIR_DEBUG("Skipping interface '%s', name =3D=3D NULL", path); + continue; + } + def =3D udevGetMinimalDefForDevice(dev); if (filter(conn, def)) { if (names) - names[count] =3D g_strdup(udev_device_get_sysname(dev)); + names[count] =3D g_strdup(name); count++; } udev_device_unref(dev); --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org