You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Starting in November 2021, app updates will be required to target API level 30 or above and adjust for behavioral changes in Android 11.
Currently we're at 29.
One release moved us to 30 and it broke things due to our use of netlink: #2290.
This may or may not be a dup of #1965 (we're broken on Android 12), but I'd like to keep this open separately, specifically tracking the November 2021 deadline for SDK version 30.
The short-term fix for us is to ignore whatever Go's doing and use our own net.Interfaces-like wrapper that can use net.Interfaces on most platforms but uses Java/JNI on Android, like we did for tailscale/tailscale-android@b97cc70 ... blech, but doable.
I have an Android implementation using getNetworkInterfaces() and getInetAddresses() to retrieve the information needed to reconstruct Go's net.Interfaces() - except for the HardwareAddr on the Interface, which is the bit of information that Android SDK 30 is preventing access to.
It can be seen at tailscale/tailscale-android#21. Passing primitive types across JNI is relatively straightforward, passing a single object of a complex class is annoying but still possible, but passing lists and other more complex data structures is way harder. As such, I added a Java routine to render the interface information to a string and pass that across JNI as a primitive type for Go code to parse.
I'm less clear what to do in OSS net/interface/interfaces.go. I don't think we can have an Android-specific implementation return an actual net.Interface: the Go implementation handles interface.Addrs() using the NETLINK messages which Android SDK30 rejects. I guess we need a new interface{}, provide a trivial implementation of the interface{} using net.Interface, and allow the Android platform to supply a different one.
However I wouldn't expect to be calling newResolvedManager() on Android, as it is for talking to systemd-resolved which Android does not use.
It is possible that net.Interface is no longer involved at all, and we're running into some other place which sends a NETLINK message which SDK 30 prohibits.
Activity
DentonGentry commentedon Jul 1, 2021
fatal error: runBackend: NewUserspaceEngineAdvanced: route ip+net: netlinkrib: permission deniedAppears to be golang/go#40569
With API version 30:
bradfitz commentedon Jul 1, 2021
Good find! The https://github.com/Catfriend1/syncthing-android/pull/800 link from there is interesting.
DentonGentry commentedon Jul 15, 2021
net.InterfaceAddrs() calls interfaceAddrTable(nil)
https://cs.opensource.google/go/go/+/refs/tags/go1.16.6:src/net/interface.go;l=115
interfaceAddrTable(nil) calls syscall.NetlinkRIB(syscall.RTM_GETADDR, syscall.AF_UNSPEC)
https://cs.opensource.google/go/go/+/refs/tags/go1.16.6:src/net/interface_linux.go;l=120
NetlinkRIB gets permission denied with targetSdkVersion 30.
DentonGentry commentedon Jul 31, 2021
No progress on golang/go#40569
As of August 1, it is no longer possible to release new Android apps written in Go. The Play Store will require new apps to target SDK version 30.
bradfitz commentedon Aug 2, 2021
That's a little exaggerated. :) The limitation is around use of the netlink calls that implement https://pkg.go.dev/net#Interfaces etc, which few Go programs do.
But it's certainly bad for us.
The short-term fix for us is to ignore whatever Go's doing and use our own
net.Interfaces-like wrapper that can usenet.Interfaceson most platforms but uses Java/JNI on Android, like we did for tailscale/tailscale-android@b97cc70 ... blech, but doable.DentonGentry commentedon Aug 14, 2021
Iterating over each Interface from https://developer.android.com/reference/java/net/NetworkInterface#getNetworkInterfaces() looks like it would work.
Will hold off until a bit closer to November, hoping that golang/go#40569 will be fixed before then.
DentonGentry commentedon Oct 4, 2021
I have an Android implementation using
getNetworkInterfaces()andgetInetAddresses()to retrieve the information needed to reconstruct Go's net.Interfaces() - except for theHardwareAddron theInterface, which is the bit of information that Android SDK 30 is preventing access to.It can be seen at tailscale/tailscale-android#21. Passing primitive types across JNI is relatively straightforward, passing a single object of a complex class is annoying but still possible, but passing lists and other more complex data structures is way harder. As such, I added a Java routine to render the interface information to a string and pass that across JNI as a primitive type for Go code to parse.
I'm less clear what to do in OSS net/interface/interfaces.go. I don't think we can have an Android-specific implementation return an actual net.Interface: the Go implementation handles interface.Addrs() using the NETLINK messages which Android SDK30 rejects. I guess we need a new interface{}, provide a trivial implementation of the interface{} using net.Interface, and allow the Android platform to supply a different one.
net/interfaces: add RegisterInterfaceGetter for Android
bradfitz commentedon Oct 5, 2021
@DentonGentry, I sent #2990
DentonGentry commentedon Oct 6, 2021
Annoyingly, even with #2990 and tailscale/tailscale-android#21 applied the app still fails with
route ip+net: netlinkrib: permission deniedThere is one call to net.Interface{} left, in net/dns/resolved.go:
tailscale/net/dns/resolved.go
Line 97 in 0410f1a
However I wouldn't expect to be calling
newResolvedManager()on Android, as it is for talking to systemd-resolved which Android does not use.It is possible that net.Interface is no longer involved at all, and we're running into some other place which sends a NETLINK message which SDK 30 prohibits.
6 remaining items
bradfitz commentedon Oct 6, 2021
Ah: tailscale/tailscale-android@8e1a6b2#r57595250 ... AltAddrs wasn't always non-nil.
DentonGentry commentedon Oct 6, 2021
Oh! That made it take the path where it issues an RTM_GETADDR.
Initializing
newIf.AltAddrs = []net.Addr{}is working, the app starts and can access the Tailnet.I'm going to remove some Printfs and clean this up, then remove the WIP.
net/interfaces: add RegisterInterfaceGetter for Android
cmd/tailscale: implement getInterfaces + SDK 30
cmd/tailscale: implement getInterfaces + SDK 30
cmd/tailscale: implement getInterfaces + SDK 30
cmd/tailscale: implement getInterfaces + SDK 30
cmd/tailscale: implement getInterfaces + SDK 30
cmd/tailscale: implement getInterfaces + SDK 30
wlynxg commentedon Jul 1, 2023
I have found a solution to this problem using pure Go language, which I believe is more elegant than using Go with JNI. You can find the detailed information here: https://github.com/wlynxg/anet. I hope this is helpful for everyone!
Ponewor commentedon Oct 16, 2023
Hello, I am still getting
can't start tsnet server: tsnet: route ip+net: netlinkrib: permission deniedI could start a new issue but it seems like this one hasn't been handled properly yet.
DentonGentry commentedon Oct 16, 2023
This issue was fixed two years ago. We moved to SDK 30 and met the Play Store requirements in October of 2021.
The Android app does not use tsnet in any way, I don't believe this is related to the Android app. Please open a new issue.
I'm going to close further comments on this issue.
cmd/tailscale: implement getInterfaces + SDK 30