8

I am working on building a mesh of android devices using Wifi Direct and Wifi.

My basic scheme is as follows:

1) Each node builds a Wifi Direct Group Owner (GO) access point using the WifiP2pManager.createGroup() method. It then advertises it by WifiP2pManager.addLocalService().

2) Each node also scans for other nodes by WifiP2pManager.discoverServices(). When it finds another node it connects to that node using regular legacy Wifi: wifiManager.disconnect(), wifiManager.enableNetwork(), and wifiManager.reconnect().

3) Update the routing table and ipTables to allow traffic to forward to the correct destination. This requires root permissions.

The problem with this technique is that WifiP2p assigns every Group Owner the same address of 192.168.49.1 and uses the 192.168.49.0/24 pool in DHCP to issue addresses to devices that join the Group Owner. Thus the mesh will not be able to route traffic over multiple hops since all of the links have the same IP space. A few techniques have been proposed for overcoming this switching between networks (using store-and-forward to move packages), using IP broadcast to send out over multiple links at once, and modifying WifiP2p to issue different addresses. I am working on the last option of modifying WifiP2p's implementation.

What library assigns the IP block 192.168.49.1 to the Wifi Direct Group Owner in Android?

In Android 4.0 it was directly assigned in WifiP2pService.java on lines 155 and 156:

155 | private static final String[] DHCP_RANGE = {"192.168.49.2", "192.168.49.254"};
156 | private static final String SERVER_ADDRESS = "192.168.49.1";

As of Android 5.0, that library is deprecated. I have traced the current implementation until it leaves Java and heads into executing the C libraries. This is where I need your help to understand which C library to look in.

Disclaimers: I understand that I will be working in custom kernel land and working with rooted devices. I have rooted my test bed devices already and understand the risks. I also understand that Android was not built to do this. I also know that Wifi 802.11s introduced mesh networks (not complied into Android). I do desire to use Wifi Direct (vice bluetooth, etc) since it leverages many of the benefits of wifi infrastructure modes (energy conservation, encryption, etc). Hans asked a very similar question here but did not desire to root the device, I desire to root the device.

Community
  • 1
  • 1
Micah Akin
  • 161
  • 9

0 Answers0