Signed-off-by: Shi Lei <shi_lei(a)massclouds.com>
---
src/conf/network_conf.c | 21 ++++-----------------
src/conf/network_conf.h | 4 ++--
2 files changed, 6 insertions(+), 19 deletions(-)
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 8610fbc..3b93772 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -886,8 +886,8 @@ virNetworkDNSForwarderParseXMLHook(xmlNodePtr node G_GNUC_UNUSED,
virNetworkDNSForwarderPtr def,
const char *instname G_GNUC_UNUSED,
void *opaque G_GNUC_UNUSED,
- const char *addr,
- const char *domain G_GNUC_UNUSED)
+ const char *domain G_GNUC_UNUSED,
+ const char *addr)
{
if (!(addr || def->domain)) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -2213,22 +2213,9 @@ virNetworkDNSDefFormat(virBufferPtr 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)) {
- char *addr = virSocketAddrFormat(&def->forwarders[i].addr);
-
- if (!addr)
+ if (virNetworkDNSForwarderFormatBuf(buf, "forwarder",
+ &def->forwarders[i], NULL) < 0)
return -1;
-
- virBufferAsprintf(buf, " addr='%s'", addr);
- VIR_FREE(addr);
- }
- virBufferAddLit(buf, "/>\n");
}
for (i = 0; i < def->ntxts; i++) {
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index f14eef2..1313c3e 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -158,9 +158,9 @@ struct _virNetworkDNSHostDef { /* genparse:withhook, genformat */
typedef struct _virNetworkDNSForwarder virNetworkDNSForwarder;
typedef virNetworkDNSForwarder *virNetworkDNSForwarderPtr;
-struct _virNetworkDNSForwarder { /* genparse:withhook */
- virSocketAddr addr; /* xmlattr */
+struct _virNetworkDNSForwarder { /* genparse:withhook, genformat */
char *domain; /* xmlattr */
+ virSocketAddr addr; /* xmlattr */
};
typedef struct _virNetworkDNSDef virNetworkDNSDef;
--
2.17.1