Signed-off-by: Shi Lei <shi_lei@xxxxxxxxxxxxxx> --- docs/schemas/network.rng | 3 +++ src/conf/network_conf.c | 12 ++++++------ src/conf/network_conf.h | 15 --------------- src/network/bridge_driver.c | 2 +- 4 files changed, 10 insertions(+), 22 deletions(-) diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 0034c4f..6127dae 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -257,6 +257,9 @@ <!-- Define the DNS related elements like TXT records and other features in the <dns> element --> <optional> + <!-- VIRT:DIRECTIVE { + "structure": {"output": "src/conf/network_conf"} + } --> <element name="dns"> <optional> <attribute name="enable"> diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 819b645..84b4887 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -194,8 +194,8 @@ static void virNetworkDNSDefClear(virNetworkDNSDefPtr def) { if (def->forwarders) { - while (def->nfwds) - virNetworkDNSForwarderClear(&def->forwarders[--def->nfwds]); + while (def->nforwarders) + virNetworkDNSForwarderClear(&def->forwarders[--def->nforwarders]); VIR_FREE(def->forwarders); } if (def->txts) { @@ -931,7 +931,7 @@ virNetworkDNSDefParseXML(const char *networkName, goto cleanup; } VIR_FREE(addr); - def->nfwds++; + def->nforwarders++; } } @@ -2156,7 +2156,7 @@ virNetworkDNSDefFormat(virBufferPtr buf, { size_t i, j; - if (!(def->enable || def->forwardPlainNames || def->nfwds || def->nhosts || + if (!(def->enable || def->forwardPlainNames || def->nforwarders || def->nhosts || def->nsrvs || def->ntxts)) return 0; @@ -2183,7 +2183,7 @@ virNetworkDNSDefFormat(virBufferPtr buf, } virBufferAsprintf(buf, " forwardPlainNames='%s'", fwd); } - if (!(def->nfwds || def->nhosts || def->nsrvs || def->ntxts)) { + if (!(def->nforwarders || def->nhosts || def->nsrvs || def->ntxts)) { virBufferAddLit(buf, "/>\n"); return 0; } @@ -2191,7 +2191,7 @@ virNetworkDNSDefFormat(virBufferPtr buf, virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); - for (i = 0; i < def->nfwds; i++) { + for (i = 0; i < def->nforwarders; i++) { virBufferAddLit(buf, "<forwarder"); if (def->forwarders[i].domain) { diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h index 1f96999..db0119d 100644 --- a/src/conf/network_conf.h +++ b/src/conf/network_conf.h @@ -104,21 +104,6 @@ struct _virNetworkDHCPHostDef { virSocketAddr ip; }; -typedef struct _virNetworkDNSDef virNetworkDNSDef; -typedef virNetworkDNSDef *virNetworkDNSDefPtr; -struct _virNetworkDNSDef { - int enable; /* enum virTristateBool */ - int forwardPlainNames; /* enum virTristateBool */ - size_t ntxts; - virNetworkDNSTxtDefPtr txts; - size_t nhosts; - virNetworkDNSHostDefPtr hosts; - size_t nsrvs; - virNetworkDNSSrvDefPtr srvs; - size_t nfwds; - virNetworkDNSForwarderPtr forwarders; -}; - typedef struct _virNetworkIPDef virNetworkIPDef; typedef virNetworkIPDef *virNetworkIPDefPtr; struct _virNetworkIPDef { diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index f060992..3cccbe5 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -1112,7 +1112,7 @@ networkDnsmasqConfContents(virNetworkObjPtr obj, */ bool addNoResolv = false; - for (i = 0; i < def->dns.nfwds; i++) { + for (i = 0; i < def->dns.nforwarders; i++) { virNetworkDNSForwarderPtr fwd = &def->dns.forwarders[i]; virBufferAddLit(&configbuf, "server="); -- 2.17.1