Tethering

The Tethering module shares an Android device's internet connection with other connected client devices, which can connect to tethering devices over Wi-Fi, USB, Bluetooth, or Ethernet. This module includes the tethering component (USB, Wi-Fi access point, Bluetooth, etc.) and its dependencies (interaction with tethering entitlement, IpServer, and offloadController). This module is updatable, meaning it can receive updates to functionality outside of the normal Android release cycle.

The Tethering module enables OEMs throughout the Android ecosystem to use a single, standard reference implementation that brings the following benefits.

  • End users get a consistent experience across Android devices and fixes to interoperability issues through module updates.

  • OEMs can fulfull carrier requirements while also reducing costs for individual customizations (as they don't need different implementations of the same requirements in different ways).

eBPF tethering offload

To provide high-speed tethering without replying on hardware offloads, Android 11 provides a tethering software offload solution called eBPF tethering offload for IPv6 download (traffic flowing to tethered device).

From Android 12, this functionality (including the eBPF program code) is entirely provided by the Tethering module, which supports the following:

  • IPv6 download (traffic flowing to tethered device)
  • IPv6 upload (traffic flowing from tethered device)
  • IPv4 TCP/UDP upload and downstream (traffic flowing to/from tethered device)
  • eBPF offload

This feature is enabled by default, users can override config_tether_enable_bpf_offload configuration to false by RRO. See Customization for more information.

IPv4 and IPv6 support

The Tethering module supports IPv4 and IPv6 dual stack.

  • For IPv4 networks, the module sets up network address translation (NAT) and adopts dynamic host configuration protocol (DHCP) for IP address assignment.

  • For IPv6 networks, the module adopts IPv6 stateless address autoconfiguration (SLAAC) for IP address assignment.

Module boundary

For Android 12 and higher, all the files/folders under packages/modules/Connectivity are in the Tethering module scope.

For Android 11 and lower, the Tethering module has the following Android 10 files in packages/modules/Tethering.

  • frameworks/base/services/core/java/com/android/server/connectivity/Tethering.java
  • frameworks/base/services/core/java/com/android/server/connectivity/tethering/
  • frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
  • frameworks/base/services/net/java/android/net/ip/{InterfaceController,IpServer,RouterAdvertisementDaemon}.java
  • frameworks/base/services/net/java/android/net/{netlink,dhcp}/*
  • frameworks/base/services/net/java/android/net/util/{InterfaceSet,InterfaceParams,NetdService,PrefixUtils,SharedLog,VersionedBroadcastListener}.java
  • frameworks/base/core/java/android/net/{ITetheringEventCallback,ITetheringStatsProvider}.aidl
  • frameworks/base/core/java/android/net/{NetworkUtils,util/IpUtils}.java
  • frameworks/base/core/java/com/android/internal/util/{BitUtils,IndentingPrintWriter,State,StateMachine}.java
  • frameworks/base/core/java/com/android/server/connectivity/MockableSystemProperties.java
  • frameworks/base/core/java/android/os/INetworkManagementService.aidl
  • frameworks/base/core/java/android/bluetooth/BluetoothPan.java
  • frameworks/base/services/core/jni/com_android_server_connectivity_tethering_OffloadHardwareInterface.cpp
  • packages/apps/Settings/src/com/android/settings/wifi/tether/TetherService.java
  • packages/apps/Settings/src/com/android/settings/network/TetherProvisioningActivity.java

Module format

The Tethering module (com.google.android.tethering) is in APEX format and is available for devices running Android 11 or higher.

Include ConnectivityService

From Android 12, the ConnectivityService code that implements the central component of L3+ connectivity is added to the Tethering APEX. The scope of Tethering expands into a Connectivity module.

Module dependencies

The Tethering module has the following dependencies:

  • Public and system API methods in the system server
  • Stable AIDL IPCs interface with the system server
  • tetheroffload HIDL (defined in hardware/interfaces/tetheroffload/)
  • DHCP server (part of the Network Stack module)

Customization

The Tethering module doesn't support customization.

Testing

The Android Compatibility Test Suite (CTS) verifies functionality of the Tethering module.