aboutsummaryrefslogtreecommitdiff
path: root/conn/controlfns_linux.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2023-03-23 18:38:34 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2023-03-23 18:39:00 +0100
commit3a9e75374f434e4cebadb6cfb322be3e2e80d0f0 (patch)
tree637653fe6b47a491e62a0c5d4f32fd77088ef031 /conn/controlfns_linux.go
parentcc20c08c9615edbb31b96c89201bf1b2189fe159 (diff)
downloadwireguard-go-3a9e75374f434e4cebadb6cfb322be3e2e80d0f0.tar.gz
wireguard-go-3a9e75374f434e4cebadb6cfb322be3e2e80d0f0.zip
conn: disable sticky sockets on Android
We can't have the netlink listener socket, so it's not possible to support it. Plus, android networking stack complexity makes it a bit tricky anyway, so best to leave it disabled. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'conn/controlfns_linux.go')
-rw-r--r--conn/controlfns_linux.go17
1 files changed, 11 insertions, 6 deletions
diff --git a/conn/controlfns_linux.go b/conn/controlfns_linux.go
index aff6245..a2396fe 100644
--- a/conn/controlfns_linux.go
+++ b/conn/controlfns_linux.go
@@ -7,6 +7,7 @@ package conn
import (
"fmt"
+ "runtime"
"syscall"
"golang.org/x/sys/unix"
@@ -36,14 +37,18 @@ func init() {
var err error
switch network {
case "udp4":
- c.Control(func(fd uintptr) {
- err = unix.SetsockoptInt(int(fd), unix.IPPROTO_IP, unix.IP_PKTINFO, 1)
- })
+ if runtime.GOOS != "android" {
+ c.Control(func(fd uintptr) {
+ err = unix.SetsockoptInt(int(fd), unix.IPPROTO_IP, unix.IP_PKTINFO, 1)
+ })
+ }
case "udp6":
c.Control(func(fd uintptr) {
- err = unix.SetsockoptInt(int(fd), unix.IPPROTO_IPV6, unix.IPV6_RECVPKTINFO, 1)
- if err != nil {
- return
+ if runtime.GOOS != "android" {
+ err = unix.SetsockoptInt(int(fd), unix.IPPROTO_IPV6, unix.IPV6_RECVPKTINFO, 1)
+ if err != nil {
+ return
+ }
}
err = unix.SetsockoptInt(int(fd), unix.IPPROTO_IPV6, unix.IPV6_V6ONLY, 1)
})