4

I want to communicate between my Android device and my Linux box over IP through the USB network interface mode. The device I'm using is a OnePlus One running CM12.1 nightly builds. It's rooted and SELinux is set to PERMISSIVE. Mount namespace separation is also disabled.

I have connected my OPO to my Linux box and put it into into network interface mode via some Java reflection hackery and the system-only MANAGE_USB permission. (I'm not using the standard tethering setting because I want to use my Linux box as the gateway and not the other way round). I used ip addr add to add an IP address on both ends (Linux box and OPO) and then added a route with ip route via my Linux box for internet access. I have also enabled IPv4 forwarding on the Linux box side, as well as enabling all of the necessary iptables rules.

My problem is this: only root can communicate over the interface. For example, with my Linux box at 10.42.0.1 and my OPO at 10.42.0.2 across the USB network interface, running ping 10.42.0.1 or ping 8.8.8.8 on the Android side without running from an su shell will not work. Running the exact same commands as root functions perfectly. The same commands over the WiFi interface on the Android side run fine without root.

I am assuming this is some new security feature implemented in Android 5.0 / 5.1, as it worked fine in KitKat. Does anybody know exactly what it might be?

1 Answer 1

0

I came across this as well. It has to do with routing policies that cause the 'main' routing table to not be engaged for any user besides root.

This worked for me, but I'm still looking into the implications of doing this so broadly. It's no worse than what my linux box does though, so there's that.

 ip rule add from all lookup main pref 99

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .