From nobody Tue May 7 18:54:36 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=1638452559; cv=none; d=zohomail.com; s=zohoarc; b=kQO9IU1eJaozaZzTy2vOasvQHznbSQ35wpbTp1+Ii0mSkVdvVICtLzLPwA1n6RgbsrhCSZ1n3oCACZHZU3ci1HB0FpQyfeYL5u6LPr8wNai8Vrq4xJb8wjE4VImSdW3WBsah3PD7JEW2UaRMc0l/CPqwy4BFYDRLaHff67guFSM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638452559; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=SJaMsJjseIgN8kGjqHnWiO0WL/WIYVDlwqY0SjOJSJ0=; b=InjfoCuYQk/jqznOcG86mgTlq5YHfkY1h1ND9XcbHIZh8jKV4tZTFVCyoBm9AO3R5m6/tmjAM54Y9+H3y9i/HEXnHB/ExkC1ZwJ0IFk7HAUn7B5iZbGLoEfstOI2L5T8ZtmLuhPgmpmegSftDsk2LLVh4ZNrSiLlnBE/pnLfKmw= 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 163845255923130.42378795635011; Thu, 2 Dec 2021 05:42:39 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-504-i4XLVN30Oby5NKMehmrjgA-1; Thu, 02 Dec 2021 08:42:34 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C80B483DD24; Thu, 2 Dec 2021 13:42:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A59CB60C4A; Thu, 2 Dec 2021 13:42:28 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 70F174CA93; Thu, 2 Dec 2021 13:42:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1B2DgQhc022621 for ; Thu, 2 Dec 2021 08:42:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 86EB779454; Thu, 2 Dec 2021 13:42:26 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0EBF779453 for ; Thu, 2 Dec 2021 13:42:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638452558; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=SJaMsJjseIgN8kGjqHnWiO0WL/WIYVDlwqY0SjOJSJ0=; b=PsdE/8JyWyNrLIUlFaTPlq3wxxPX/L7F6N8Yh4ejFJ6z6Js9n1PlOWst59nSpi3dj467Pq dePvBgLWnVYw5RVYlYDui2icfLvTgBe2FX/jxE7w5VgiTiNEA/ZpNzD5PH9UGgVtn+peM1 QWrU9RynBsPY9x2znEMEGUsvkJOt3wM= X-MC-Unique: i4XLVN30Oby5NKMehmrjgA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2] virnetdevveth: Do report error if creating veth fails Date: Thu, 2 Dec 2021 14:41:47 +0100 Message-Id: <1f6dd125482986feaec0d1534422cc0c8a0910e3.1638452439.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1638452561286100001 Content-Type: text/plain; charset="utf-8" For some weird reason we are ignoring errors when creating veth pair that netlink reports. This affects the LXC driver which creates interfaces for container in virLXCProcessSetupInterfaces(). If creating a veth pair fails, no error is reported and the control jumps onto cleanup label where some cryptic error message is reported instead (something about inability to remove veth pair). Let's report error that netlink returned - it's probably the most accurate reason anyways. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/225 Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- v2 of: https://listman.redhat.com/archives/libvir-list/2021-December/msg00016.html diff to v1: - Report error only if it wasn't already reported (error =3D=3D 0) src/util/virnetdevveth.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/util/virnetdevveth.c b/src/util/virnetdevveth.c index 7133af44a2..b580e105ac 100644 --- a/src/util/virnetdevveth.c +++ b/src/util/virnetdevveth.c @@ -38,10 +38,19 @@ VIR_LOG_INIT("util.netdevveth"); static int virNetDevVethCreateInternal(const char *veth1, const char *veth2) { - int status; /* Just ignore it */ + int error =3D 0; virNetlinkNewLinkData data =3D { .veth_peer =3D veth2 }; =20 - return virNetlinkNewLink(veth1, "veth", &data, &status); + if (virNetlinkNewLink(veth1, "veth", &data, &error) < 0) { + if (error !=3D 0) { + virReportSystemError(-error, + _("unable to create %s <-> %s veth pair"), + veth1, veth2); + } + return -1; + } + + return 0; } =20 static int --=20 2.32.0