Check permissions in INetworkManagementService#setIPv6AddrGenMode

This function was missing a permission check, and thus would
allow any app to transitively call the netd setIPv6AddrGenMode
IPC.

Fortunately, due to a bug in that IPC, it can only set the mode
to stable privacy and not to EUI-64.

This code is unused. The only thing on the system that sets the
IPv6 addrgen mode is the networkstack, but that does so by
calling the netd IPC directly.

Test: builds
Bug: 141920289
Change-Id: Id54431e81dceaff09f785a280ceee0973543a30f
This commit is contained in:
Lorenzo Colitti
2020-03-26 10:13:27 +09:00
parent e6b4c38f90
commit 678528ed42

View File

@@ -55,6 +55,7 @@ import android.net.IpPrefix;
import android.net.LinkAddress;
import android.net.Network;
import android.net.NetworkPolicyManager;
import android.net.NetworkStack;
import android.net.NetworkStats;
import android.net.NetworkUtils;
import android.net.RouteInfo;
@@ -874,6 +875,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
@Override
public void setIPv6AddrGenMode(String iface, int mode) throws ServiceSpecificException {
NetworkStack.checkNetworkStackPermission(mContext);
try {
mNetdService.setIPv6AddrGenMode(iface, mode);
} catch (RemoteException e) {