diff options
| author | Ken Chen <cken@google.com> | 2021-12-10 02:41:05 +0800 |
|---|---|---|
| committer | Ken Chen <cken@google.com> | 2021-12-13 21:43:38 +0800 |
| commit | 53360bf94ce9cb2cf8c8e90b0fa40259192c8356 (patch) | |
| tree | 7514df761b08bf75bde53853d60bb75bed73b57c /server/NetworkController.cpp | |
| parent | 13a592453d95a63f64ca325931f645f9d9be1d68 (diff) | |
Keep subPriority in int
Signed integer gives us flexibility to use negative number (like -1)
for special purposes in the future.
Bug: N/A
Test: atest
Change-Id: I1e930459c9ed9d3834613473430c9570dc1a302a
Diffstat (limited to 'server/NetworkController.cpp')
| -rw-r--r-- | server/NetworkController.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/server/NetworkController.cpp b/server/NetworkController.cpp index fa6948c9..3f337a76 100644 --- a/server/NetworkController.cpp +++ b/server/NetworkController.cpp @@ -619,7 +619,7 @@ int isWrongNetworkForUidRanges(unsigned netId, Network* network) { } // namespace int NetworkController::addUsersToNetwork(unsigned netId, const UidRanges& uidRanges, - uint32_t subPriority) { + int32_t subPriority) { ScopedWLock lock(mRWLock); Network* network = getNetworkLocked(netId); if (int ret = isWrongNetworkForUidRanges(netId, network)) { @@ -629,7 +629,7 @@ int NetworkController::addUsersToNetwork(unsigned netId, const UidRanges& uidRan } int NetworkController::removeUsersFromNetwork(unsigned netId, const UidRanges& uidRanges, - uint32_t subPriority) { + int32_t subPriority) { ScopedWLock lock(mRWLock); Network* network = getNetworkLocked(netId); if (int ret = isWrongNetworkForUidRanges(netId, network)) { @@ -801,7 +801,7 @@ Network* NetworkController::getNetworkLocked(unsigned netId) const { } VirtualNetwork* NetworkController::getVirtualNetworkForUserLocked(uid_t uid) const { - uint32_t subPriority; + int32_t subPriority; for (const auto& [_, network] : mNetworks) { if (network->isVirtual() && network->appliesToUser(uid, &subPriority)) { return static_cast<VirtualNetwork*>(network); @@ -816,9 +816,9 @@ VirtualNetwork* NetworkController::getVirtualNetworkForUserLocked(uid_t uid) con // undefined. That is a configuration error. Network* NetworkController::getPhysicalOrUnreachableNetworkForUserLocked(uid_t uid) const { Network* bestNetwork = nullptr; - unsigned bestSubPriority = UidRanges::LOWEST_SUB_PRIORITY + 1; + int32_t bestSubPriority = UidRanges::LOWEST_SUB_PRIORITY + 1; for (const auto& [netId, network] : mNetworks) { - uint32_t subPriority; + int32_t subPriority; if (!network->isPhysical() && !network->isUnreachable()) continue; if (!network->appliesToUser(uid, &subPriority)) continue; if (subPriority < bestSubPriority) { @@ -854,7 +854,7 @@ int NetworkController::checkUserNetworkAccessLocked(uid_t uid, unsigned netId) c return 0; } // If the UID wants to use a VPN, it can do so if and only if the VPN applies to the UID. - uint32_t subPriority; + int32_t subPriority; if (network->isVirtual()) { return network->appliesToUser(uid, &subPriority) ? 0 : -EPERM; } |
