From nobody Mon Feb 9 21:20:47 2026 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619076781; cv=none; d=zohomail.com; s=zohoarc; b=Bm+PrI/CLgVMTE+NZRiAEPJQLt8ELplq2O3GimbTfcyPeIBeX+ukRXF/zfy2oYMYzqnOKwu42eqDFkJtHkj9DOnS+/ZT+Dy/CUrGadZTWtnSZr2r0SqZo3Tfg6R2N8pwgeJ+HmPjpDkCeYvKADu3jVoZVvNFT4ff9IBHRsa3pYA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619076781; 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=zH1muDkp9G/vpXI7ioDl+5jQpMFQbbxf038QVDVmSUA=; b=Y/0YO5pXhHpZHVvT0GKJd82sgbjkqzUi9wvriLoKXFNyyu7NV7weNVBhfoVvSQBqbwjKPdRZmtnCrtErJZ6bpxRCkBKVUZu4Q/dN8hQt/TS7+F1q0cneQIeUOcwLEllJyXC1vqoy7749isiLlTMx7sOnvTzryPOZF67dKpd9rZI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com 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 1619076781328794.8502313901812; Thu, 22 Apr 2021 00:33: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-229-15ZOSbS_O8yP0AEnaYGaSw-1; Thu, 22 Apr 2021 03:32:57 -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 6B108107ACC7; Thu, 22 Apr 2021 07:32:51 +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 42C01101F965; Thu, 22 Apr 2021 07:32:51 +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 0A5521806D33; Thu, 22 Apr 2021 07:32:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13M7Wkpf024126 for ; Thu, 22 Apr 2021 03:32:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8B05420BDB2F; Thu, 22 Apr 2021 07:32:46 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2DA1620BDB30 for ; Thu, 22 Apr 2021 07:32: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-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1C779185A7A5 for ; Thu, 22 Apr 2021 07:32:45 +0000 (UTC) Received: from m97136.mail.qiye.163.com (m97136.mail.qiye.163.com [220.181.97.136]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-362-rW-wtzmTP5aMR9HluhNYpA-1; Thu, 22 Apr 2021 03:32:12 -0400 Received: from localhost.localdomain (unknown [58.56.27.130]) by smtp2 (Coremail) with SMTP id iOCowAA3HLYJJYFgMwTJAQ--.5876S25; Thu, 22 Apr 2021 15:26:09 +0800 (CST) X-MC-Unique: 15ZOSbS_O8yP0AEnaYGaSw-1 X-MC-Unique: rW-wtzmTP5aMR9HluhNYpA-1 From: Shi Lei To: libvir-list@redhat.com Subject: [RFCv3 23/25] conf: Extract error-checking code from virNetworkDNSDefParseXML Date: Thu, 22 Apr 2021 15:25:31 +0800 Message-Id: <20210422072533.312211-24-shi_lei@massclouds.com> In-Reply-To: <20210422072533.312211-1-shi_lei@massclouds.com> References: <20210422072533.312211-1-shi_lei@massclouds.com> MIME-Version: 1.0 X-CM-TRANSID: iOCowAA3HLYJJYFgMwTJAQ--.5876S25 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjfULasbUUUUU X-Originating-IP: [58.56.27.130] X-CM-SenderInfo: pvklsz1hl6ztxvvfz0xxgvhudrp/1tbieBF8T1qriKc+5wAAsd 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.6 X-loop: libvir-list@redhat.com Cc: Shi Lei 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 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Shi Lei --- src/conf/network_conf.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index be639500..19408987 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -883,6 +883,31 @@ virNetworkDNSForwarderParseHook(xmlNodePtr node G_GNUC= _UNUSED, } =20 =20 +static int +virNetworkDNSDefParseHook(xmlNodePtr node G_GNUC_UNUSED, + virNetworkDNSDef *def, + const char *networkName, + void *parent G_GNUC_UNUSED, + void *opaque G_GNUC_UNUSED, + const char *enable G_GNUC_UNUSED, + const char *forwardPlainNames G_GNUC_UNUSED, + int nfwds, + int ntxts, + int nsrvs, + int nhosts) +{ + if (def->enable =3D=3D VIR_TRISTATE_BOOL_NO && + (nfwds || nhosts || nsrvs || ntxts)) { + virReportError(VIR_ERR_XML_ERROR, + _("Extra data in disabled network '%s'"), + networkName); + return -1; + } + + return 0; +} + + static int virNetworkDNSDefParseXML(const char *networkName, xmlNodePtr node, @@ -1004,13 +1029,10 @@ virNetworkDNSDefParseXML(const char *networkName, } } =20 - if (def->enable =3D=3D VIR_TRISTATE_BOOL_NO && - (nfwds || nhosts || nsrvs || ntxts)) { - virReportError(VIR_ERR_XML_ERROR, - _("Extra data in disabled network '%s'"), - networkName); + if (virNetworkDNSDefParseHook(node, def, networkName, def, NULL, + enable, forwardPlainNames, + nfwds, ntxts, nsrvs, nhosts) < 0) return -1; - } =20 return 0; } --=20 2.25.1