From nobody Mon Nov 25 14:58:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1601507761; cv=none; d=zohomail.com; s=zohoarc; b=AgxoKlpwU9B6/jbjhQMi7Q1iQQerIHaPUvCQGT0430hk3ToVN0EMrVMKvAuou8yhDA/ux50HaPCPfRcdmb1MKXm/Xbha9G3BJ3r0E5Px4vmBChGQJKY/FMqVLET5fJEvZQhU0kLYI7kweibRBSGk2Mr8YmixdflWHGPfpkDaIbs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601507761; 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=TM2m5udcDbDFaWKzkXfEIuVEi8/HlhX/MosX6BoO2OE=; b=X2C6L5qrEv4Wi3n8+73E2ECezcuuS3Oq4FcuPz4f2If5u/D2x4/jyrpJAKN3mMIXSFY7nGkg2aj2QTveneqTey+bCmYqIUK+Ivyb9nLEtMOH3NxbrVzbmCCMCcU2xbVGfQqyC/Ml/l6T5k6GGwjkk8vs5LVPvUQpkmpg9CaxSa0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1601507761358435.22539248235273; Wed, 30 Sep 2020 16:16:01 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-319-unsB082oPNa7vdZKihjSVA-1; Wed, 30 Sep 2020 19:15:57 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 77194100963E; Wed, 30 Sep 2020 23:15:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5540E5D9DD; Wed, 30 Sep 2020 23:15:52 +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 24579183D026; Wed, 30 Sep 2020 23:15:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08UNEsUu028038 for ; Wed, 30 Sep 2020 19:14:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9155A55762; Wed, 30 Sep 2020 23:14:54 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-224.phx2.redhat.com [10.3.112.224]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C10E3782 for ; Wed, 30 Sep 2020 23:14:54 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601507760; 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=TM2m5udcDbDFaWKzkXfEIuVEi8/HlhX/MosX6BoO2OE=; b=QXnNL6jLJaEyn6eiaNdgFqcZc3MOh8UqeMQtN0k1gaKPE8L8RXSKC5Grqy86nvNb5peh7v lwxfrDjVKxD0T55tjOKCHNHLQaeb/Tsoe53mZTQvJKn8QUAs/vlEfm9dsIxzaA40KbcbCb VYnM2FwvyoE6RwLRo6pzFGrrlFfngdA= X-MC-Unique: unsB082oPNa7vdZKihjSVA-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 8/9] util: provide non-netlink/libnl alternative for virNetDevGetMaster() Date: Wed, 30 Sep 2020 19:14:43 -0400 Message-Id: <20200930231444.409215-9-laine@redhat.com> In-Reply-To: <20200930231444.409215-1-laine@redhat.com> References: <20200930231444.409215-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.14 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) Content-Type: text/plain; charset="utf-8" Lack of this one function (which is called for each active tap device every time libvirtd is started) is the one thing preventing a "WITHOUT_LIBNL" build of libvirt from being useful. With this alternate implementation, guests using standard tap devices will work properly. Signed-off-by: Laine Stump --- src/util/virnetdev.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 5221bada7b..c43823c747 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -915,9 +915,30 @@ virNetDevGetMaster(const char *ifname, char **master) return 0; } =20 +#elif defined(__linux__) =20 -#else +/* libnl isn't available, so we can't use netlink. + * Fall back to using sysfs + */ +int +virNetDevGetMaster(const char *ifname, char **master) +{ + g_autofree char *path =3D NULL; + g_autofree char *canonical =3D NULL; + + if (virNetDevSysfsFile(&path, ifname, "master") < 0) + return -1; =20 + if (!(canonical =3D virFileCanonicalizePath(path))) + return -1; + + *master =3D g_path_get_basename(canonical); + + VIR_DEBUG("IFLA_MASTER for %s is %s", ifname, *master ? *master : "(no= ne)"); + return 0; +} + +#else =20 int virNetDevGetMaster(const char *ifname G_GNUC_UNUSED, --=20 2.26.2