[Dnsmasq-discuss] localhost domain is fowarded to upstream server at commit d0ae3f5

Xingcong Li lixingcong512 at gmail.com
Sun Jun 20 04:31:28 UTC 2021


Hello, I have reproduced the bug. The issue is valid Now!

Here is my dnsmasq config file:

# /tmp/dnsmasq.conf
port=30000
no-resolv
no-poll
server=114.114.114.114
server=/fb.me/8.8.8.8
address=/qq.com/127.0.0.1

I used git bisect to find the first buggy commit is
6860cf932baeaf1c2f09c2a58e38be189ae394de

Query qq.com and www.qq.com to test if it can reply 127.0.0.1.

$ dig @localhost -p30000 qq.com
$ dig @localhost -p30000 www.qq.com

In commit 0276e0805b2ca4657d8017e878f8a400354bdf78 (parent of buggy
6860cf932), Everything works fine:

$ ./src/dnsmasq -d -C /tmp/dnsmasq.conf -q
dnsmasq: compile time options: IPv6 GNU-getopt no-DBus no-UBus no-i18n
no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack ipset auth no-cryptohash
no-DNSSEC loop-detect inotify dumpfile
dnsmasq: using nameserver 8.8.8.8#53 for domain fb.me
dnsmasq: using nameserver 114.114.114.114#53
dnsmasq: read /etc/hosts - 11 addresses
dnsmasq: query[A] qq.com from 127.0.0.1
dnsmasq: config qq.com is 127.0.0.1
dnsmasq: query[A] www.qq.com from 127.0.0.1
dnsmasq: config www.qq.com is 127.0.0.1

In buggy commit 6860cf932baeaf1c2f09c2a58e38be189ae394de, queries are
always forwarded to upstream:

$ ./src/dnsmasq -d -C /tmp/dnsmasq.conf -q
dnsmasq: started, version 2.86test2-5-g6860cf9 cachesize 150
dnsmasq: compile time options: IPv6 GNU-getopt no-DBus no-UBus no-i18n
no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack ipset auth no-cryptohash
no-DNSSEC loop-detect inotify dumpfile
dnsmasq: using nameserver 8.8.8.8#53 for domain fb.me
dnsmasq: using nameserver 114.114.114.114#53
dnsmasq: read /etc/hosts - 11 addresses
dnsmasq: query[A] qq.com from 127.0.0.1
compares: 7
dnsmasq: forwarded qq.com to 114.114.114.114
dnsmasq: reply qq.com is 123.151.137.18
dnsmasq: reply qq.com is 61.129.7.47
dnsmasq: reply qq.com is 183.3.226.35
dnsmasq: query[A] www.qq.com from 127.0.0.1
compares: 7
dnsmasq: forwarded www.qq.com to 114.114.114.114
dnsmasq: reply www.qq.com is <CNAME>
dnsmasq: reply ins-r23tsuuf.ias.tencent-cloud.net is 121.14.77.201
dnsmasq: reply ins-r23tsuuf.ias.tencent-cloud.net is 121.14.77.221

I added a line to print qdomain.

// domain-match.c around line 180
if (leading_dot)
{
    leading_dot = 0;
    crop_query--;
}
qdomain += crop_query;
printf("qdomain=%s\n", qdomain);

When I got qdomain="qq.com", the actual print result is "q.com", I guess it
should be ".com" or "com".

Any idea to fix it?

Regards,
Xingcong Li
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20210620/72347db6/attachment.htm>


More information about the Dnsmasq-discuss mailing list