summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/NetworkController.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/server/NetworkController.cpp b/server/NetworkController.cpp
index 082eaf84..3e38d48e 100644
--- a/server/NetworkController.cpp
+++ b/server/NetworkController.cpp
@@ -825,7 +825,10 @@ int NetworkController::setNetworkAllowlist(
bool NetworkController::isUidAllowed(unsigned netId, uid_t uid) const {
const ScopedRLock lock(mRWLock);
Network* network = getNetworkLocked(netId);
- if (network && network->isUidAllowed(uid)) {
+ // Exempt when no netId is specified and there is no default network, so that apps or tests can
+ // do DNS lookups for hostnames in etc/hosts.
+ if ((network && network->isUidAllowed(uid)) ||
+ (netId == NETID_UNSET && mDefaultNetId == NETID_UNSET)) {
return true;
}
return false;