tethering flow graph

来源:互联网 发布:申请网络出版 编辑:程序博客网 时间:2024/05/25 08:14

just simple flow of code(for android kitkat and earier versions, while even the latest versions do not change much).

for quick ref only.

Android tethering subsystem in fact base on the NAT mechanisms like all other linux systems.

tethering flow

for above flow, the chooseUpstreamType()/cleanupUpstram() controll the connection of extral interface, or WAN interface.

from Tethering part, WAN interfaces are controlled by MasterStateMachine, and InterfaceStateMachine stands for LAN(or internal) interfaces. while all tethering APIs are exported from ConnectivityService but not Tethering itself.(Vpn works the same for API export.)

mNMService is and proxy of network framework service to provide all network management related APIs. here it provides ipforward(setIpForwardingEnable) / dhcp & Dns forward server(startTethering & setDnsForwarders) and NAT(enableNat) by sending related operation commands into android native service Netd.

Netd would call the target function modules to implement the requests.

more arch related for network framework(the left is android framework part, and the right is Netd mechanisms, connected by unix socket)

::

android do not provided tether for ipv6 protocol, while you can impl that by just following the ipv4 logic. besides that, you'll need to import some other modules that take the same role of dnsmasq(for ipv4), like dhcpcd or the famous radvd.

0 0
原创粉丝点击