]> Cypherpunks repositories - gostls13.git/commitdiff
net: disable "tcp" test on openbsd
authorJoel Sing <jsing@google.com>
Fri, 26 Aug 2011 19:38:02 +0000 (15:38 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 26 Aug 2011 19:38:02 +0000 (15:38 -0400)
Doing a socket/listen on an unspecified address with an unspecified
address family is likely to result in an AF_INET6 socket on an IPv6
capable system, which under OpenBSD means IPv6 only - not IPv4 *and*
IPv6. In this case trying to connect to this socket from an IPv4
loopback address is not going to end well.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4807057

src/pkg/net/server_test.go
src/pkg/net/tcpsock_posix.go

index 7d7f7fc01c444f4e5316bdbb45745ab4d56bdd66..a2ff218e7089e75991523ac3282e7c3e50e575d0 100644 (file)
@@ -115,7 +115,9 @@ func doTest(t *testing.T, network, listenaddr, dialaddr string) {
 }
 
 func TestTCPServer(t *testing.T) {
-       doTest(t, "tcp", "", "127.0.0.1")
+       if syscall.OS != "openbsd" {
+               doTest(t, "tcp", "", "127.0.0.1")
+       }
        doTest(t, "tcp", "0.0.0.0", "127.0.0.1")
        doTest(t, "tcp", "127.0.0.1", "127.0.0.1")
        doTest(t, "tcp4", "", "127.0.0.1")
index f01c380c464c889e16eee2f9b42d0c3ecb1c6bf3..f2e9197027670b6db6c59bf008493c5cb28e23da 100644 (file)
@@ -12,6 +12,11 @@ import (
        "syscall"
 )
 
+// BUG(rsc): On OpenBSD, listening on the "tcp" network does not listen for
+// both IPv4 and IPv6 connections. This is due to the fact that IPv4 traffic
+// will not be routed to an IPv6 socket - two separate sockets are required
+// if both AFs are to be supported. See inet6(4) on OpenBSD for details.
+
 func sockaddrToTCP(sa syscall.Sockaddr) Addr {
        switch sa := sa.(type) {
        case *syscall.SockaddrInet4: