I am working on a grid of Android devices using Wifi Direct and Wifi.
My main circuit is this:
1) Each node creates a Wifi Direct Group Owner (GO) access point using the WifiP2pManager.createGroup() method. He then advertises it using WifiP2pManager.addLocalService() .
2) Each node also scans other nodes on WifiP2pManager.discoverServices() . When it finds another node, it connects to that node using normal legacy Wi-Fi: wifiManager.disconnect() , wifiManager.enableNetwork() and wifiManager.reconnect() .
3) Update the routing table and ipTables to allow traffic to be routed to the desired destination. This requires root privileges.
The problem with this method is that WifiP2p assigns the same address 192.168.49.1 to each group owner and uses the pool 192.168.49.0/24 in DHCP to issue addresses to devices that join the group owner. Thus, the grid will not be able to route traffic through several transitions, since all links have the same IP space. Several methods have been proposed to overcome this switch between networks (using store-and-forward to move packets), using IP broadcasting to send to multiple links at once and changing WifiP2p to give out different addresses. I am working on the latest version of the WifiP2p implementation change.
Which library assigns the IP block 192.168.49.1 owner of the Wifi virtual network on Android?
In Android 4.0, it was directly assigned to 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";
Like Android 5.0, this library is deprecated. I followed the current implementation until I left Java and started running the C libraries. Here I need your help to figure out which C library to look for.
Disclaimer: I understand that I will work in user kernels and work with root devices. I have already strengthened my test beds and understood the risks. I also understand that Android was not created for this. I also know that Wi-Fi 802.11s introduced mesh networks (not respected in Android). I make a desire to use Wifi Direct (vice bluetooth, etc.), because it takes many advantages of Wi-Fi wireless network modes (power saving, encryption, etc.). Hans asked a very similar question here , but did not want to root the device, I want to start it.