summaryrefslogtreecommitdiff
path: root/libgo/go/net/sock_linux.go
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-20 00:18:15 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-20 00:18:15 +0000
commit84911de8492fb75007eec6bfa4abb7905439f93c (patch)
treec891bdec1e6f073f73fedeef23718bc3ac30d499 /libgo/go/net/sock_linux.go
parentad33e6a8510b48571eaef50af339892925108830 (diff)
downloadgcc-84911de8492fb75007eec6bfa4abb7905439f93c.tar.gz
Update to current version of Go library.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173931 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/net/sock_linux.go')
-rw-r--r--libgo/go/net/sock_linux.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/libgo/go/net/sock_linux.go b/libgo/go/net/sock_linux.go
new file mode 100644
index 00000000000..ec31e803b6f
--- /dev/null
+++ b/libgo/go/net/sock_linux.go
@@ -0,0 +1,25 @@
+// Copyright 2011 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.
+
+// Sockets for Linux
+
+package net
+
+import (
+ "syscall"
+)
+
+func setKernelSpecificSockopt(s, f int) {
+ // Allow reuse of recently-used addresses.
+ syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1)
+
+ // Allow broadcast.
+ syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_BROADCAST, 1)
+
+ if f == syscall.AF_INET6 {
+ // using ip, tcp, udp, etc.
+ // allow both protocols even if the OS default is otherwise.
+ syscall.SetsockoptInt(s, syscall.IPPROTO_IPV6, syscall.IPV6_V6ONLY, 0)
+ }
+}