From nobody Mon Feb 9 04:30:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1599808153; cv=none; d=zohomail.com; s=zohoarc; b=HuygsUyV7peJp3mTr626GReCedTvLtpYG4m0bPdqK15/9vSDGb6x9pif923RssQa0h1eT3m/fNtewSocZXXNQt28+QbIIvIETXgU9UUvk+o7ZuxiFUA3xLyJ5GKSMyNs7ivH+gjcypfAQ1Myyo8i6BjuNocM1OLqtIZCfjTXyKI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599808153; 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=5hhvsq8TdlSnVenH8lGxsn50U5QKW3G7jDzQGU8Ify0=; b=M2FFagkA98JH80zCrV237UbdRoLwuynLvDo7KS9NwjycgfTmSfSNnMpHvmuCInM33MA5vwV65HS/x94VDH9F80OSYeKgYi+r1rUijf0M1KoRDusLQT7CWG8swRpPup9hlEvAOjS456D6qoL8RNGYrofkqgiBY5SmEr9ghJ4dnnY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1599808153774369.1940997863943; Fri, 11 Sep 2020 00:09:13 -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-244-aXk7MgRtMdi4Z36F9TleSw-1; Fri, 11 Sep 2020 03:09:10 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 824C818BE166; Fri, 11 Sep 2020 07:09:05 +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 60E1A75125; Fri, 11 Sep 2020 07:09:05 +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 2A51B181A06B; Fri, 11 Sep 2020 07:09:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08B76kAk006891 for ; Fri, 11 Sep 2020 03:06:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id DDC9311921AB; Fri, 11 Sep 2020 07:06:45 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D97EA11921AA for ; Fri, 11 Sep 2020 07:06:45 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (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 C0FE2811E76 for ; Fri, 11 Sep 2020 07:06:45 +0000 (UTC) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-428-4vs16OfjOt6LJhd4aj0eOg-1; Fri, 11 Sep 2020 03:06:43 -0400 Received: by mail-pg1-f196.google.com with SMTP id w186so5971037pgb.8 for ; Fri, 11 Sep 2020 00:06:43 -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 a19sm1252037pfn.10.2020.09.11.00.06.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Sep 2020 00:06:41 -0700 (PDT) X-MC-Unique: aXk7MgRtMdi4Z36F9TleSw-1 X-MC-Unique: 4vs16OfjOt6LJhd4aj0eOg-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=5hhvsq8TdlSnVenH8lGxsn50U5QKW3G7jDzQGU8Ify0=; b=mw9GgZZlz13APHYLBxjbqaYliUmf2lVlptjMqR3kibgaQfDkaWDauEwebQIC+lNCEm ZCGdXW3E0OFqF+STU9nItckIo0aMqqu4EOhasF3ysEA0nxJfsWThG3dDY8CoeijoQaeq gbzRWm1dBCst/0P4A1E3XX0+jc1Kfp7tkEHpJyyMTAbVbAwTa1gfGC6p1A1o4m69dfpL QIAbIee+dz4c4v7cEejT9lrpulihR5h0NqW3ZSlQjfa3iybmxtGeF0fvGv32MPBnesDk GoRra+mTPzv3XQ8iEJSd8as7gneT40j1CathEsQzb5kZ7k8BrP04YEePejN1L1YsKn45 MNpA== X-Gm-Message-State: AOAM531afa+NWWORlj7AJ1HjOM4NHi34PtiacvoTjnbsgOKuCGbpK5JV ct/XaPxkHx8oC/W3WNphlxpA/ArI2cKvPg== X-Google-Smtp-Source: ABdhPJyp8dHqnwp/vu27y82qvlL1f/X3vIhG2wHLXcM3wfjoem/JR4RQPY9YtpDtxd6DaB9Rsos5lw== X-Received: by 2002:a17:902:8509:b029:d0:cbe1:e746 with SMTP id bj9-20020a1709028509b02900d0cbe1e746mr952729plb.33.1599808001887; Fri, 11 Sep 2020 00:06:41 -0700 (PDT) From: Lin Ma X-Google-Original-From: Lin Ma To: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/12] network: Check for active network during networkGetDHCPLeases Date: Fri, 11 Sep 2020 15:06:10 +0800 Message-Id: <20200911070619.12325-4-lma@suse.de> In-Reply-To: <20200911070619.12325-1-lma@suse.de> References: <20200911070619.12325-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.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Lin Ma 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.15 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" 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 Reviewed-by: Erik Skultety --- 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