aboutsummaryrefslogtreecommitdiffstats
path: root/conn_default.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-05-22 19:40:51 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-22 23:22:23 +0200
commit65a74f3175855dc41b49332103ada6bb27733291 (patch)
treef78cdb95b2cdec5fc9493303ce9b9aabd23e6dc5 /conn_default.go
parentFix integer conversions (diff)
downloadwireguard-go-65a74f3175855dc41b49332103ada6bb27733291.tar.xz
wireguard-go-65a74f3175855dc41b49332103ada6bb27733291.zip
Avoid sticky sockets on Android
The android policy routing system does insane things.
Diffstat (limited to '')
-rw-r--r--conn_default.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/conn_default.go b/conn_default.go
index fc52fbf..14ed56c 100644
--- a/conn_default.go
+++ b/conn_default.go
@@ -1,4 +1,4 @@
-// +build !linux
+// +build !linux android
/* SPDX-License-Identifier: GPL-2.0
*
@@ -143,9 +143,12 @@ func (bind *NativeBind) Send(buff []byte, endpoint Endpoint) error {
var fwmarkIoctl int
func init() {
- if runtime.GOOS == "freebsd" {
+ switch runtime.GOOS {
+ case "linux", "android":
+ fwmarkIoctl = 36 /* unix.SO_MARK */
+ case "freebsd":
fwmarkIoctl = 0x1015 /* unix.SO_USER_COOKIE */
- } else if runtime.GOOS == "openbsd" {
+ case "openbsd":
fwmarkIoctl = 0x1021 /* unix.SO_RTABLE */
}
}