tethering flow graph

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
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值