]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
Avoid sticky sockets on Android
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 22 May 2018 17:40:51 +0000 (19:40 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Tue, 22 May 2018 21:22:23 +0000 (23:22 +0200)
The android policy routing system does insane things.

conn_default.go
conn_linux.go

index fc52fbf3996a1510e76ca0258f0c90ec83982195..14ed56cbda28e6b968714131a47964d195a5374b 100644 (file)
@@ -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 */
        }
 }
index e5105e373662b959faff61da9e3ca2772859c1b9..fa0908756ea0b6ccff992b6f409fc47fcc718d79 100644 (file)
@@ -1,3 +1,5 @@
+// +build !android
+
 /* SPDX-License-Identifier: GPL-2.0
  *
  * Copyright (C) 2017-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.