Skip to content

[gomobile] Api level 30 Calling net.Interface fails (Android 11) #83

@Akilan1999

Description

@Akilan1999

Open Go issue: golang/go#40569

Reason for the issue:

The following is a list of the ways that apps are affected by this change (from Api level 30 onwards):

  • NetworkInterface.getHardwareAddress() returns null for every interface.
  • Apps cannot use the bind() function on NETLINK_ROUTE sockets.
  • The ip command does not return information about interfaces.
  • Apps cannot send RTM_GETLINK messages.

source (https://developer.android.com/training/articles/user-data-ids#mac-11-plus)

Possible solution

"
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.
"
PR with a solution: tailscale/tailscale-android#21

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions