'ip neigh/arp command does not work after upgrading targetSDK to 30

Reading the ARP table and accessing the MAC address of devices on network is working just fine. But when I upgrade the targetSDK to 30, suddenly the "ip neigh" command won't return a value anymore. I'm guessing this has something to do with the restrictions on android. Is there any way to fix this issue?



Solution 1:[1]

I see you've asked this before. Others have asked similar questions as well, and it seems that there is no real solution:

Android 10 introduces several privacy-related restrictions that disallow apps to access certain information that could be potentially misused for fingerprinting and data collection. One of among them is the restriction on access to /proc/net filesystem on devices that run Android 10 or higher, apps cannot access /proc/net, which includes information about a device's network state. Apps that need access to this information, such as VPNs, should use the NetworkStatsManager or ConnectivityManager class.

The current APIs in Android doesn't allow apps to access the ARP cache. I see a bug is raised in Google issue tracker that is currently in the below status - https://issuetracker.google.com/issues/130103885

Status: Won't Fix (Infeasible) We've passed along your input to our internal teams, who are evaluating it for a future release. We're closing this issue for now, and thanks for sending us your feedback!"

https://developer.android.com/about/versions/10/privacy/changes#proc-net-filesystem

Related thread [ Acccess to /proc/net/tcp in Android Q ] - https://stackoverflow.com/a/58501039/4694013

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 atrocia6