Add support for Ethernet tethering

Ethernet tethering can be started via
startTethering(TETHERING_ETHERNET).

Test: flashed, enabled ethernet tethering, verified internet access on
      downstream.
Bug: 130840861

Merged-In: I34842acd94b972e440c3622f7617df10c18acf65
Change-Id: I34842acd94b972e440c3622f7617df10c18acf65
(cherry-pick with conflicts in test-current.txt)
This commit is contained in:
Remi NGUYEN VAN
2020-01-24 22:57:09 +09:00
parent 45a971bd8c
commit 0ef3b75ff5
5 changed files with 81 additions and 0 deletions

View File

@@ -93,6 +93,8 @@ public class IpServer extends StateMachine {
private static final int WIFI_HOST_IFACE_PREFIX_LENGTH = 24;
private static final String WIFI_P2P_IFACE_ADDR = "192.168.49.1";
private static final int WIFI_P2P_IFACE_PREFIX_LENGTH = 24;
private static final String ETHERNET_IFACE_ADDR = "192.168.50.1";
private static final int ETHERNET_IFACE_PREFIX_LENGTH = 24;
// TODO: have PanService use some visible version of this constant
private static final String BLUETOOTH_IFACE_ADDR = "192.168.44.1";
@@ -426,6 +428,10 @@ public class IpServer extends StateMachine {
} else if (mInterfaceType == TetheringManager.TETHERING_WIFI_P2P) {
srvAddr = (Inet4Address) parseNumericAddress(WIFI_P2P_IFACE_ADDR);
prefixLen = WIFI_P2P_IFACE_PREFIX_LENGTH;
} else if (mInterfaceType == TetheringManager.TETHERING_ETHERNET) {
// TODO: randomize address for tethering too, similarly to wifi
srvAddr = (Inet4Address) parseNumericAddress(ETHERNET_IFACE_ADDR);
prefixLen = ETHERNET_IFACE_PREFIX_LENGTH;
} else {
// BT configures the interface elsewhere: only start DHCP.
// TODO: make all tethering types behave the same way, and delete the bluetooth