]> Cypherpunks repositories - gostls13.git/commit
net: use DNS over TCP when use-vc is set in resolv.conf
authorjfbus <jf@bustarret.com>
Thu, 18 Apr 2019 12:39:24 +0000 (12:39 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 18 Apr 2019 18:51:13 +0000 (18:51 +0000)
commit825ff1e3171a97fba1f29473d0be484ebfdc08b4
treee6279276986c5e2c31b92970a222fb7e0a6c2019
parente900964e0f2709fe9ac5d4c8f760c3398ec0bbbd
net: use DNS over TCP when use-vc is set in resolv.conf

There is a DNS resolution bug in Kubernetes (UDP response packets get dropped by conntrack, causing timeouts in DNS queries).

The recommended workaround on Linux is to configure the resolver to use TCP for DNS queries, by setting the use-vc option in resolv.conf.

With this PR, the pure Go resolver searches for "use-vc" in resolv.conf and switches to TCP when found.

Fixes #29358

Change-Id: I26b935cae2c80e5bb9955da83299a8dea84591de
GitHub-Last-Rev: 70bc00fe41f44f0b2b3cfebe67bbcc45701968cf
GitHub-Pull-Request: golang/go#29594
Reviewed-on: https://go-review.googlesource.com/c/go/+/156366
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/dnsclient_unix.go
src/net/dnsclient_unix_test.go
src/net/dnsconfig_unix.go
src/net/dnsconfig_unix_test.go
src/net/testdata/freebsd-usevc-resolv.conf [new file with mode: 0644]
src/net/testdata/linux-use-vc-resolv.conf [new file with mode: 0644]
src/net/testdata/openbsd-tcp-resolv.conf [new file with mode: 0644]