alex-sector / dns2tcp

GNU General Public License v2.0
178 stars 56 forks source link

Satisfy some public resolvers by replying with SERVFAIL to unparsed requests #5

Open v0s opened 1 year ago

v0s commented 1 year ago

TL;DR—fixes some recursive resolvers not working with dns2tcp.

A couple of popular public resolvers (e.g. Cloudflare 1.1.1.1, Yandex 77.88.8.8) don't actually adhere to forwarding client's DNS requests.

For example, on requesting TXT AAAAAIoRAA.=auth.your-dns2tcp-domain.com. they sometimes go and try to resolve A =auth.your-dns2tcp-domain.com. dns2tcpd currently just ignores those requests, which makes the recursive resolver to just timeout and return with SERVFAIL.

This patch makes dns2tcpd respond with SERVFAIL to unparsed requests. In this case, recursive resolver receives the reply, and re-requests the actual TXT that the client was asking it in the first place.