From nobody Mon Feb 9 09:09:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591752434; cv=none; d=zohomail.com; s=zohoarc; b=Tj2S6WhFzzGR3mJg1c/MHS7gfbLMfBe6y6+uMDzhpvVKC/1s1LSYdzoF2kpVFqbXP+MNFmuXgCe1taLkws4M0Nv4PLwFfPjyg7hvGi/aZd47S+CgvayKUFGCRKHxScClhiaBvqtuQb/PpWoDk1MzQ4nAyp1bNTPmVVi/cKEKa1k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591752434; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=UvwZ/YvmHA7zAQb9napTgPhWvs5nvjzoifTZpLSGr2M=; b=UrYlQQvcA4L/UGPjWiLG6STubjzaZznxdgMsjyRF5dvntEHc6e1PoTyxfq7UHRN78itVu8yf20xzqS1woKRkw1FB8l4uY9+I9hd0Ym6CDwmvdkp8Hpl5O4q6Nqeq4Blmk4ebDaDET9FU9peoV4A7TjbtW/H9gQ3Tls4KKca/MoM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1591752434005252.85328369575916; Tue, 9 Jun 2020 18:27:14 -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-421-j_dWKU-jOxO5Ut7bpWa_DQ-1; Tue, 09 Jun 2020 21:27:10 -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 0EB19EC1B4; Wed, 10 Jun 2020 01:27:03 +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 DED15101E672; Wed, 10 Jun 2020 01:27:02 +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 AEA26180530F; Wed, 10 Jun 2020 01:27:02 +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 05A1Qwsm027389 for ; Tue, 9 Jun 2020 21:26:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id BEB452166BA3; Wed, 10 Jun 2020 01:26:58 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BAC262166BA2 for ; Wed, 10 Jun 2020 01:26:58 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.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 A5C0A80CDB5 for ; Wed, 10 Jun 2020 01:26:58 +0000 (UTC) Received: from mail-m24147.qiye.163.com (mail-m24147.qiye.163.com [220.194.24.147]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-284-kQ_zy75UPU6197frJrpGkQ-1; Tue, 09 Jun 2020 21:26:55 -0400 Received: from localhost.localdomain (unknown [58.56.27.130]) by smtp4 (Coremail) with SMTP id JedpCgCnxdh_NeBeVKS4Bw--.7295S17; Wed, 10 Jun 2020 09:21:44 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591752432; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:content-type:content-type: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=UvwZ/YvmHA7zAQb9napTgPhWvs5nvjzoifTZpLSGr2M=; b=Bap+UZEUwdVrqL7cHsfFEhU6OCWXMSzAe2GwFkgdvpSSs/XDkeQTXJIQ7vu4jztuhDr1qr 6adNSP/SM3DAq8gyJwMtvvUIXwoIO9Q1DF2uxqPQW0/8r5T06KrFTPquPe7HwgEMqZcsYH AwsmMN+oW4R1Zqr32rU3ABDUlFPJzPg= X-MC-Unique: j_dWKU-jOxO5Ut7bpWa_DQ-1 X-MC-Unique: kQ_zy75UPU6197frJrpGkQ-1 From: Shi Lei To: libvir-list@redhat.com Subject: [RFC 15/21] conf: Generate virNetworkDNSHostDefFormatBuf Date: Wed, 10 Jun 2020 09:20:43 +0800 Message-Id: <20200610012049.10774-16-shi_lei@massclouds.com> In-Reply-To: <20200610012049.10774-1-shi_lei@massclouds.com> References: <20200610012049.10774-1-shi_lei@massclouds.com> X-CM-TRANSID: JedpCgCnxdh_NeBeVKS4Bw--.7295S17 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUU5529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjTRBnQUUUUUU X-Originating-IP: [58.56.27.130] X-CM-SenderInfo: pvklsz1hl6ztxvvfz0xxgvhudrp/1tbiQwg-T1bdG+83qAAAsb X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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.84 on 10.5.11.22 X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Shi Lei --- src/conf/network_conf.c | 15 +++------------ src/conf/network_conf.h | 2 +- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 29ef3cf..1fea580 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -2176,7 +2176,7 @@ static int virNetworkDNSDefFormat(virBufferPtr buf, const virNetworkDNSDef *def) { - size_t i, j; + size_t i; =20 if (!(def->enable || def->forwardPlainNames || def->nfwds || def->nhos= ts || def->nsrvs || def->ntxts)) @@ -2246,17 +2246,8 @@ virNetworkDNSDefFormat(virBufferPtr buf, =20 if (def->nhosts) { for (i =3D 0; i < def->nhosts; i++) { - char *ip =3D virSocketAddrFormat(&def->hosts[i].ip); - - virBufferAsprintf(buf, "\n", ip); - virBufferAdjustIndent(buf, 2); - for (j =3D 0; j < def->hosts[i].nnames; j++) - virBufferEscapeString(buf, "%s\n", - def->hosts[i].names[j]); - - virBufferAdjustIndent(buf, -2); - virBufferAddLit(buf, "\n"); - VIR_FREE(ip); + if (virNetworkDNSHostDefFormatBuf(buf, "host", &def->hosts[i],= NULL) < 0) + return -1; } } virBufferAdjustIndent(buf, -2); diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h index b715dc3..a5a4939 100644 --- a/src/conf/network_conf.h +++ b/src/conf/network_conf.h @@ -149,7 +149,7 @@ struct _virNetworkDNSSrvDef { /* genparse:withhook, g= enformat */ =20 typedef struct _virNetworkDNSHostDef virNetworkDNSHostDef; typedef virNetworkDNSHostDef *virNetworkDNSHostDefPtr; -struct _virNetworkDNSHostDef { /* genparse:withhook */ +struct _virNetworkDNSHostDef { /* genparse:withhook, genformat */ virSocketAddr ip; /* xmlattr */ size_t nnames; char **names; /* xmlelem:hostname, array */ --=20 2.17.1