From: Russ Cox Date: Thu, 4 Mar 2010 01:30:39 +0000 (-0800) Subject: net: put [ ] around IPv6 addresses for Dial X-Git-Tag: weekly.2010-03-04~2 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e53f7d8993b4fae1e2de425e5c87852803362bd2;p=gostls13.git net: put [ ] around IPv6 addresses for Dial Update #538. R=r CC=golang-dev https://golang.org/cl/229045 --- diff --git a/src/pkg/net/dnsconfig.go b/src/pkg/net/dnsconfig.go index 7d098583df..4be207603c 100644 --- a/src/pkg/net/dnsconfig.go +++ b/src/pkg/net/dnsconfig.go @@ -49,7 +49,11 @@ func _DNS_ReadConfig() (*_DNS_Config, os.Error) { // just an IP address. Otherwise we need DNS // to look it up. name := f[1] - if len(ParseIP(name)) != 0 { + switch len(ParseIP(name)) { + case 16: + name = "[" + name + "]" + fallthrough + case 4: a = a[0 : n+1] a[n] = name conf.servers = a