diff options
| author | Lorenzo Colitti <lorenzo@google.com> | 2018-12-18 19:16:12 +0900 |
|---|---|---|
| committer | Lorenzo Colitti <lorenzo@google.com> | 2018-12-19 18:49:32 +0900 |
| commit | afaaa8edd218fa8257b6173a46cb39ffd30c9aa0 (patch) | |
| tree | ebb68c132a7a069dfeec720c0592517a389fad05 /server/NetworkController.cpp | |
| parent | 3efd988362c48071a3e3aafb40c00c3b4a6de07a (diff) | |
Use dlopen() and dlsym() for resolver functions
This is a workaround to allow us to use libnetd_resolv.so from
the resolver APEX before b/120661824 is fixed.
Test: builds, boots
Test: system/netd/tests/runtests.sh
Test: atest FrameworksNetTests android.net.cts.ConnectivityManagerTest
Change-Id: I752ae248bb59545b0a4fbc1a7b8c9bcd697a31d4
Diffstat (limited to 'server/NetworkController.cpp')
| -rw-r--r-- | server/NetworkController.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/server/NetworkController.cpp b/server/NetworkController.cpp index 575a0bc6..50e1275c 100644 --- a/server/NetworkController.cpp +++ b/server/NetworkController.cpp @@ -30,6 +30,7 @@ #include <android-base/strings.h> #include <netd_resolv/resolv.h> +#include <netd_resolv/resolv_stub.h> #include "android/net/INetd.h" #include "cutils/misc.h" @@ -220,7 +221,8 @@ uint32_t NetworkController::getNetworkForDnsLocked(unsigned* netId, uid_t uid) c // servers (through the default network). Otherwise, the query is guaranteed to fail. // http://b/29498052 Network *network = getNetworkLocked(*netId); - if (network && network->getType() == Network::VIRTUAL && !resolv_has_nameservers(*netId)) { + if (network && network->getType() == Network::VIRTUAL && + !RESOLV_STUB.resolv_has_nameservers(*netId)) { *netId = mDefaultNetId; } } else { @@ -229,7 +231,7 @@ uint32_t NetworkController::getNetworkForDnsLocked(unsigned* netId, uid_t uid) c // them). Otherwise, use the default network's DNS servers. We cannot set the explicit bit // because we need to be able to fall through a split tunnel to the default network. VirtualNetwork* virtualNetwork = getVirtualNetworkForUserLocked(uid); - if (virtualNetwork && resolv_has_nameservers(virtualNetwork->getNetId())) { + if (virtualNetwork && RESOLV_STUB.resolv_has_nameservers(virtualNetwork->getNetId())) { *netId = virtualNetwork->getNetId(); } else { // TODO: return an error instead of silently doing the DNS lookup on the wrong network. @@ -471,7 +473,7 @@ int NetworkController::destroyNetwork(unsigned netId) { } mNetworks.erase(netId); delete network; - resolv_delete_cache_for_net(netId); + RESOLV_STUB.resolv_delete_cache_for_net(netId); for (auto iter = mIfindexToLastNetId.begin(); iter != mIfindexToLastNetId.end();) { if (iter->second == netId) { |
