From nobody Mon Feb 9 02:12:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1600240709; cv=none; d=zohomail.com; s=zohoarc; b=h/OhZOwz79hIcVkMTZkom9GB/4gfaF1XSBJyhiJWvlDcBTOwiO/o7Hchvq5ywBAvWeWC7IfmoNMz6nNmHAigjJtlbWiNhiY0ICU3WbgVaC3jPjbYi7DnTbCtKILM4ky3gjYeiQyGk6kz9l68cRVXkD2iThMuVkcEtheN0O+/K2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600240709; h=Content-Type:Content-Transfer-Encoding:Cc: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=rmnHMkm1wHnoj3ZXKG67rOzriwPMjMY2FcszTQW5m4A=; b=J7URP7LlZZG5T97UWnaGMhFU5GJqVmn6w39/YwlowDZ4E9wh72cXz1+uVMvZr0/MMWpxtkCXTnhJFyBie/a+AhHKt62luTBO+iHJmHXfmQbaQLPO0GiGEre+MfdiAwvoRHrXb8QNhttl3neLLPba3szMJgJdCYgUi9oHmsBnnZc= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 160024070989971.20106401937846; Wed, 16 Sep 2020 00:18:29 -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-588-SGxdH7LbNRKu9UVG_aVWWg-1; Wed, 16 Sep 2020 03:18:26 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 42011100CFD9; Wed, 16 Sep 2020 07:18:14 +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 19BA91002397; Wed, 16 Sep 2020 07:18:14 +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 D1540183D028; Wed, 16 Sep 2020 07:18:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08G7IDS4022949 for ; Wed, 16 Sep 2020 03:18:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 28D04F11E4; Wed, 16 Sep 2020 07:18:13 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 24739F11E0 for ; Wed, 16 Sep 2020 07:18:13 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0BBF185828E for ; Wed, 16 Sep 2020 07:18:13 +0000 (UTC) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-586-BTMNgNnJPqGicmbXVJZfUw-1; Wed, 16 Sep 2020 03:18:09 -0400 Received: by mail-wm1-f66.google.com with SMTP id z9so1808540wmk.1; Wed, 16 Sep 2020 00:18:08 -0700 (PDT) Received: from t440p.suse.asia (60-251-47-115.HINET-IP.hinet.net. [60.251.47.115]) by smtp.gmail.com with ESMTPSA id 9sm3721970wmf.7.2020.09.16.00.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 00:18:03 -0700 (PDT) X-MC-Unique: SGxdH7LbNRKu9UVG_aVWWg-1 X-MC-Unique: BTMNgNnJPqGicmbXVJZfUw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rmnHMkm1wHnoj3ZXKG67rOzriwPMjMY2FcszTQW5m4A=; b=Y4+m6fTSPqj8a5EOYA5KTRNy+qAiyU1HwO/augcMiUQQQrn4TeOMwqU1js9yHSkqyR EnW0OcExKal28rHJXW0JJMzdkCCrWR4o5sKGry1XXh4eiBRY6n3vVfSmzHpgDAo8R0OV Zi6yGFR4tpI06xs8C9v7vskAzGX3v+T6eFpw6h53/V/Elit3nkAcmtvaRmwEC3LDvP2N irpWgWL9oITFrV7MMSTRbQMcdBcoG4YdDsgVsfGlevYCoPveDFv3+nXOzNp09r+Fseld +900cncD2a8rNUBzEqwdwbODYtk8b9Ykz84Uf0sT+UsU4Y2sXLf3mfEB2KfXz84aeZU/ Li0g== X-Gm-Message-State: AOAM531y0KgZnMd9XvOXaniQ8MtGWrPl1hvGXi+FPxxvNxE4917Z4y2X UgAz7OuWsuYI1PwAXFxbUZZrge7NIW8+KA== X-Google-Smtp-Source: ABdhPJyQWdg2Gg5HVQekMGkJl5SvKYNfvHpM4F+lRp0jEM9RrN7wGVaM43TH7ryEbsr/eJCcLxoiKQ== X-Received: by 2002:a7b:cb97:: with SMTP id m23mr3021871wmi.173.1600240684241; Wed, 16 Sep 2020 00:18:04 -0700 (PDT) From: morecache@gmail.com X-Google-Original-From: lma@suse.de To: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 4/4] network: Check for active network during networkGetDHCPLeases Date: Wed, 16 Sep 2020 15:17:37 +0800 Message-Id: <20200916071737.22938-5-lma@suse.de> In-Reply-To: <20200916071737.22938-1-lma@suse.de> References: <20200916071737.22938-1-lma@suse.de> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false; X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: jtomko@redhat.com, Lin Ma , eskultet@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.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lin Ma It doesn't make sense querying dhcp leases for interfaces against an inacti= ve network, This patch adds a check to see if the network is active. Signed-off-by: Lin Ma --- src/network/bridge_driver.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 87d7acab06..1dffc2309f 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -4068,6 +4068,13 @@ networkGetDHCPLeases(virNetworkPtr net, if (virNetworkGetDHCPLeasesEnsureACL(net->conn, def) < 0) goto cleanup; =20 + if (!virNetworkObjIsActive(obj)) { + virReportError(VIR_ERR_OPERATION_INVALID, + _("network '%s' is not active"), + def->name); + goto error; + } + /* Retrieve custom leases file location */ custom_lease_file =3D networkDnsmasqLeaseFileNameCustom(driver, def->b= ridge); =20 --=20 2.26.0