[Dnsmasq-discuss] Modification to the feature of config-static DNS record in dual-stack network.

Simon Kelley simon at thekelleys.org.uk
Thu Nov 25 21:58:39 GMT 2010


许伟林 wrote:
> Hi all,
> When you add an item 'address=/www.opera.com/2001:840:4073:1::1:101' in
> '/etc/dnsmasq.conf', do you mean this site doesn't have an IPv4 address to
> access? I wonder it is not true on most occasion, since this kind of sites
> can only be accessed by IPv6 host.
> 
> However, when you add this item in the config file, dnsmasq-2.55 will reply
> an empty record for the DNS query[A] of www.opera.com. And it prints 2 lines
> in log file:
> *...*
> *dnsmasq: query[A] www.opera.com from 192.168.56.101*
> *dnsmasq: config www.opera.com is NODATA-IPv4*
> *...*
> 
> So the pure IPv4 hosts cannot access www.opera.com.
> 
> Actually the below feature is what I expected:
> *When receiving a DNS query request, dnsmasq firstly looks up the static
> record of the same type (A record or AAAA record) in config file. The client
> will receive the static DNS record if found. Or the query should be
> forwarded to the external DNS server.*
> 
> In order to realise this feature, we have to modify some codes in
> ./src/forward.c.
> 
<snip patch>

> William
> 
> 

Well done for getting your head around that code; it's really obscure
and should be re-written.

The current behaviour is sort-of deliberate, because often people want to do

--address = /<domain>/<IPv4 address>

and be sure that they have overridden that domain. If IPv6 queries for
the domain were let through, that would cause a surprise: Many users
don't even know that their browser, for instance, might try and make
IPv6 connections.

You can get the behaviour you are looking for by putting

2001:840:4073:1::1:101 www.opera.com

into /etc/hosts. Addresses there are used strictly for one address
family and don't affect forwarding of other queries.


I hope that's a suitable work-around for your application.


Cheers,

Simon.





More information about the Dnsmasq-discuss mailing list