I've spent a few hours reading the AOSP source to try to find how and where "ip link" or "ifconfig" is invoked when eth0 needs to be brought up.
Does Android 10 use "ip link" or "ifconfig" to set the address and bring up eth0?
Or does it manipulate the network interfaces in some other way?
Since you mentioned eth0
, I'll assume you're interested in Ethernet interfaces. Each transport type has its own way for managing IP provisioning. For ethernet interfaces, you can find the owning class at EthernetNetworkFactory
link. The method you are interested in seeing how this works is EthernetNetworkFactory#provisionIpClient
link.
Ultimately if you follow the code, you'll see this eventually arrive at netd here in NetdNativeService#interfaceAddAddress
link. At this point we're in the native layer.
This then ultimately arrives at ifc_utils#ifc_act_on_address
link. This is where the ip address will ultimately be added to the ethernet interface. After all of this detective work, we see in this function that a socket
is opened to send a NETLINK_ROUTE
message link to set the ip address.