3

I am facing a problem with my flutter application I want to get a list of nearby devices on my same network for android 10 and below I am running this command using Process.run: ip neigh show however this command seems to be forbidden on android 11 and above as it always returns

Cannot bind Netlink socket: Permission denied

and not returning anything I tried the arp-scanner to check if it will work and to my luck, it worked but it has some data missing I need to get IP Address, MAC Address and Hostname the previous flutter plugin only return the IP addresses and always return null for the mac address.

If anyone has any suggestions on how to do this please help.

Sparks
  • 496
  • 7
  • 16

1 Answers1

1

Google has removed the possibility to bind netlink socket to retrieve arp table from targetSdkVersion 30 through SELinux policies.

Without using bind function, I've made a library that does a workaround that consist in sending via netlink socket a type message not listed (30) and then I've used the socket receive to see which data system returns to that socket. From that, I've noticed that the received data was the arp table.

I do not know if this library works with flutter, but you can try it out.

You can find more here https://github.com/fulvius31/ip-neigh-sdk30/blob/main/ipneigh30/src/main/cpp/ip_neigh.c

wittich
  • 2,079
  • 2
  • 27
  • 50
fulvius31
  • 31
  • 2
  • Thank you for your response I will check it out. Yet I have one question will you even convert this to flutter plugin? – Sparks Nov 11 '22 at 17:32