<div dir="ltr"><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Hi,<div><br></div><div>TLDR: DNS request to dnsmasq with upper-case domain is handled differently if request is sent over TCP vs UDP</div><div><br></div><div>I run a server to forward "cluster.local" queries to another process:</div><div>/usr/sbin/dnsmasq-k--cache-size=1000--no-negcache--dns-forward-max=1500--log-facility=---server=/cluster.local/<a href="http://127.0.0.1/#10053--log-queries=extra--log-debug" target="_blank">127.0.0.1#10053--log-queries=extra--log-debug</a><br></div><div><br></div><div>dnsmasq 2.86 with IP 10.64.0.7<br></div><div><br></div><div>1. When I run: <br>dig +tcp kubernetes.default.svc.cluster.LOCAL @<a href="http://10.64.0.7/" target="_blank">10.64.0.7</a><br></div><div><br></div><div>I get NOERROR but no data in the response. dnsmasq logs:</div><div>I0913 06:15:04.790606       1 nanny.go:146] dnsmasq[86]: 44065 <a href="http://10.64.1.4/33015" target="_blank">10.64.1.4/33015</a> query[A] kubernetes.default.svc.CLUSTER.LOCAL from 10.64.1.4<br>I0913 06:15:04.851065       1 nanny.go:146] dnsmasq[86]: 44065 <a href="http://10.64.1.4/33015" target="_blank">10.64.1.4/33015</a> forwarded kubernetes.default.svc.CLUSTER.LOCAL to 169.254.169.254<br></div><div><br></div><div>As you can see dnsmasq doesn't modify the domain. Because it's a "CLUSTER.LOCAL" and not a "cluster.local" it's forwarded to the server 169.254.169.254 set in the /etc/resolv.conf. And not the --server=/cluster.local/<a href="http://127.0.0.1/#10053" target="_blank">127.0.0.1#10053</a></div><div><br></div><div>2. When I run exactly the same query but over UDP not TCP:<br>dig kubernetes.default.svc.CLUSTER.LOCAL @<a href="http://10.64.0.7/" target="_blank">10.64.0.7</a><br><br>I get NOERROR and correct response:</div><div>kubernetes.default.svc.CLUSTER.LOCAL. 30 IN A   10.68.0.1<br></div><div><br></div><div>dnsmasq logs in this case:</div><div>I0913 06:19:20.820425       1 nanny.go:146] dnsmasq[11]: 44471 <a href="http://10.64.1.4/49622" target="_blank">10.64.1.4/49622</a> query[A] kubernetes.default.svc.CLUSTER.LOCAL from 10.64.1.4<br>I0913 06:19:20.820866       1 nanny.go:146] dnsmasq[11]: 44471 <a href="http://10.64.1.4/49622" target="_blank">10.64.1.4/49622</a> forwarded kubernetes.default.svc.cluster.local to 127.0.0.1<br></div><div><br></div><div>In this case the domain in the query is changed to the lower-case and it matches "cluster.local" and forwards to 127.0.0.1 as expected.</div><div><br></div><div>3. When I run exactly the same query over TCP but fully lower-case it works as well.</div><div><br></div><div>Is this a bug or intended behaviour or maybe I misunderstood the logs?</div><div>Thanks!</div></div></div></div>