summaryrefslogtreecommitdiff
path: root/src/net/dnsconfig_unix.go
Commit message (Collapse)AuthorAgeFilesLines
* net: permit use of Resolver.PreferGo, netgo on Windows and Plan 9Brad Fitzpatrick2022-05-301-35/+1
| | | | | | | | | | | | | | | | This reverts commit CL 401754 (440c9312c8) which reverted CL 400654, thus reapplying CL 400654, re-adding the func init() { netGo = true } to cgo_stub.go CL 400654 had originally removed (mistakenly during development?) that had broken the darwin nocgo builder. Fixes #33097 Change-Id: I90f59746d2ceb6b5d2bd832c9fc90068f8ff7417 Reviewed-on: https://go-review.googlesource.com/c/go/+/409234 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Keith Randall <khr@google.com>
* Revert "net: permit use of Resolver.PreferGo, netgo on Windows and Plan 9"Bryan Mills2022-04-221-1/+35
| | | | | | | | | | | | | | | This reverts CL 400654. Reason for revert: broke net.TestGoLookupIP on the darwin-amd64-nocgo builder. Updates #33097. Change-Id: Idaf94eda88c9d4401e667a4d31c00ce376d91909 Reviewed-on: https://go-review.googlesource.com/c/go/+/401754 Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
* net: permit use of Resolver.PreferGo, netgo on Windows and Plan 9Brad Fitzpatrick2022-04-221-35/+1
| | | | | | | | | | | | | Fixes #33097 Change-Id: I2e55c7c113683814521f2068e0922b63c62ea5d8 Reviewed-on: https://go-review.googlesource.com/c/go/+/400654 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Damien Neil <dneil@google.com> Auto-Submit: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
* all: use new "unix" build tag where appropriateIan Lance Taylor2022-03-291-1/+1
| | | | | | | | | | For #20322 For #51572 Change-Id: Id0b4799d097d01128e98ba4cc0092298357bca45 Reviewed-on: https://go-review.googlesource.com/c/go/+/389935 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
* all: go fix -fix=buildtag std cmd (except for bootstrap deps, vendor)Russ Cox2021-10-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | When these packages are released as part of Go 1.18, Go 1.16 will no longer be supported, so we can remove the +build tags in these files. Ran go fix -fix=buildtag std cmd and then reverted the bootstrapDirs as defined in src/cmd/dist/buildtool.go, which need to continue to build with Go 1.4 for now. Also reverted src/vendor and src/cmd/vendor, which will need to be updated in their own repos first. Manual changes in runtime/pprof/mprof_test.go to adjust line numbers. For #41184. Change-Id: Ic0f93f7091295b6abc76ed5cd6e6746e1280861e Reviewed-on: https://go-review.googlesource.com/c/go/+/344955 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
* all: go fmt std cmd (but revert vendor)Russ Cox2021-02-201-0/+1
| | | | | | | | | | | | | | | | Make all our package sources use Go 1.17 gofmt format (adding //go:build lines). Part of //go:build change (#41184). See https://golang.org/design/draft-gobuild Change-Id: Ia0534360e4957e58cd9a18429c39d0e32a6addb4 Reviewed-on: https://go-review.googlesource.com/c/go/+/294430 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: use DNS over TCP when use-vc is set in resolv.confjfbus2019-04-181-0/+9
| | | | | | | | | | | | | | | | | | 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>
* net: support single-request resolv.conf option in pure Go resolverjfbus2019-04-171-11/+19
| | | | | | | | | | | | | | | | | | There is a DNS resolution issue in Kubernetes (UDP response packets get dropped due to a race in conntrack between the parallel A and AAAA queries, causing timeouts in DNS queries). A workaround is to enable single-request / single-request-reopen in resolv.conf in order to use sequential A and AAAA queries instead of parallel queries. With this PR, the pure Go resolver searches for "single-request" and "single-request-reopen" in resolv.conf and send A and AAAA queries sequentially when found. Fixes #29644 Change-Id: I906b3484008c1b9adf2e3e9241ea23767e29df59 GitHub-Last-Rev: d481acfb4c49d82fd474078b31a1a4697b57dadf GitHub-Pull-Request: golang/go#29661 Reviewed-on: https://go-review.googlesource.com/c/go/+/157377 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: add AIX operating systemClément Chigot2018-10-101-1/+1
| | | | | | | | | | | | | This commit adds AIX operating system to net package for ppc64 architecture. Updates: #25893 Change-Id: I46bbc7b03931019beb969443cb3f9a756956c66c Reviewed-on: https://go-review.googlesource.com/c/138724 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: use internal/bytealg insetad of linkname tricksIlya Tocar2018-08-211-1/+2
| | | | | | | | | | | | | | We are currently using go:linkname for some algorithms from strings/bytes packages, to avoid importing strings/bytes. But strings/bytes are just wrappers around internal/bytealg, so we should use internal/bytealg directly. Change-Id: I2836f779b88bf8876d5fa725043a6042bdda0390 Reviewed-on: https://go-review.googlesource.com/130515 Run-TryBot: Ilya Tocar <ilya.tocar@intel.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: parse IPv6 address with zone using DefaultResolver.Lookup{Host,IPAddr}Michael Fraenkel2018-06-271-1/+1
| | | | | | | | | | | | | | Allow a zone to be included with the ip address that is parsed when using DefaultResolver's LookupHost or LookupIPAddr Fixes #20790 Fixes #20767 Change-Id: I4e0baf9ade6a095af10a1b85ca6216788ba680ae Reviewed-on: https://go-review.googlesource.com/79935 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* all: update comment URLs from HTTP to HTTPS, where possibleTim Cooper2018-06-011-1/+1
| | | | | | | | | | Each URL was manually verified to ensure it did not serve up incorrect content. Change-Id: I4dc846227af95a73ee9a3074d0c379ff0fa955df Reviewed-on: https://go-review.googlesource.com/115798 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org>
* net: respect resolv.conf rotate optionDan Peterson2016-09-171-0/+13
| | | | | | | | | | | | | | | Instead of ranging over servers in the config, grab an offset from the config that is used to determine indices. When the rotate option is enabled, the offset increases which rotates queries through servers. Otherwise, it is always 0 which uses servers in config order. Fixes #17126 Change-Id: If233f6de7bfa42f88570055b9ab631be08a76b3e Reviewed-on: https://go-review.googlesource.com/29233 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* net: use libresolv rules for ndots range and validationDan Peterson2016-08-171-2/+4
| | | | | | | | | | | | | | | BIND libresolv allows values from 0 to 15. For invalid values and negative numbers, 0 is used. For numbers greater than 15, 15 is used. Fixes #15419 Change-Id: I1009bc119c3e87919bcb55a80a35532e9fc3ba52 Reviewed-on: https://go-review.googlesource.com/24901 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: simplify internal dtoi and xtoi funcsDan Peterson2016-08-171-3/+3
| | | | | | | | | | | | | Callers pass strings sliced as necessary instead of giving an offset. Fixes #16350 Change-Id: I7ba896f6ff09e0fd0094ca6c5af5d9a81622f15e Reviewed-on: https://go-review.googlesource.com/27206 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: ensure dnsConfig search list is rootedMatthew Dempsky2016-04-281-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Avoids some extra work and string concatenation at query time. benchmark old allocs new allocs delta BenchmarkGoLookupIP-32 154 150 -2.60% BenchmarkGoLookupIPNoSuchHost-32 446 442 -0.90% BenchmarkGoLookupIPWithBrokenNameServer-32 564 568 +0.71% benchmark old bytes new bytes delta BenchmarkGoLookupIP-32 10824 10704 -1.11% BenchmarkGoLookupIPNoSuchHost-32 43140 42992 -0.34% BenchmarkGoLookupIPWithBrokenNameServer-32 46616 46680 +0.14% BenchmarkGoLookupIPWithBrokenNameServer's regression appears to be because it's actually only performing 1 LookupIP call, so the extra work done parsing the DNS config file doesn't amortize as well as for BenchmarkGoLookupIP or BenchmarkGoLOokupIPNoSuchHost, which perform 2000+ LookupIP calls per run. Update #15473. Change-Id: I98c8072f2f39e2f2ccd6c55e9e9bd309f5ad68f8 Reviewed-on: https://go-review.googlesource.com/22571 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: append ":53" to DNS servers when reading resolv.confMatthew Dempsky2016-04-281-4/+4
| | | | | | | | | | | | | | | | | | | | | Avoids generating some redundant garbage from re-concatenating the same string for every DNS query. benchmark old allocs new allocs delta BenchmarkGoLookupIP-32 156 154 -1.28% BenchmarkGoLookupIPNoSuchHost-32 456 446 -2.19% BenchmarkGoLookupIPWithBrokenNameServer-32 577 564 -2.25% benchmark old bytes new bytes delta BenchmarkGoLookupIP-32 10873 10824 -0.45% BenchmarkGoLookupIPNoSuchHost-32 43303 43140 -0.38% BenchmarkGoLookupIPWithBrokenNameServer-32 46824 46616 -0.44% Update #15473. Change-Id: I3b0173dfedf31bd08eaea1069968b416850864a1 Reviewed-on: https://go-review.googlesource.com/22556 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: change type of dnsConfig.timeout from int to time.DurationDan Peterson2016-04-281-12/+12
| | | | | | | | | | | | Instead of keeping the desired number of seconds and converting to time.Duration for every query, convert to time.Duration when building the config. Updates #15473 Change-Id: Ib24c050b593b3109011e359f4ed837a3fb45dc65 Reviewed-on: https://go-review.googlesource.com/22548 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: search domain from hostname if no search directivesDan Peterson2016-04-271-4/+25
| | | | | | | | | | | Fixes #14897 Change-Id: Iffe7462983a5623a37aa0dc6f74c8c70e10c3244 Reviewed-on: https://go-review.googlesource.com/21464 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* all: single space after period.Brad Fitzpatrick2016-03-021-1/+1
| | | | | | | | | | | | | | | | | | | | The tree's pretty inconsistent about single space vs double space after a period in documentation. Make it consistently a single space, per earlier decisions. This means contributors won't be confused by misleading precedence. This CL doesn't use go/doc to parse. It only addresses // comments. It was generated with: $ perl -i -npe 's,^(\s*// .+[a-z]\.) +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.) +([A-Z])') $ go test go/doc -update Change-Id: Iccdb99c37c797ef1f804a94b22ba5ee4b500c4f7 Reviewed-on: https://go-review.googlesource.com/20022 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Dave Day <djd@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: fix race in (*resolverConfig).tryUpdateMatthew Dempsky2016-02-201-9/+19
| | | | | | | | | Fixes #14072. Change-Id: Ie31caa06690ac621906fc5acd34da2efa4e2049f Reviewed-on: https://go-review.googlesource.com/18860 Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com> Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
* net: make go DNS use localhost if resolv.conf is missing or emptyAlex A Skinner2015-04-301-7/+15
| | | | | | | | | | | | | | | Per resolv.conf man page, "If this file does not exist, only the name server on the local machine will be queried." This behavior also occurs if file is present but unreadable, or if no nameservers are listed. Fixes #10566 Change-Id: Id5716da0eae534d5ebfafea111bbc657f302e307 Reviewed-on: https://go-review.googlesource.com/9380 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: use Go's DNS resolver when system configuration permitsBrad Fitzpatrick2015-04-231-8/+24
| | | | | | | | | | | | | | | | | If the machine's network configuration files (resolv.conf, nsswitch.conf) don't have any unsupported options, prefer Go's DNS resolver, which doesn't have the cgo & thread over. It means users can have more than 500 DNS requests outstanding (our current limit for cgo lookups) and not have one blocked thread per outstanding request. Discussed in thread https://groups.google.com/d/msg/golang-dev/2ZUi792oztM/Q0rg_DkF5HMJ Change-Id: I3f685d70aff6b47bec30b63e9fba674b20507f95 Reviewed-on: https://go-review.googlesource.com/8945 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
* net: separate NaCl dependent placeholders from BSD'sMikio Hara2014-09-181-1/+1
| | | | | | | | | To clarify the dependency of NaCl platform. LGTM=adg R=golang-codereviews, adg CC=golang-codereviews https://golang.org/cl/143830044
* build: move package sources from src/pkg to srcRuss Cox2014-09-081-0/+96
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.