]> Cypherpunks repositories - gostls13.git/commitdiff
net: put [ ] around IPv6 addresses for Dial
authorRuss Cox <rsc@golang.org>
Thu, 4 Mar 2010 01:30:39 +0000 (17:30 -0800)
committerRuss Cox <rsc@golang.org>
Thu, 4 Mar 2010 01:30:39 +0000 (17:30 -0800)
Update #538.

R=r
CC=golang-dev
https://golang.org/cl/229045

src/pkg/net/dnsconfig.go

index 7d098583df262763d7d65ba6b583ddaa51a980c9..4be207603cf20d583c66b974691f4409398f3fa4 100644 (file)
@@ -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