Avoid sticky sockets on Android

The android policy routing system does insane things.
This commit is contained in:
Jason A. Donenfeld 2018-05-22 19:40:51 +02:00
parent b4cef2524f
commit 65a74f3175
2 changed files with 8 additions and 3 deletions

View 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 */
}
}

View 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.