Hi,
This issue is already pretty old and has bee raised several times in other contexts, e.g. like here:
opened 01:13PM - 04 Aug 20 UTC
NeedsInvestigation
mobile
<!--
Please answer these questions before submitting your issue. Thanks!
For q… uestions please use one of our forums: https://github.com/golang/go/wiki/Questions
-->
### What version of Go are you using (`go version`)?
<pre>
$ go version
go version go1.14.6 darwin/amd64
$gomobile version
gomobile version +973feb4 Sat Aug 1 11:21:45 2020 +0000 (android,ios); androidSDK=/sdk/platforms/android-30
</pre>
### Does this issue reproduce with the latest release?
Yes
### What operating system and processor architecture are you using (`go env`)?
<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/user/Library/Caches/go-build"
GOENV="/Users/user/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/user/golang"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.14.6/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.14.6/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/user/golang/src/golang.org/x/mobile/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/kq/3436m_v11sg0l7zqtmv2r1gw0000gn/T/go-build713467523=/tmp/go-build -gno-record-gcc-switches -fno-common"
</pre></details>
### What did you do?
<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
-->
Calling `net.InterfaceAddrs()` fails on Android app targetting SDK version 30. With `build.gradle` looking like:
```
android {
compileSdkVersion 30
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "com.example.testapp"
minSdkVersion 29
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
```
Building the exact same app targetting SDK 29 works, and returns no error:
```
android {
compileSdkVersion 30
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "com.example.testapp"
minSdkVersion 29
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
```
### What did you expect to see?
Targetting SDK 30 would behave no differently.
### What did you see instead?
Calling `net.InterfaceAddrs()` results in error `route ip+net: netlinkrib: permission denied` when embedded in Android app targetting SDK 30 (R):
```
2020-08-04 15:10:21.386 15754-15754/? W/Thread-2: type=1400 audit(0.0:616): avc: denied { bind } for scontext=u:r:untrusted_app:s0:c158,c256,c512,c768 tcontext=u:r:untrusted_app:s0:c158,c256,c512,c768 tclass=netlink_route_socket permissive=0 b/155595000 app=com.example.testapp
```
Up to now no solution. I wonder, if this couldn’t be solved in near future, since it prevents the proper usage of network functionality with a GOMOBILE module under Android. It is a permission issue introduced with API 30 and affects all devices running GOMOBILE and having Android > 10.
In my case it did hit me while using LiveKit GO SDK
, which is based on PION GO WebRtc.
There is currently no work around, at least not to my knowledge.
I/GoLog: "msg"="could not create answer" "error"="failed to create network: route ip+net: netlinkrib: permission denied"
I/GoLog: "msg"="could not set remote description" "error"="failed to create network: route ip+net: netlinkrib: permission denied"
I/GoLog: "msg"="could not add ICE candidate" "error"="failed to create network: route ip+net: netlinkrib: permission denied"
I/GoLog: "msg"="could not add ICE candidate" "error"="failed to create network: route ip+net: netlinkrib: permission denied"
Sorry, typo in title. Android > 10 of course
system
(system)
Closed
March 12, 2024, 7:29am
3
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.