Signed-off-by: Shi Lei <shi_lei(a)massclouds.com>
---
src/conf/network_conf.c | 18 +++---------------
src/conf/network_conf.h | 4 ++--
2 files changed, 5 insertions(+), 17 deletions(-)
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index ef28bb4d..be639500 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -2135,21 +2135,9 @@ virNetworkDNSDefFormat(virBuffer *buf,
virBufferAdjustIndent(buf, 2);
for (i = 0; i < def->nfwds; i++) {
-
- virBufferAddLit(buf, "<forwarder");
- if (def->forwarders[i].domain) {
- virBufferEscapeString(buf, " domain='%s'",
- def->forwarders[i].domain);
- }
- if (VIR_SOCKET_ADDR_VALID(&def->forwarders[i].addr)) {
- g_autofree char *addr =
virSocketAddrFormat(&def->forwarders[i].addr);
-
- if (!addr)
- return -1;
-
- virBufferAsprintf(buf, " addr='%s'", addr);
- }
- virBufferAddLit(buf, "/>\n");
+ if (virNetworkDNSForwarderFormatBuf(buf, "forwarder",
+ &def->forwarders[i], def, NULL) <
0)
+ return -1;
}
for (i = 0; i < def->ntxts; i++) {
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index 17f6c309..577c1568 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -150,9 +150,9 @@ struct _virNetworkDNSHostDef { /* genparse, genformat */
typedef struct _virNetworkDNSForwarder virNetworkDNSForwarder;
-struct _virNetworkDNSForwarder { /* genparse */
- virSocketAddr addr; /* xmlattr */
+struct _virNetworkDNSForwarder { /* genparse, genformat */
char *domain; /* xmlattr */
+ virSocketAddr addr; /* xmlattr */
};
typedef struct _virNetworkDNSDef virNetworkDNSDef;
--
2.25.1