libvirt/tests/networkxml2confdata
Laine Stump 6612d1adb7 network: fix problems with SRV records
A patch submitted by Steven Malin last week pointed out a problem with
libvirt's DNS SRV record configuration:

  https://www.redhat.com/archives/libvir-list/2014-March/msg00536.html

When searching for that message later, I found another series that had
been posted by Guannan Ren back in 2012 that somehow slipped between
the cracks:

  https://www.redhat.com/archives/libvir-list/2012-July/msg00236.html

That patch was very much out of date, but also pointed out some real
problems.

This patch fixes all the noted problems by refactoring
virNetworkDNSSrvDefParseXML() and networkDnsmasqConfContents(), then
verifies those fixes by added several new records to the test case.

Problems fixed:

* both service and protocol now have an underscore ("_") prepended on
  the commandline, as required by RFC2782.

  <srv service='sip' protocol='udp' domain='example.com'
       target='tests.example.com' port='5060' priority='10'
       weight='150'/>

  before: srv-host=sip.udp.example.com,tests.example.com,5060,10,150
  after:  srv-host=_sip._udp.example.com,tests.example.com,5060,10,150

* if "domain" wasn't specified in the <srv> element, the extra
  trailing "." will no longer be added to the dnsmasq commandline.

  <srv service='sip' protocol='udp' target='tests.example.com'
       port='5060' priority='10' weight='150'/>

  before: srv-host=sip.udp.,tests.example.com,5060,10,150
  after:  srv-host=_sip._udp,tests.example.com,5060,10,150

* when optional attributes aren't specified, the separating comma is
  also now not placed on the dnsmasq commandline. If optional
  attributes in the middle of the line are not specified, they are
  replaced with a default value in the commandline (1 for port, 0 for
  priority and weight).

  <srv service='sip' protocol='udp' target='tests.example.com'
       port='5060'/>

  before: srv-host=sip.udp.,tests.example.com,5060,,
  after:  srv-host=_sip._udp,tests.example.com,5060

  (actually the would have generated an error, because "optional"
  attributes weren't really optional.)

* The allowed characters for both service and protocol are now limited
  to alphanumerics, plus a few special characters that are found in
  existing names in /etc/services and /etc/protocols. (One exception
  is that both of these files contain names with an embedded ".", but
  "."  can't be used in these fields of an SRV record because it is
  used as a field separator and there is no method to escape a "."
  into a field.) (Previously only the strings "tcp" and "udp" were
  allowed for protocol, but this restriction has been removed, since
  RFC2782 specifically says that it isn't limited to those, and that
  anyway it is case insensitive.)

* the "domain" attribute is no longer required in order to recognize
  the port, priority, and weight attributes during parsing. Only
  "target" is required for this.

* if "target" isn't specified, port, priority, and weight are not
  allowed (since they are meaningless - an empty target means "this
  service is *not available* for this domain").

* port, priority, and weight are now truly optional, as the comments
  originally suggested, but which was not actually true.
2014-03-26 16:42:43 +02:00
..
dhcp6-nat-network.conf network: change default of forwardPlainNames to 'yes' 2014-02-04 12:00:26 +02:00
dhcp6-nat-network.xml
dhcp6-network.conf network: change default of forwardPlainNames to 'yes' 2014-02-04 12:00:26 +02:00
dhcp6-network.xml
dhcp6host-routed-network.conf network: change default of forwardPlainNames to 'yes' 2014-02-04 12:00:26 +02:00
dhcp6host-routed-network.xml
isolated-network.conf network: change default of forwardPlainNames to 'yes' 2014-02-04 12:00:26 +02:00
isolated-network.xml
nat-network-dns-forward-plain.conf
nat-network-dns-forward-plain.xml
nat-network-dns-forwarders.conf network: change default of forwardPlainNames to 'yes' 2014-02-04 12:00:26 +02:00
nat-network-dns-forwarders.xml Add forwarder attribute to <dns/> element 2013-09-17 17:47:33 -06:00
nat-network-dns-hosts.conf network: only prevent forwarding of DNS requests for unqualified names 2014-02-04 12:00:26 +02:00
nat-network-dns-hosts.xml
nat-network-dns-srv-record-minimal.conf network: fix problems with SRV records 2014-03-26 16:42:43 +02:00
nat-network-dns-srv-record-minimal.xml
nat-network-dns-srv-record.conf network: fix problems with SRV records 2014-03-26 16:42:43 +02:00
nat-network-dns-srv-record.xml network: fix problems with SRV records 2014-03-26 16:42:43 +02:00
nat-network-dns-txt-record.conf network: change default of forwardPlainNames to 'yes' 2014-02-04 12:00:26 +02:00
nat-network-dns-txt-record.xml
nat-network.conf network: change default of forwardPlainNames to 'yes' 2014-02-04 12:00:26 +02:00
nat-network.xml
netboot-network.conf network: change default of forwardPlainNames to 'yes' 2014-02-04 12:00:26 +02:00
netboot-network.xml
netboot-proxy-network.conf network: change default of forwardPlainNames to 'yes' 2014-02-04 12:00:26 +02:00
netboot-proxy-network.xml
routed-network.conf network: change default of forwardPlainNames to 'yes' 2014-02-04 12:00:26 +02:00
routed-network.xml