2e58f12722e308719177949f6850492ffe30c369 |
|
15-Jul-2017 |
Bjoern Johansson <bjoernj@google.com> |
Create a DHCP server and client for the emulator In order to have the system image be flexible about what networks it can run in it needs to have a DHCP client running on eth0. The emulator already has a DHCP server and will hand out the same address, gateway and DNS servers we had already hardcoded so the configuration will remain the same for user networking. When bridging networks the hardcoded settings won't work. In this situation the DHCP client will pick up the configuration from the bridged network and set everything up so that the system image can work. The repo currently contains a version of dhcpcd which is also a DHCP client but it doesn't work when running inside the router namespace because it attempts to read information out of /sys that is not there when run by execns. This is because execns does not remount /sys as this is not allowed by the SELinux configuration on Android (the configuration won't even allow giving the permission to execns). Additionally dhcpcd would not correctly configure the system properties for DNS that RIL uses to give access to the cellular network. The DHCP server is intended to run on the wireless interface in the router namespace. Previously the WiFi solution used dnsmasq for this purpose but it was too inflexible to work on bridged networks. The DHCP server needs to forward the DNS servers from the outside network to the WiFi client and dnsmasq could not do this on a bridged network where it was impossible to know the DNS server address(es) beforehand. The DHCP server implementation here simply picks up the DNS servers from the system properties set by the DHCP client. If we are to support multiple virtual access points we need to have even more control of the DHCP server in the router namespace since it will have to be aware of the multiple network interfaces created by hostapd and make sure to hand out leases that matches the configuration of each of those interfaces. BUG: 74514143 Test: Build emulator image and manually verify that WiFi is working Change-Id: I1bff8968ff2af93f01a9509b9557aaa13b0a0874 (cherry picked from commit fdc59b88391cedc4829c590b87c2df466fa7fd33) (cherry picked from commit 623df714384bd8b86c030f82cb7f301dbd025d1c) (cherry picked from commit 724322528f159e1a475127d01443ffa5995af881)
/device/generic/goldfish/dhcp/client/dhcpclient.cpp
|