From nobody Mon Feb 9 09:52:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585120419; cv=none; d=zohomail.com; s=zohoarc; b=nqZRDP2aEAe4AfuB0Mz/d6CIwnUj6UHl0FkbHJ/U2VYGjmLjC7SurQ9K1hYyoyhFa5VRKHwngCGhIP4vdzuQdktQvttw4c5tsKWSREMPY/iN4SOGYHmttgFiVDgW+z2mk6B3OfWe5qcx0FOBetvkS6haE0Kj2VZ27gr40u1xD/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585120419; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=NhtgaiqStn4nc5HIPlUq5AjUPrOulOrcYi+6GzmlOig=; b=oDI9AatYnNJOjKN//6jaypT9PaNcH0wjQTMjPJlZdqVPOEkLLRJGlUAkVavrV5Uk8Feru4BfwYHY0jztkScvRy5IKk9nDGYta1oV6qSdP8hV+ge0FF4F9KskvS0VXfbwX8G2G8eXb/JsXqq+2t0Vf44Oe1OngsBpiqjYeuIAgSg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585120419837871.7318652267629; Wed, 25 Mar 2020 00:13:39 -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-166-UWG-5ChdO6WuX4DTtDWqHw-1; Wed, 25 Mar 2020 03:13:35 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4D9688017DF; Wed, 25 Mar 2020 07:13:29 +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 2405DA7E3; Wed, 25 Mar 2020 07:13:29 +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 C5A5718034FD; Wed, 25 Mar 2020 07:13:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02P7CUgF023902 for ; Wed, 25 Mar 2020 03:12:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 42F8A2037E4F; Wed, 25 Mar 2020 07:12:30 +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 3F6812037E43 for ; Wed, 25 Mar 2020 07:12:30 +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 2AE5D80029A for ; Wed, 25 Mar 2020 07:12:30 +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-298-7o-hm5LpMKWBMARe6ahmGg-1; Wed, 25 Mar 2020 03:12:26 -0400 Received: from localhost.localdomain (unknown [123.232.151.103]) by smtp4 (Coremail) with SMTP id JedpCgD3ftNNBHtey+koAw--.408S30; Wed, 25 Mar 2020 15:12:23 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585120418; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=NhtgaiqStn4nc5HIPlUq5AjUPrOulOrcYi+6GzmlOig=; b=UlzWrbI1nvIOUTFGyqhvH/1SM3gvhi2STROYx+ox0kP2v+o6KWzPr7AIeC3Hza6QXY9Tnt 1pQv0aPMuad9OEkpVk3xuSKmhR5HVF++Ol4tAGIWMRumW6yHacn4cH1VoZq2RwcLBdOQkz dCrpH/QI2QIIpHsbg1CBX2oPgyn3u5o= X-MC-Unique: UWG-5ChdO6WuX4DTtDWqHw-1 X-MC-Unique: 7o-hm5LpMKWBMARe6ahmGg-1 From: Shi Lei To: libvir-list@redhat.com Subject: [RFC 28/29] conf: Apply virNetworkDNSHostDefFormatBuf(generated) in virNetworkDNSDefFormat Date: Wed, 25 Mar 2020 15:12:08 +0800 Message-Id: <20200325071209.20841-29-shi_lei@massclouds.com> In-Reply-To: <20200325071209.20841-1-shi_lei@massclouds.com> References: <20200325071209.20841-1-shi_lei@massclouds.com> X-CM-TRANSID: JedpCgD3ftNNBHtey+koAw--.408S30 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjTRSksPUUUUU X-Originating-IP: [123.232.151.103] X-CM-SenderInfo: pvklsz1hl6ztxvvfz0xxgvhudrp/1tbihRfxT1sfnDpM9wAAs1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 02P7CUgF023902 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.23 X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Shi Lei --- docs/schemas/network.rng | 1 + src/conf/network_conf.c | 15 +++------------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index b97510f..ba5db0b 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -385,6 +385,7 @@ {"name": "partialOkay", "type": "Bool"} ] }, + "formatfunc": {"output": "src/conf/network_conf"}, "members": [ {"id": "ip", "opt": true}, {"id": "hostname", "name": "name", "opt": true} diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 1e8bfbc..e5d6e49 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -1926,7 +1926,7 @@ static int virNetworkDNSDefFormat(virBufferPtr buf, const virNetworkDNSDef *def) { - size_t i, j; + size_t i; =20 if (!(def->enable || def->forwardPlainNames || def->nforwarders || def= ->nhosts || def->nsrvs || def->ntxts)) @@ -1981,17 +1981,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])= < 0) + return -1; } } virBufferAdjustIndent(buf, -2); --=20 2.17.1