Track local network ifindices in sInterfaceToTable as well.
RouteController tracks in the sInterfaceToTable map the the interface indices of every interface used in physical and virtual networks. This ensures that when an interface is removed from a network (by passing in the interface name), the rules (which specify interface indices) are correctly deleted even if the interface has been deleted or has been deleted and re-added with a new interface index. Currently this does not happen for interfaces added to the local network. That means that when those interfaces are deleted, the rules might not be deleted. It also results in spurious messages logged by NetworkController such as: 03-24 00:38:47.553 16612 16635 E Netd : getIfIndex: cannot find interface testtap1 03-24 00:38:47.553 16612 16635 E Netd : inconceivable! added interface testtap1 with no index Note that since P this map is read by RouteController::getIfIndex and used by code that assumes this will always return an interface index. In the case of an interface in the local network, this is not possible because the map stores mappings between ifindex and routing table. In the case of the local network, the routing table is always ROUTE_TABLE_LOCAL_NETWORK, so there is no way to get the interface index. Fix these callers so they do not attempt do to this. Bug: 150644681 Test: TetheringIntegrationTests:EthernetTetheringTest Original-Change: https://android-review.googlesource.com/1277438 Merged-In: I8042e5b91bcb3175d9ad540526df396a139976f0 Change-Id: I8042e5b91bcb3175d9ad540526df396a139976f0
Loading
Please register or sign in to comment