<div dir="ltr"><div dir="auto">Hello, I have reproduced the bug. The issue is valid Now!<br><br>Here is my dnsmasq config file:<br><br># /tmp/dnsmasq.conf<br>port=30000<br>no-resolv<br>no-poll<br>server=114.114.114.114<br>server=/<a href="http://fb.me/8.8.8.8">fb.me/8.8.8.8</a><br>address=/<a href="http://qq.com/127.0.0.1">qq.com/127.0.0.1</a><br><br>I used git bisect to find the first buggy commit is 6860cf932baeaf1c2f09c2a58e38be189ae394de<br><br>Query <a href="http://qq.com">qq.com</a> and <a href="http://www.qq.com">www.qq.com</a> to test if it can reply 127.0.0.1.<br><br>$ dig @localhost -p30000 <a href="http://qq.com">qq.com</a><br>$ dig @localhost -p30000 <a href="http://www.qq.com">www.qq.com</a><br><br>In commit 0276e0805b2ca4657d8017e878f8a400354bdf78 (parent of buggy 6860cf932), Everything works fine:<br><br>$ ./src/dnsmasq -d -C /tmp/dnsmasq.conf -q<br>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<br>dnsmasq: using nameserver 8.8.8.8#53 for domain <a href="http://fb.me">fb.me</a> <br>dnsmasq: using nameserver 114.114.114.114#53<br>dnsmasq: read /etc/hosts - 11 addresses<br>dnsmasq: query[A] <a href="http://qq.com">qq.com</a> from 127.0.0.1<br>dnsmasq: config <a href="http://qq.com">qq.com</a> is 127.0.0.1<br>dnsmasq: query[A] <a href="http://www.qq.com">www.qq.com</a> from 127.0.0.1<br>dnsmasq: config <a href="http://www.qq.com">www.qq.com</a> is 127.0.0.1<br><br>In buggy commit 6860cf932baeaf1c2f09c2a58e38be189ae394de, queries are always forwarded to upstream:<br><br>$ ./src/dnsmasq -d -C /tmp/dnsmasq.conf -q<br>dnsmasq: started, version 2.86test2-5-g6860cf9 cachesize 150<br>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<br>dnsmasq: using nameserver 8.8.8.8#53 for domain <a href="http://fb.me">fb.me</a> <br>dnsmasq: using nameserver 114.114.114.114#53<br>dnsmasq: read /etc/hosts - 11 addresses<br>dnsmasq: query[A] <a href="http://qq.com">qq.com</a> from 127.0.0.1<br>compares: 7<br>dnsmasq: forwarded <a href="http://qq.com">qq.com</a> to 114.114.114.114<br>dnsmasq: reply <a href="http://qq.com">qq.com</a> is 123.151.137.18<br>dnsmasq: reply <a href="http://qq.com">qq.com</a> is 61.129.7.47<br>dnsmasq: reply <a href="http://qq.com">qq.com</a> is 183.3.226.35<br>dnsmasq: query[A] <a href="http://www.qq.com">www.qq.com</a> from 127.0.0.1<br>compares: 7<br>dnsmasq: forwarded <a href="http://www.qq.com">www.qq.com</a> to 114.114.114.114<br>dnsmasq: reply <a href="http://www.qq.com">www.qq.com</a> is <CNAME><br>dnsmasq: reply <a href="http://ins-r23tsuuf.ias.tencent-cloud.net">ins-r23tsuuf.ias.tencent-cloud.net</a> is 121.14.77.201<br>dnsmasq: reply <a href="http://ins-r23tsuuf.ias.tencent-cloud.net">ins-r23tsuuf.ias.tencent-cloud.net</a> is 121.14.77.221<br><br>I added a line to print qdomain.<br><br>// domain-match.c around line 180<br>if (leading_dot)<br>{<br>    leading_dot = 0;<br>    crop_query--;<br>}<br>qdomain += crop_query;<br>printf("qdomain=%s\n", qdomain);<br><br>When I got qdomain="<a href="http://qq.com">qq.com</a>", the actual print result is "<a href="http://q.com">q.com</a>", I guess it should be ".com" or "com".<br><br>Any idea to fix it?<br><br>Regards,<br>Xingcong Li<br></div>
</div>