|
1 From 308bdd0256acdc66ef20d4efd7cd41817674771d Mon Sep 17 00:00:00 2001 |
|
2 From: Tom Wilkie <[email protected]> |
|
3 Date: Wed, 17 Aug 2016 10:13:03 +0100 |
|
4 Subject: [PATCH 07/38] [release-branch.go1.7] net: don't avoid resolving |
|
5 .local addresses |
|
6 |
|
7 .local addresses are used by things like Kubernetes and Weave DNS; Go |
|
8 should not avoid resolving them. |
|
9 |
|
10 This is a partial revert of https://golang.org/cl/21328 which was too |
|
11 strict of an interpretation of RFC 6762. |
|
12 |
|
13 Fixes #16739 |
|
14 |
|
15 Change-Id: I349415b4eab5d61240dd18217bd95dc7d2105cd5 |
|
16 Reviewed-on: https://go-review.googlesource.com/27250 |
|
17 Reviewed-by: Brad Fitzpatrick <[email protected]> |
|
18 Run-TryBot: Brad Fitzpatrick <[email protected]> |
|
19 TryBot-Result: Gobot Gobot <[email protected]> |
|
20 Reviewed-on: https://go-review.googlesource.com/28632 |
|
21 --- |
|
22 src/net/dnsclient_unix.go | 7 ++++--- |
|
23 src/net/dnsclient_unix_test.go | 9 +++++---- |
|
24 2 files changed, 9 insertions(+), 7 deletions(-) |
|
25 |
|
26 diff --git a/src/net/dnsclient_unix.go b/src/net/dnsclient_unix.go |
|
27 index 8f2dff4..d12944c 100644 |
|
28 --- a/src/net/dnsclient_unix.go |
|
29 +++ b/src/net/dnsclient_unix.go |
|
30 @@ -338,8 +338,9 @@ func lookup(ctx context.Context, name string, qtype uint16) (cname string, rrs [ |
|
31 } |
|
32 |
|
33 // avoidDNS reports whether this is a hostname for which we should not |
|
34 -// use DNS. Currently this includes only .onion and .local names, |
|
35 -// per RFC 7686 and RFC 6762, respectively. See golang.org/issue/13705. |
|
36 +// use DNS. Currently this includes only .onion, per RFC 7686. See |
|
37 +// golang.org/issue/13705. Does not cover .local names (RFC 6762), |
|
38 +// see golang.org/issue/16739. |
|
39 func avoidDNS(name string) bool { |
|
40 if name == "" { |
|
41 return true |
|
42 @@ -347,7 +348,7 @@ func avoidDNS(name string) bool { |
|
43 if name[len(name)-1] == '.' { |
|
44 name = name[:len(name)-1] |
|
45 } |
|
46 - return stringsHasSuffixFold(name, ".onion") || stringsHasSuffixFold(name, ".local") |
|
47 + return stringsHasSuffixFold(name, ".onion") |
|
48 } |
|
49 |
|
50 // nameList returns a list of names for sequential DNS queries. |
|
51 diff --git a/src/net/dnsclient_unix_test.go b/src/net/dnsclient_unix_test.go |
|
52 index 09bbd48..c953c1e 100644 |
|
53 --- a/src/net/dnsclient_unix_test.go |
|
54 +++ b/src/net/dnsclient_unix_test.go |
|
55 @@ -112,10 +112,11 @@ func TestAvoidDNSName(t *testing.T) { |
|
56 {"foo.ONION", true}, |
|
57 {"foo.ONION.", true}, |
|
58 |
|
59 - {"foo.local.", true}, |
|
60 - {"foo.local", true}, |
|
61 - {"foo.LOCAL", true}, |
|
62 - {"foo.LOCAL.", true}, |
|
63 + // But do resolve *.local address; Issue 16739 |
|
64 + {"foo.local.", false}, |
|
65 + {"foo.local", false}, |
|
66 + {"foo.LOCAL", false}, |
|
67 + {"foo.LOCAL.", false}, |
|
68 |
|
69 {"", true}, // will be rejected earlier too |
|
70 |
|
71 -- |
|
72 2.7.4 |
|
73 |