Wednesday 2 December 2020

Simulating WiFi device in android emulator with mac80211_hwsim kernel module

I am looking to simulate an additional WiFi device in a rooted android emulator (to simulate a device my company makes). So far I have found the linux kernel module, mac80211_hwsim, which seems like it would help me create virtual networks like this. I believe this is also the mechanism that the emulator uses to create its fake wifi network already. I have found /vendor/bin/mac80211_create_radios which seems to allow me to access that module (to create more channels / radios which appear in ip show link as wlan*).

If this is in fact the right way forward, once I create some more channels for that kernel module, I want to be able to connect to a program on my local computer after connected to this other WiFi network (similar to how 10.0.2.2 maps to the host computer). (this looks helpful with the redir command)

Does this sound reasonable and does anyone have some tips going forward? It's been challenging to find information that is relevant to Android in this area.

Some relevant files for how I believe the emulator does this:

  • /vendor/bin/init.wifi.sh
  • /vendor/bin/init.ranchu-net.sh
  • /vendor/bin/mac80211_create_radios
  • /vendor/etc/simulated_hostapd.conf


from Simulating WiFi device in android emulator with mac80211_hwsim kernel module

No comments:

Post a Comment