Skip to content

Commit c63db15

Browse files
committed
net: handle "dns failure" as errNoSuchHost on Plan 9
CL 31468 added TestLookupNonLDH, which was failing on Plan 9, because LookupHost was expecting to return errNoSuchHost on DNS resolution failure, while Plan 9 returned the "dns failure" string. In the Plan 9 implementation of lookupHost, we now return errNoSuchHost instead of the "dns failure" string, so the behavior is more consistant with other operating systems. Fixes #17568. Change-Id: If64f580dc0626a4a4f19e5511ba2ca5daff5f789 Reviewed-on: https://go-review.googlesource.com/31873 Run-TryBot: David du Colombier <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 6e78f76 commit c63db15

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/net/lookup_plan9.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ func (*Resolver) lookupHost(ctx context.Context, host string) (addrs []string, e
122122
// host names in local network (e.g. from /lib/ndb/local)
123123
lines, err := queryCS(ctx, "net", host, "1")
124124
if err != nil {
125+
if stringsHasSuffix(err.Error(), "dns failure") {
126+
err = errNoSuchHost
127+
}
125128
return
126129
}
127130
loop:

0 commit comments

Comments
 (0)