-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
android: move to targetSdkVersion 30 #2293
Comments
Appears to be golang/go#40569
|
Good find! The Catfriend1/syncthing-android#800 link from there is interesting. |
net.InterfaceAddrs() calls interfaceAddrTable(nil) interfaceAddrTable(nil) calls syscall.NetlinkRIB(syscall.RTM_GETADDR, syscall.AF_UNSPEC) NetlinkRIB gets permission denied with targetSdkVersion 30. |
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. |
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 |
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. |
I have an Android implementation using 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. |
Updates #2293 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
@DentonGentry, I sent #2990 |
Annoyingly, even with #2990 and tailscale/tailscale-android#21 applied the app still fails with
There is one call to net.Interface{} left, in 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. |
WireGuard itself tries to open netlink. |
In SDK30, apps cannot use the bind() function on NETLINK_ROUTE sockets.
I see one use of net.Interface in conn/bind_linux.go, but it does not call the Addrs() method which is the origin of the RTM_GETLINK that Android objects to. |
I'm looking at all the return statements from NewUserspaceEngine, and which ones can make the error you see:
Notably, it's not decorated with anything else. It's not Not bird. At first, because Not And then there's no other options, because we never see:
So is it the link monitor and the build tags are screwed up somehow? Edit: we also never see:
If logs are busted, then the only two remaining options are |
Router.Up/Set look fine. The Android |
The logid for this device is 9c4567b7ed9516453f737ca08d71e12eab7cac45c2cb9162cf7d028fa5b932e7. I don't see "Bringing wireguard device up" nor "link state:" In the adb logcat output a few comments ago we do see: which seems to imply the failure is a bind() for a NETLINK socket. monitor_linux.go creates a unix.NETLINK_ROUTE socket but I don't see anywhere that it calls bind(). |
The
|
Ah: tailscale/tailscale-android@8e1a6b2#r57595250 ... AltAddrs wasn't always non-nil. |
Oh! That made it take the path where it issues an RTM_GETADDR. Initializing I'm going to remove some Printfs and clean this up, then remove the WIP. |
Updates #2293 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
SDK 30 prohibits syscall.NetlinkRIB(syscall.RTM_GETADDR, ...) which Go's net.Interfaces uses. Implement an Android specific version of net.Interfaces to use instead. Fixes tailscale/tailscale#2293
SDK 30 prohibits syscall.NetlinkRIB(syscall.RTM_GETADDR, ...) which Go's net.Interfaces uses. Implement an Android specific version of net.Interfaces to use instead. 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, this commit 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. Fixes tailscale/tailscale#2293
SDK 30 prohibits syscall.NetlinkRIB(syscall.RTM_GETADDR, ...) which Go's net.Interfaces uses. Implement an Android specific version of net.Interfaces to use instead. 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, this commit 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. Fixes tailscale/tailscale#2293
SDK 30 prohibits syscall.NetlinkRIB(syscall.RTM_GETADDR, ...) which Go's net.Interfaces uses. Implement an Android specific version of net.Interfaces to use instead. 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, this commit 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. Fixes tailscale/tailscale#2293
SDK 30 prohibits syscall.NetlinkRIB(syscall.RTM_GETADDR, ...) which Go's net.Interfaces uses. Implement an Android specific version of net.Interfaces to use instead. 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, this commit 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. Fixes tailscale/tailscale#2293
SDK 30 prohibits syscall.NetlinkRIB(syscall.RTM_GETADDR, ...) which Go's net.Interfaces uses. Implement an Android specific version of net.Interfaces to use instead. 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, this commit 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. Fixes tailscale/tailscale#2293
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! |
Hello, I am still getting I could start a new issue but it seems like this one hasn't been handled properly yet. |
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. |
Clock's ticking:
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.
/cc @eliasnaur @DentonGentry
The text was updated successfully, but these errors were encountered: