This patch allows RFC 2782 compliant SRV records in the network
config and corrects the documentation.
---
docs/formatnetwork.html.in | 6 +++---
src/conf/network_conf.c | 6 ++++--
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in
index fc56b42..9d3e525 100644
--- a/docs/formatnetwork.html.in
+++ b/docs/formatnetwork.html.in
@@ -721,7 +721,7 @@
<txt name="example" value="example value" />
<forwarder addr="8.8.8.8"/>
<forwarder addr="8.8.4.4"/>
- <srv service='name' protocol='tcp'
domain='test-domain-name' target='.' port='1024'
priority='10' weight='10'/>
+ <srv service='_name' protocol='_tcp'
domain='test-domain-name' target='.' port='1024'
priority='10' weight='10'/>
<host ip='192.168.122.2'>
<hostname>myhost</hostname>
<hostname>myhostalias</hostname>
@@ -805,8 +805,8 @@
<dd>The <code>dns</code> element can have also 0 or more
<code>srv</code>
record elements. Each <code>srv</code> record element defines a
DNS SRV record
and has 2 mandatory and 5 optional attributes. The mandatory attributes
- are service name and protocol (tcp, udp) and the optional attributes are
- target, port, priority, weight and domain as defined in DNS server SRV
+ are service name (_name) and protocol (_tcp, _udp) and the optional
attributes
+ are target, port, priority, weight and domain as defined in DNS server SRV
RFC (RFC 2782).
<span class="since">Since 0.9.9</span>
</dd>
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index bac0465..c7d55c8 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -961,9 +961,11 @@ virNetworkDNSSrvDefParseXML(const char *networkName,
goto error;
}
- /* Check whether protocol value is the supported one */
+ /* Check whether protocol value is supported (allows RFC 2782 compliance) */
if (def->protocol && STRNEQ(def->protocol, "tcp") &&
- (STRNEQ(def->protocol, "udp"))) {
+ STRNEQ(def->protocol, "udp") &&
+ STRNEQ(def->protocol, "_tcp") &&
+ STRNEQ(def->protocol, "_udp")) {
virReportError(VIR_ERR_XML_DETAIL,
_("Invalid protocol attribute value '%s' "
"in DNS SRV record of network %s"),
--
1.7.1