Wireguard-go on Android 11+
Anton
jnashicq at googlemail.com
Wed Apr 12 12:39:00 UTC 2023
Hi all,
I'm porting a Golang-based program [1] to Android11+ (API level 30)
and I've faced a problem,as the getifaddrs function is not available
for apps and other restrictions.
>From Android developer documentation [2]:
>
> In addition, non-privileged apps can't access the device's MAC address; only network interfaces with an IP address are visible. This impacts the getifaddrs() and NetworkInterface.getHardwareAddress() methods, as well as sending RTM_GETLINK Netlink messages.
> The following is a list of the ways that apps are affected by this change:
> 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.
>
I came up with a workaround [3], and now my app works OK.
External references:
https://github.com/mysteriumnetwork/node
https://developer.android.com/training/articles/user-data-ids#mac-11-plus
https://github.com/mysteriumnetwork/wireguard-go/pull/5/files
--
best regards,
Anton
More information about the WireGuard
mailing list