I haven't had time yet to look at the code in detail, but thought I
should send this preliminary commentary.
On 03/24/2011 09:58 AM, Michal Novotny wrote:
Hi,
this is the patch to add DNS TXT record support to libvirt networking
driver since this is feature that's supported by DNSMasq that's being
used by the bridge driver.
Maybe you fail to understand the reasons why to implement such a feature
however it's a good thing IMHO since user could provide some information
in the DNS TXT record headers.
As a matter of fact, I think that not only is this useful, but
configuring other capabilities presented by dnsmasq would be good. I
think you'll find a kindred spirit in Paweł Krześniak, who was also
wanting some other dnsmasq capabilities exposed (I forget which now).
The headers are, of course, configurable
in the network XML description and the idea got to me when I was reading
an article about DKIM (DomainKeys Identified Mail) since it's using TXT
records in the DNS to provide the public keys. This inspired me to
implement the DNS TXT record support to libvirt bridge driver to allow
users expose some information to the guest if they want to do so etc.
Limitations:
- Records names and values containing space (' ') arguments are altered
to change spaces to underscores ('_'). This is because of proper
argument handling when spawning dnsmasq.
Is this really necessary? We're not talking about a shell commandline
here, but an array of null terminated strings. If it's a restriction
placed by dnsmasq itself, then we should just disallow ' ' during
parsing rather than silently changing it, to avoid surprises.
Technical details:
The --txt-record argument should be supported by all version of DNSMasq
which allows us to use it in all of the cases for the libvirt bridge
driver. The only thing user has to do is to edit the network XML
description in libvirt and append:
<dns>
<txt_record name='some name' value='some value' />
</dns>
I was told awhile back that putting underscores in XML element names was
strongly frowned upon (although there are certainly already examples of
it in libvirt xml).
Also, it would be really nice (especially it would make Eric happy :-)
if you included with your patch some changes to
docs/formatnetwork.html.in to add this to the documentation.
Have you thought about how this config model would apply to adding the
other dns-related stuff that can be done with dnsmasq. It would be
unfortunate if we took this first step and it turned out to not be a
good match for the natural followons. Maybe we should take a short bit
of time to consider the larger picture to make sure we'lll be able to
easily and logically add the other stuff later (this might be the right
way, I just haven't had time yet to think about it)
after the DHCP elements of network IP (<ip>) tree. After
creating such
a definition user has to restart this virtual network for changes to
take effect, i.e. to spawn DNSMasq with new --txt-record arguments.
User can confirm the proper configuration of DNS TXT records both by
looking to the dnsmasq command-line (i.e. `ps aux | grep dnsmasq`)
where information about --txt-record=some_name,some_value should be
present or test it in the host/guest itself by digging the TXT record
from there, i.e. using `dig TXT some_name @ip` from the host (since
the it's running on the @ip and not the gateway for host) or `dig TXT
some_name` from the guest where the value "some_value" should be output
in both cases.
This has been developed and tested on Fedora i386 box and everything
was working fine.