diff options
author | Russ Cox <rsc@golang.org> | 2009-05-07 10:31:48 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-05-07 10:31:48 -0700 |
commit | c836acdeb6033fe96fa7c2fe6e290817a2256c26 (patch) | |
tree | 9850b587c6ccde87d493b0bdb1f42c6d30e89da2 /src/lib/syscall/socket_darwin.go | |
parent | 6c5d53ca44c96df1825d8ab9c5cd4382afcf8e8b (diff) | |
download | golang-c836acdeb6033fe96fa7c2fe6e290817a2256c26.tar.gz |
next step for 6.out on Borg: fix and test
net code on IPv4-only machines.
R=r
DELTA=27 (25 added, 0 deleted, 2 changed)
OCL=28404
CL=28411
Diffstat (limited to 'src/lib/syscall/socket_darwin.go')
-rw-r--r-- | src/lib/syscall/socket_darwin.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/syscall/socket_darwin.go b/src/lib/syscall/socket_darwin.go index dc76b9bea..ba640e956 100644 --- a/src/lib/syscall/socket_darwin.go +++ b/src/lib/syscall/socket_darwin.go @@ -12,12 +12,19 @@ import ( "unsafe"; ) +// For testing: clients can set this flag to force +// creation of IPv6 sockets to return EAFNOSUPPORT. +var SocketDisableIPv6 bool + func SockaddrToSockaddrInet4(s *Sockaddr) *SockaddrInet4; func SockaddrToSockaddrInet6(s *Sockaddr) *SockaddrInet6; func SockaddrInet4ToSockaddr(s *SockaddrInet4) *Sockaddr; func SockaddrInet6ToSockaddr(s *SockaddrInet6) *Sockaddr; func Socket(domain, proto, typ int64) (ret int64, err int64) { + if domain == AF_INET6 && SocketDisableIPv6 { + return -1, EAFNOSUPPORT + } r1, r2, e := Syscall(SYS_SOCKET, domain, proto, typ); return r1, e } |