libgo: update to Go 1.11
[official-gcc.git] / libgo / go / net / sockopt_aix.go
blob7aef64b48e432b90952d4457f39d020a02cad7c7
1 // Copyright 2017 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package net
7 import (
8 "os"
9 "syscall"
12 // This was copied from sockopt_linux.go
14 func setDefaultSockopts(s, family, sotype int, ipv6only bool) error {
15 if family == syscall.AF_INET6 && sotype != syscall.SOCK_RAW {
16 // Allow both IP versions even if the OS default
17 // is otherwise. Note that some operating systems
18 // never admit this option.
19 syscall.SetsockoptInt(s, syscall.IPPROTO_IPV6, syscall.IPV6_V6ONLY, boolint(ipv6only))
21 // Allow broadcast.
22 return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_BROADCAST, 1))
25 func setDefaultListenerSockopts(s int) error {
26 // Allow reuse of recently-used addresses.
27 return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1))
30 func setDefaultMulticastSockopts(s int) error {
31 // Allow multicast UDP and raw IP datagram sockets to listen
32 // concurrently across multiple listeners.
33 return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1))