Fix enable/disableInterface APIs to properly affect administrative state

Previously, enable/disableInterface APIs just called
updateInterfaceState to pretend the link went up / down. This behavior
was fundamentally broken, as any RTM_NEWLINK message would "reset" the
interface to its actual link state.

This change now properly toggles IFF_UP on the interface when
enable/disableInterface() is called using netd APIs. A notable
side-effect of these APIs is that they remove (and later readd) the IPv4
address on the interface. This causes a provisioning failure when trying
to enable an already-enabled interface. However, in its current state,
this should only result in an IpClient restart.
In the longer term, these netd API calls should be replaced with using
netlink directly (the necessary permissions are already in place).

Test: atest EthernetManagerTest
Bug: 316268558
Bug: 225315248
Change-Id: I4a0c7f6eedb8c8768f7736b5033584d520d7e11a
1 file changed