diff options
| author | Ken Chen <cken@google.com> | 2021-04-04 11:28:06 +0800 |
|---|---|---|
| committer | Ken Chen <cken@google.com> | 2021-05-11 16:06:25 +0800 |
| commit | ab5f347b7f50e8a47940c53334e2c9bac490309d (patch) | |
| tree | 1809f8d7194c2afbb83bf142b11eb20cde3df0f1 /server/NetworkController.cpp | |
| parent | ed4bf44206bd7b896fff4add0339b46db812fa70 (diff) | |
Add networkCreate API. Deprecate networkCreate[Physical/Vpn]
OEMs need VPN type information in Netd for customization. According to
stable AIDL rules, Netd can neither extend parameters in the existing
networkCreateVpn, nor add a new API with the identical name (function
overloading). Thus, add an extensible API which can create physical
network, virtual network, and so on. Deprecate networkCreatePhysical
and networkCreateVpn.
Bug: 171872481
Test: atest
Change-Id: I9094593c902d91d90a8210960c608f0a50f163ff
Diffstat (limited to 'server/NetworkController.cpp')
| -rw-r--r-- | server/NetworkController.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/server/NetworkController.cpp b/server/NetworkController.cpp index 1d68b201..ff52db5b 100644 --- a/server/NetworkController.cpp +++ b/server/NetworkController.cpp @@ -437,7 +437,7 @@ int NetworkController::createPhysicalOemNetwork(Permission permission, unsigned return ret; } -int NetworkController::createVirtualNetwork(unsigned netId, bool secure) { +int NetworkController::createVirtualNetwork(unsigned netId, bool secure, NativeVpnType vpnType) { ScopedWLock lock(mRWLock); if (!(MIN_NET_ID <= netId && netId <= MAX_NET_ID)) { @@ -450,6 +450,11 @@ int NetworkController::createVirtualNetwork(unsigned netId, bool secure) { return -EEXIST; } + if (vpnType < NativeVpnType::SERVICE || NativeVpnType::OEM < vpnType) { + ALOGE("invalid vpnType %d", static_cast<int>(vpnType)); + return -EINVAL; + } + if (int ret = modifyFallthroughLocked(netId, true)) { return ret; } |
