Signed-off-by: Shi Lei <shi_lei(a)massclouds.com>
---
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;
if (!(def->enable || def->forwardPlainNames || def->nfwds || def->nhosts
||
def->nsrvs || def->ntxts))
@@ -2184,16 +2184,8 @@ virNetworkDNSDefFormat(virBufferPtr buf,
if (def->nhosts) {
for (i = 0; i < def->nhosts; i++) {
- g_autofree char *ip = virSocketAddrFormat(&def->hosts[i].ip);
-
- virBufferAsprintf(buf, "<host ip='%s'>\n", ip);
- virBufferAdjustIndent(buf, 2);
- for (j = 0; j < def->hosts[i].nnames; j++)
- virBufferEscapeString(buf,
"<hostname>%s</hostname>\n",
- def->hosts[i].names[j]);
-
- virBufferAdjustIndent(buf, -2);
- virBufferAddLit(buf, "</host>\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, genformat */
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 */
--
2.25.1