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 <pkrempa@xxxxxxxxxx> --- 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/interface_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 = NULL; /* Ensure we won't exceed the size of our array */ @@ -194,10 +195,17 @@ udevListInterfacesByStatus(virConnectPtr conn, path = udev_list_entry_get_name(dev_entry); dev = udev_device_new_from_syspath(udev, path); + if (!(name = 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 == NULL", path); + continue; + } + def = udevGetMinimalDefForDevice(dev); if (filter(conn, def)) { if (names) - names[count] = g_strdup(udev_device_get_sysname(dev)); + names[count] = g_strdup(name); count++; } udev_device_unref(dev); -- 2.44.0 _______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx