messense / if-addrs

Retrieve IP addresses for all interfaces. POSIX & Windows
BSD 3-Clause "New" or "Revised" License
22 stars 15 forks source link

PermissionDenied on android (API >= 30) #21

Open flapili opened 1 year ago

flapili commented 1 year ago

Hi, I have an issue with building an mobile app (using tauri) which get local ip

logs:

I/RustStdoutStderr: thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', src/lib.rs:86:43
I/RustStdoutStderr: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
W/tokio-runtime-w: type=1400 audit(0.0:38): avc: denied { bind } for scontext=u:r:untrusted_app:s0:c159,c256,c512,c768 tcontext=u:r:untrusted_app:s0:c159,c256,c512,c768 tclass=netlink_route_socket permissive=0 bug=b/155595000 app=foobar

I'll try to use https://developer.android.com/reference/java/net/NetworkInterface with jni then if it's succesfull I'll try to implement properly and submit a PR :)