mirror of
https://github.com/golang/go.git
synced 2025-11-01 17:20:56 +00:00
net: add AIX operating system
This commit adds AIX operating system to net package for ppc64 architecture. Updates: #25893 Change-Id: I46bbc7b03931019beb969443cb3f9a756956c66c Reviewed-on: https://go-review.googlesource.com/c/138724 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
ceb0c371d9
commit
9ff11b0260
38 changed files with 240 additions and 37 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
// Minimal RFC 6724 address selection.
|
// Minimal RFC 6724 address selection.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
// DNS client: see RFC 1035.
|
// DNS client: see RFC 1035.
|
||||||
// Has to be linked into package net for Dial.
|
// Has to be linked into package net for Dial.
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
// Read system DNS config from /etc/resolv.conf
|
// Read system DNS config from /etc/resolv.conf
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd js linux netbsd openbsd solaris
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
165
src/net/interface_aix.go
Normal file
165
src/net/interface_aix.go
Normal file
|
|
@ -0,0 +1,165 @@
|
||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package net
|
||||||
|
|
||||||
|
import (
|
||||||
|
//"os"
|
||||||
|
"syscall"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
type RawSockaddrDatalink struct {
|
||||||
|
Len uint8
|
||||||
|
Family uint8
|
||||||
|
Index uint16
|
||||||
|
Type uint8
|
||||||
|
Nlen uint8
|
||||||
|
Alen uint8
|
||||||
|
Slen uint8
|
||||||
|
Data [120]byte
|
||||||
|
}
|
||||||
|
|
||||||
|
const _KINFO_RT_IFLIST = (0x1 << 8) | 3 | (1 << 30)
|
||||||
|
|
||||||
|
const _RTAX_NETMASK = 2
|
||||||
|
const _RTAX_IFA = 5
|
||||||
|
const _RTAX_MAX = 8
|
||||||
|
|
||||||
|
func getIfList() ([]byte, error) {
|
||||||
|
needed, err := syscall.Getkerninfo(_KINFO_RT_IFLIST, 0, 0, 0)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil // XXX
|
||||||
|
}
|
||||||
|
tab := make([]byte, needed)
|
||||||
|
_, err = syscall.Getkerninfo(_KINFO_RT_IFLIST, uintptr(unsafe.Pointer(&tab[0])), uintptr(unsafe.Pointer(&needed)), 0)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil // XXX
|
||||||
|
}
|
||||||
|
return tab[:needed], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the ifindex is zero, interfaceTable returns mappings of all
|
||||||
|
// network interfaces. Otherwise it returns a mapping of a specific
|
||||||
|
// interface.
|
||||||
|
func interfaceTable(ifindex int) ([]Interface, error) {
|
||||||
|
tab, err := getIfList()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var ift []Interface
|
||||||
|
for len(tab) > 0 {
|
||||||
|
ifm := (*syscall.IfMsgHdr)(unsafe.Pointer(&tab[0]))
|
||||||
|
if ifm.Msglen == 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if ifm.Type == syscall.RTM_IFINFO {
|
||||||
|
if ifindex == 0 || ifindex == int(ifm.Index) {
|
||||||
|
sdl := (*RawSockaddrDatalink)(unsafe.Pointer(&tab[syscall.SizeofIfMsghdr]))
|
||||||
|
|
||||||
|
ifi := &Interface{Index: int(ifm.Index), Flags: linkFlags(ifm.Flags)}
|
||||||
|
ifi.Name = string(sdl.Data[:sdl.Nlen])
|
||||||
|
ifi.HardwareAddr = sdl.Data[sdl.Nlen : sdl.Nlen+sdl.Alen]
|
||||||
|
/* XXX MTU? */
|
||||||
|
ift = append(ift, *ifi)
|
||||||
|
if ifindex == int(ifm.Index) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tab = tab[ifm.Msglen:]
|
||||||
|
}
|
||||||
|
|
||||||
|
return ift, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func linkFlags(rawFlags int32) Flags {
|
||||||
|
var f Flags
|
||||||
|
if rawFlags&syscall.IFF_UP != 0 {
|
||||||
|
f |= FlagUp
|
||||||
|
}
|
||||||
|
if rawFlags&syscall.IFF_BROADCAST != 0 {
|
||||||
|
f |= FlagBroadcast
|
||||||
|
}
|
||||||
|
if rawFlags&syscall.IFF_LOOPBACK != 0 {
|
||||||
|
f |= FlagLoopback
|
||||||
|
}
|
||||||
|
if rawFlags&syscall.IFF_POINTOPOINT != 0 {
|
||||||
|
f |= FlagPointToPoint
|
||||||
|
}
|
||||||
|
if rawFlags&syscall.IFF_MULTICAST != 0 {
|
||||||
|
f |= FlagMulticast
|
||||||
|
}
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the ifi is nil, interfaceAddrTable returns addresses for all
|
||||||
|
// network interfaces. Otherwise it returns addresses for a specific
|
||||||
|
// interface.
|
||||||
|
func interfaceAddrTable(ifi *Interface) ([]Addr, error) {
|
||||||
|
tab, err := getIfList()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var ifat []Addr
|
||||||
|
for len(tab) > 0 {
|
||||||
|
ifm := (*syscall.IfMsgHdr)(unsafe.Pointer(&tab[0]))
|
||||||
|
if ifm.Msglen == 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if ifm.Type == syscall.RTM_NEWADDR {
|
||||||
|
if ifi == nil || ifi.Index == int(ifm.Index) {
|
||||||
|
mask := ifm.Addrs
|
||||||
|
off := uint(syscall.SizeofIfMsghdr)
|
||||||
|
|
||||||
|
var iprsa, nmrsa *syscall.RawSockaddr
|
||||||
|
for i := uint(0); i < _RTAX_MAX; i++ {
|
||||||
|
if mask&(1<<i) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
rsa := (*syscall.RawSockaddr)(unsafe.Pointer(&tab[off]))
|
||||||
|
if i == _RTAX_NETMASK {
|
||||||
|
nmrsa = rsa
|
||||||
|
}
|
||||||
|
if i == _RTAX_IFA {
|
||||||
|
iprsa = rsa
|
||||||
|
}
|
||||||
|
off += (uint(rsa.Len) + 3) &^ 3
|
||||||
|
}
|
||||||
|
if iprsa != nil && nmrsa != nil {
|
||||||
|
var mask IPMask
|
||||||
|
var ip IP
|
||||||
|
|
||||||
|
switch iprsa.Family {
|
||||||
|
case syscall.AF_INET:
|
||||||
|
ipsa := (*syscall.RawSockaddrInet4)(unsafe.Pointer(iprsa))
|
||||||
|
nmsa := (*syscall.RawSockaddrInet4)(unsafe.Pointer(nmrsa))
|
||||||
|
ip = IPv4(ipsa.Addr[0], ipsa.Addr[1], ipsa.Addr[2], ipsa.Addr[3])
|
||||||
|
mask = IPv4Mask(nmsa.Addr[0], nmsa.Addr[1], nmsa.Addr[2], nmsa.Addr[3])
|
||||||
|
case syscall.AF_INET6:
|
||||||
|
ipsa := (*syscall.RawSockaddrInet6)(unsafe.Pointer(iprsa))
|
||||||
|
nmsa := (*syscall.RawSockaddrInet6)(unsafe.Pointer(nmrsa))
|
||||||
|
ip = make(IP, IPv6len)
|
||||||
|
copy(ip, ipsa.Addr[:])
|
||||||
|
mask = make(IPMask, IPv6len)
|
||||||
|
copy(mask, nmsa.Addr[:])
|
||||||
|
}
|
||||||
|
ifa := &IPNet{IP: ip, Mask: mask}
|
||||||
|
ifat = append(ifat, ifa)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tab = tab[ifm.Msglen:]
|
||||||
|
}
|
||||||
|
|
||||||
|
return ifat, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// interfaceMulticastAddrTable returns addresses for a specific
|
||||||
|
// interface.
|
||||||
|
func interfaceMulticastAddrTable(ifi *Interface) ([]Addr, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
|
||||||
|
|
||||||
package socktest
|
package socktest
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
|
||||||
|
|
||||||
package socktest
|
package socktest
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
@ -134,7 +134,7 @@ func favoriteAddrFamily(network string, laddr, raddr sockaddr, mode string) (fam
|
||||||
}
|
}
|
||||||
|
|
||||||
func internetSocket(ctx context.Context, net string, laddr, raddr sockaddr, sotype, proto int, mode string, ctrlFn func(string, string, syscall.RawConn) error) (fd *netFD, err error) {
|
func internetSocket(ctx context.Context, net string, laddr, raddr sockaddr, sotype, proto int, mode string, ctrlFn func(string, string, syscall.RawConn) error) (fd *netFD, err error) {
|
||||||
if (runtime.GOOS == "windows" || runtime.GOOS == "openbsd" || runtime.GOOS == "nacl") && mode == "dial" && raddr.isWildcard() {
|
if (runtime.GOOS == "aix" || runtime.GOOS == "windows" || runtime.GOOS == "openbsd" || runtime.GOOS == "nacl") && mode == "dial" && raddr.isWildcard() {
|
||||||
raddr = raddr.toLocal(net)
|
raddr = raddr.toLocal(net)
|
||||||
}
|
}
|
||||||
family, ipv6only := favoriteAddrFamily(net, laddr, raddr, mode)
|
family, ipv6only := favoriteAddrFamily(net, laddr, raddr, mode)
|
||||||
|
|
|
||||||
|
|
@ -674,7 +674,7 @@ func checkMulticastListener(c *UDPConn, ip IP) error {
|
||||||
|
|
||||||
func multicastRIBContains(ip IP) (bool, error) {
|
func multicastRIBContains(ip IP) (bool, error) {
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "dragonfly", "netbsd", "openbsd", "plan9", "solaris", "windows":
|
case "aix", "dragonfly", "netbsd", "openbsd", "plan9", "solaris", "windows":
|
||||||
return true, nil // not implemented yet
|
return true, nil // not implemented yet
|
||||||
case "linux":
|
case "linux":
|
||||||
if runtime.GOARCH == "arm" || runtime.GOARCH == "alpha" {
|
if runtime.GOARCH == "arm" || runtime.GOARCH == "alpha" {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ func testableNetwork(network string) bool {
|
||||||
}
|
}
|
||||||
case "unixpacket":
|
case "unixpacket":
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "android", "darwin", "nacl", "plan9", "windows":
|
case "aix", "android", "darwin", "nacl", "plan9", "windows":
|
||||||
return false
|
return false
|
||||||
case "netbsd":
|
case "netbsd":
|
||||||
// It passes on amd64 at least. 386 fails (Issue 22927). arm is unknown.
|
// It passes on amd64 at least. 386 fails (Issue 22927). arm is unknown.
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris nacl
|
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris nacl
|
||||||
|
|
||||||
// Read system port mappings from /etc/services
|
// Read system port mappings from /etc/services
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin js,wasm nacl netbsd openbsd
|
// +build aix darwin js,wasm nacl netbsd openbsd
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows
|
// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build nacl js,wasm solaris
|
// +build aix nacl js,wasm solaris
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
38
src/net/sockopt_aix.go
Normal file
38
src/net/sockopt_aix.go
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package net
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This was copied from sockopt_linux.go
|
||||||
|
|
||||||
|
func setDefaultSockopts(s, family, sotype int, ipv6only bool) error {
|
||||||
|
if family == syscall.AF_INET6 && sotype != syscall.SOCK_RAW {
|
||||||
|
// Allow both IP versions even if the OS default
|
||||||
|
// is otherwise. Note that some operating systems
|
||||||
|
// never admit this option.
|
||||||
|
syscall.SetsockoptInt(s, syscall.IPPROTO_IPV6, syscall.IPV6_V6ONLY, boolint(ipv6only))
|
||||||
|
}
|
||||||
|
// Allow broadcast.
|
||||||
|
return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_BROADCAST, 1))
|
||||||
|
}
|
||||||
|
|
||||||
|
func setDefaultListenerSockopts(s int) error {
|
||||||
|
// Allow reuse of recently-used addresses.
|
||||||
|
return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1))
|
||||||
|
}
|
||||||
|
|
||||||
|
func setDefaultMulticastSockopts(s int) error {
|
||||||
|
// Allow multicast UDP and raw IP datagram sockets to listen
|
||||||
|
// concurrently across multiple listeners.
|
||||||
|
if err := syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1); err != nil {
|
||||||
|
return os.NewSyscallError("setsockopt", err)
|
||||||
|
}
|
||||||
|
// Allow reuse of recently-used ports.
|
||||||
|
return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEPORT, 1))
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris windows
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd netbsd openbsd solaris
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris windows
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
// This file implements sysSocket and accept for platforms that do not
|
// This file implements sysSocket and accept for platforms that do not
|
||||||
// provide a fast path for setting SetNonblock and CloseOnExec.
|
// provide a fast path for setting SetNonblock and CloseOnExec.
|
||||||
|
|
||||||
// +build darwin nacl solaris
|
// +build aix darwin nacl solaris
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris windows
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build freebsd linux netbsd
|
// +build aix freebsd linux netbsd
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue