From nobody Mon Feb 9 19:04:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; 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 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599190983; cv=none; d=zohomail.com; s=zohoarc; b=brfshb8DglyYmAbACuH/F6sP5cKQAKg6jcnDgcseVS3dhsM5WIo4yUp9jduycolKi5z5BoBfZ107d7XCyLGzcik7KP3pNS7DrlWyF9X0Xn8T1RKcUcuysh7ubV1pc2yNqLHukb5cWHCnxNIFISXnv6NHHCyLq+r3EWhdXXrAA3M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599190983; 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=bEekl/N6I0LAOTDm3NQk1Aoz/BNWE7LF/J/ugXCAz+Q=; b=GDo5J2dnqdiVgUOVQfvwhKOj8v/Ncor0WURfCLWXflBBjNJD//9TwHitvqmyvT80swwLVVeVxvOxbGMgv7yg6icbDueDdWPNOwSk062gxGlANndK0CMV5AWbZWHSBcvEz7CTJIlVHrV2YyiDU+XPa2mOz1CvfNa4+no9j3AEkL4= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1599190983532617.2087052934374; Thu, 3 Sep 2020 20:43:03 -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-570-x-8hjWk1PX62kDzMpOKUAQ-1; Thu, 03 Sep 2020 23:42:03 -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 8DB822FD0A; Fri, 4 Sep 2020 03:41:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6D9285D9DC; Fri, 4 Sep 2020 03:41:54 +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 3CD3D972F8; Fri, 4 Sep 2020 03:41:54 +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 0843fBhU030658 for ; Thu, 3 Sep 2020 23:41:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 776A3EE873; Fri, 4 Sep 2020 03:41:10 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 72D031037BD for ; Fri, 4 Sep 2020 03:41:10 +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 5AC25801223 for ; Fri, 4 Sep 2020 03:41:10 +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-528-MmwZNbmbPiqh1GKnmNVmSw-1; Thu, 03 Sep 2020 23:41:07 -0400 Received: from localhost.localdomain (unknown [58.56.27.130]) by smtp4 (Coremail) with SMTP id JedpCgAHcNgStlFfYHYgCg--.1426S17; Fri, 04 Sep 2020 11:35:51 +0800 (CST) X-MC-Unique: x-8hjWk1PX62kDzMpOKUAQ-1 X-MC-Unique: MmwZNbmbPiqh1GKnmNVmSw-1 From: Shi Lei To: libvir-list@redhat.com Subject: [RFCv2 15/46] conf: Generate virNetworkDNSHostDefFormatBuf Date: Fri, 4 Sep 2020 11:35:07 +0800 Message-Id: <20200904033538.418579-16-shi_lei@massclouds.com> In-Reply-To: <20200904033538.418579-1-shi_lei@massclouds.com> References: <20200904033538.418579-1-shi_lei@massclouds.com> MIME-Version: 1.0 X-CM-TRANSID: JedpCgAHcNgStlFfYHYgCg--.1426S17 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvj4iuc_oDUUUU X-Originating-IP: [58.56.27.130] X-CM-SenderInfo: pvklsz1hl6ztxvvfz0xxgvhudrp/1tbicRGVT1lZvYiFEgAAsY 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 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.002 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 | 14 +++----------- src/conf/network_conf.h | 2 +- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index e2d0297..0ed2332 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -2115,7 +2115,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)) @@ -2184,16 +2184,8 @@ virNetworkDNSDefFormat(virBufferPtr buf, =20 if (def->nhosts) { for (i =3D 0; i < def->nhosts; i++) { - g_autofree 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"); + if (virNetworkDNSHostDefFormatBuf(buf, "host", &def->hosts[i],= def, NULL) < 0) + return -1; } } virBufferAdjustIndent(buf, -2); diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h index c30fd4f..61863b0 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.25.1