summaryrefslogtreecommitdiff
path: root/src/net/cgo_unix.go
Commit message (Collapse)AuthorAgeFilesLines
* all: remove os.ErrTimeoutDamien Neil2019-08-021-9/+0
| | | | | | | | | | | | | | It is unclear whether the current definition of os.IsTimeout is desirable or not. Drop ErrTimeout for now so we can consider adding it (or some other error) in a future release with a corrected definition. Fixes #33411 Change-Id: I8b880da7d22afc343a08339eb5f0efd1075ecafe Reviewed-on: https://go-review.googlesource.com/c/go/+/188758 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* all: remove os.ErrTemporaryDamien Neil2019-08-011-2/+0
| | | | | | | | | | | | | | | | | | | | As discussed in https://github.com/golang/go/issues/32463#issuecomment-506833421 the classification of deadline-based timeouts as "temporary" errors is a historical accident. I/O timeouts used to be duration-based, so they really were temporary--retrying a timed-out operation could succeed. Now that they're deadline-based, timeouts aren't temporary unless you reset the deadline. Drop ErrTemporary from Go 1.13, since its definition is wrong. We'll consider putting it back in Go 1.14 with a clear definition and deprecate net.OpError.Temporary. Fixes #32463 Change-Id: I70cda664590d8872541e17409a5780da76920891 Reviewed-on: https://go-review.googlesource.com/c/go/+/188398 Reviewed-by: Jonathan Amsterdam <jba@google.com>
* all: add Unwrap and Is methods to various error typesDamien Neil2019-05-041-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add Unwrap methods to types which wrap an underlying error: "encodinc/csv".ParseError "encoding/json".MarshalerError "net/http".transportReadFromServerError "net".OpError "net".DNSConfigError "net/url".Error "os/exec".Error "signal/internal/pty".PtyError "text/template".ExecError Add os.ErrTemporary. A case could be made for putting this error value in package net, since no exported error types in package os include a Temporary method. However, syscall errors returned from the os package do include this method. Add Is methods to error types with a Timeout or Temporary method, making errors.Is(err, os.Err{Timeout,Temporary}) equivalent to testing the corresponding method: "context".DeadlineExceeded "internal/poll".TimeoutError "net".adrinfoErrno "net".OpError "net".DNSError "net/http".httpError "net/http".tlsHandshakeTimeoutError "net/pipe".timeoutError "net/url".Error Updates #30322 Updates #29934 Change-Id: I409fb20c072ea39116ebfb8c7534d493483870dc Reviewed-on: https://go-review.googlesource.com/c/go/+/170037 Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
* net: set DNSError.IsTemporary from addrinfoErrno errorsMichael Vogt2019-05-011-3/+9
| | | | | | | | | | | | Today it is not possible (AFAICT) to detect if a DNSError if of type EAI_AGAIN, i.e. if it is something temporary that should be retried. This information is available inside addrinfoErrno but when the DNSError is created this information is lost. This PR fixes this so that the addinfoErrno.Temporary information is added to DNSError as well. With that a user who gets a DNSError can check now is its a temporary error (for errors that resulted from a addrinfoErrno this is EAI_AGAIN). Change-Id: I64badb2ebd904e41fc2e0755416f7f32560534d8 GitHub-Last-Rev: ced7238a6597039fb23f36f372bd1cf33d60d4a6 GitHub-Pull-Request: golang/go#31676 Reviewed-on: https://go-review.googlesource.com/c/go/+/174557 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: add IsNotFound field to DNSErrorShubham Sharma2019-04-231-1/+4
| | | | | | | | | | | | | | This adds the ability to determine if a lookup error was due to a non-existent hostname. Previously users needed to do string matching on the DNSError.Err value. Fixes #28635 Change-Id: If4bd3ad32cbc2db5614f2c6b72e0a9161d813efa Reviewed-on: https://go-review.googlesource.com/c/go/+/168597 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: allow build on aix/ppc64 with cgoClément Chigot2019-03-191-1/+6
| | | | | | | | | | This commit adds C support for net package for aix/ppc64. Change-Id: I704710991fc013c6ec3511671def6791df4854f1 Reviewed-on: https://go-review.googlesource.com/c/go/+/164038 Run-TryBot: Mikio Hara <mikioh.public.networking@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Mikio Hara <mikioh.public.networking@gmail.com>
* net: make cgo resolver work more accurately with network parameterEugene Kalinin2018-10-251-16/+21
| | | | | | | | | | | | | | | | | | | Unlike the go resolver, the existing cgo resolver exchanges both DNS A and AAAA RR queries unconditionally and causes unreasonable connection setup latencies to applications using the cgo resolver. This change adds new argument (`network`) in all functions through the series of calls: from Resolver.internetAddrList to cgoLookupIPCNAME. Benefit: no redundant DNS calls if certain IP version is used IPv4/IPv6 (no `AAAA` DNS requests if used tcp4, udp4, ip4 network. And vice versa: no `A` DNS requests if used tcp6, udp6, ip6 network) Fixes #25947 Change-Id: I39edbd726d82d6133fdada4d06cd90d401e7e669 Reviewed-on: https://go-review.googlesource.com/c/120215 Reviewed-by: Brad Fitzpatrick <bradfitz@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>
* {net,os/user,plugin}: eliminate unnecessary C round-tripsBryan C. Mills2017-08-171-11/+9
| | | | | | | | | | | | We're making two extra round-trips to C to malloc and free strings that originate in Go and don't escape. Skip those round-trips by allocating null-terminated slices in Go memory instead. Change-Id: I9e4c5ad999a7924ba50b82293c52073ec75518be Reviewed-on: https://go-review.googlesource.com/56530 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: make zone helpers into methods of ipv6ZoneCacheMikio Hara2017-04-281-2/+2
| | | | | | | | Change-Id: Id93e78f0c8bef125f124a0a919053208e24a63cd Reviewed-on: https://go-review.googlesource.com/41836 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: make LookupPort and lookupProtocol work on naclBrad Fitzpatrick2016-09-111-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | Also, flesh out the baked-in /etc/services table for LookupPort a bit. This services map moves from a unix-specific file to a portable file where nacl can use it. Also, remove the duplicated entries in the protocol map in different cases, and just canonicalize the input before looking in the map. Now it handles any case, including MiXeD cAse. In the process, add a test that service names for LookupPort are case insensitive. They were on Windows, but not cgo. Now there's a test and they're case insensitive in all 3+ paths. Maybe it breaks plan9. We'll see. Fixes #17045 Change-Id: Idce7d68703f371727c7505cda03a32bd842298cd Reviewed-on: https://go-review.googlesource.com/28951 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Minux Ma <minux@golang.org>
* net: use contexts for cgo-based DNS resolutionScott Bell2016-05-101-29/+107
| | | | | | | | | | | | | | Although calls to getaddrinfo can't be portably interrupted, we still benefit from more granular resource management by pushing the context downwards. Fixes #15321 Change-Id: I5506195fc6493080410e3d46aaa3fe02018a24fe Reviewed-on: https://go-review.googlesource.com/22961 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* all: make copyright headers consistent with one space after periodBrad Fitzpatrick2016-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | This is a subset of https://golang.org/cl/20022 with only the copyright header lines, so the next CL will be smaller and more reviewable. Go policy has been single space after periods in comments for some time. The copyright header template at: https://golang.org/doc/contribute.html#copyright also uses a single space. Make them all consistent. Change-Id: Icc26c6b8495c3820da6b171ca96a74701b4a01b0 Reviewed-on: https://go-review.googlesource.com/20111 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: fix parsing literal IPv6 address with zone identifier when using cgoMikio Hara2015-12-041-4/+8
| | | | | | | | | | | | | Parsing literal IPv6 address with zone identifier is already supported when not using cgo. This change enables it when using cgo too. Fixes #12241. Change-Id: I3ed78c9e750e75eff0dae76ba8608df39503cf85 Reviewed-on: https://go-review.googlesource.com/17215 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* net: force LookupAddr results to be rooted DNS paths even in the case of ↵Mikio Hara2015-11-281-6/+1
| | | | | | | | | | | | | | | | | local source The builtin name resolver using various resolution techniques is a bit complicated and we sometimes fotget to take care of all the go and cgo code paths and exchanging information to local and remote sources. This change makes LookupAddr return absolute domain names even in the case of local source. Updates #12189. Fixes #12240. Change-Id: Icdd3375bcddc7f5d4d3b24f134d93815073736fc Reviewed-on: https://go-review.googlesource.com/17216 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: force LookupAddr results to be rooted DNS paths when using cgoRuss Cox2015-08-191-0/+5
| | | | | | | | | | | | | | | | | | | | Go 1.4 and before have always returned DNS names with a trailing dot for reverse lookups, as they do for basically all other routines returning DNS names. Go 1.4 and before always implemented LookupAddr using pure Go (not C library calls). Go 1.5 added the ability to make a C library call to implement LookupAddr. Unfortunately the C library call returns a DNS name without a trailing dot (an unrooted name), meaning that if turn off cgo during make.bash then you still get the rooted name but with cgo on you get an unrooted name. The unrooted name is inconsistent with the pure Go implementation and with all previous Go releases, so change it to a rooted name. Fixes #12189. Change-Id: I3d6b72277c121fe085ea6af30e5fe8019fc490ad Reviewed-on: https://go-review.googlesource.com/13697 Reviewed-by: Rob Pike <r@golang.org>
* net: allow LookupAddr to use getnameinfo when cgo is enabledMikio Hara2015-06-171-0/+66
| | | | | | | | | | | This change allows LookupAddr to use getnameinfo through cgo for working together with various name services other than DNS. Fixes #7855. Change-Id: I5b3b4aefe3d1b904541c3350865734d8cbb1c1c4 Reviewed-on: https://go-review.googlesource.com/3420 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: add cgo support for SolarisAram Hăvărneanu2015-05-061-1/+1
| | | | | | | Change-Id: Ib66bebd418d97f38956970f93e69aa41e7c55523 Reviewed-on: https://go-review.googlesource.com/8262 Reviewed-by: Minux Ma <minux@golang.org> Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
* net: fix inconsistent error values on LookupMikio Hara2015-04-211-8/+6
| | | | | | | | | | | This change fixes inconsistent error values on Lookup{Addr,CNAME,Host,IP.MX,NS,Port,SRV,TXT}. Updates #4856. Change-Id: I059bc8ffb96ee74dff8a8c4e8e6ae3e4a462a7ef Reviewed-on: https://go-review.googlesource.com/9108 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: clean up cgoMikio Hara2015-04-171-39/+54
| | | | | | | | | | | This change adds a type addrinfoErrno to represent getaddrinfo, getnameinfo-specific errors, and uses it in cgo-based lookup functions. Also retags cgo files for clarification and does minor cleanup. Change-Id: I6db7130ad7bf35bbd4e8839a97759e1364c43828 Reviewed-on: https://go-review.googlesource.com/9020 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: LookupHost and Resolve{TCP,UDP,IP}Addr should use zone from getaddrinfoAndrew Pilloud2015-03-081-4/+6
| | | | | | | | | | | | The unix and windows getaddrinfo calls return a zone with IPv6 addresses. IPv6 link-local addresses returned are only valid on the given zone. When the zone is dropped, connections to the address will fail. This patch replaces IP with IPAddr in several internal resolver functions, and plumbs through the zone. Change-Id: Ifea891654f586f15b76988464f82e04a42ccff6d Reviewed-on: https://go-review.googlesource.com/5851 Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
* build: move package sources from src/pkg to srcRuss Cox2014-09-081-0/+164
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.