Signed-off-by: Shi Lei <shi_lei(a)massclouds.com>
---
src/conf/network_conf.c | 34 ++++++++++++++++++++++++++++------
1 file changed, 28 insertions(+), 6 deletions(-)
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index be639500..19408987 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -883,6 +883,31 @@ virNetworkDNSForwarderParseHook(xmlNodePtr node G_GNUC_UNUSED,
}
+static int
+virNetworkDNSDefParseHook(xmlNodePtr node G_GNUC_UNUSED,
+ virNetworkDNSDef *def,
+ const char *networkName,
+ void *parent G_GNUC_UNUSED,
+ void *opaque G_GNUC_UNUSED,
+ const char *enable G_GNUC_UNUSED,
+ const char *forwardPlainNames G_GNUC_UNUSED,
+ int nfwds,
+ int ntxts,
+ int nsrvs,
+ int nhosts)
+{
+ if (def->enable == VIR_TRISTATE_BOOL_NO &&
+ (nfwds || nhosts || nsrvs || ntxts)) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Extra data in disabled network '%s'"),
+ networkName);
+ return -1;
+ }
+
+ return 0;
+}
+
+
static int
virNetworkDNSDefParseXML(const char *networkName,
xmlNodePtr node,
@@ -1004,13 +1029,10 @@ virNetworkDNSDefParseXML(const char *networkName,
}
}
- if (def->enable == VIR_TRISTATE_BOOL_NO &&
- (nfwds || nhosts || nsrvs || ntxts)) {
- virReportError(VIR_ERR_XML_ERROR,
- _("Extra data in disabled network '%s'"),
- networkName);
+ if (virNetworkDNSDefParseHook(node, def, networkName, def, NULL,
+ enable, forwardPlainNames,
+ nfwds, ntxts, nsrvs, nhosts) < 0)
return -1;
- }
return 0;
}
--
2.25.1