Synthesize DNS64 prefix in netd
Synthesize DNS64 prefix with IPv4 dns query result in the following
conditions:
1. If specify address family to IPv6 and no IPv6 addresses result is
obtained, then if IPv4 addresses result could be obtained
2. If address family is unspecified and query results are all IPv4
addresses
Test: built, flashed, booted
system/netd/tests/runtests.sh passes
Bug: 78545619
Change-Id: Ia7c5963c054772f8c95b95849282e9d9d5761515
diff --git a/server/ResolverController.h b/server/ResolverController.h
index 09e27c2..b44d212 100644
--- a/server/ResolverController.h
+++ b/server/ResolverController.h
@@ -21,6 +21,7 @@
#include <vector>
#include "Dns64Configuration.h"
+#include "netdutils/InternetAddresses.h"
struct __res_params;
@@ -32,7 +33,9 @@
class ResolverController {
public:
- ResolverController(const NetworkController& netCtrl) : mDns64Configuration(netCtrl) {}
+ ResolverController(const NetworkController& netCtrl)
+ : mDns64Configuration(netCtrl, std::bind(&ResolverController::sendNat64PrefixEvent, this,
+ std::placeholders::_1)) {}
~ResolverController() {}
@@ -48,6 +51,8 @@
std::vector<std::string>* domains, __res_params* params,
std::vector<android::net::ResolverStats>* stats);
+ int getPrefix64(unsigned netId, netdutils::IPPrefix* prefix);
+
// Binder specific functions, which convert between the binder int/string arrays and the
// actual data structures, and call setDnsServer() / getDnsInfo() for the actual processing.
int setResolverConfiguration(int32_t netId, const std::vector<std::string>& servers,
@@ -59,12 +64,13 @@
std::vector<std::string>* domains, std::vector<std::string>* tlsServers,
std::vector<int32_t>* params, std::vector<int32_t>* stats);
+ void sendNat64PrefixEvent(const net::Dns64Configuration::Nat64PrefixInfo& args);
+
void dump(DumpWriter& dw, unsigned netId);
private:
Dns64Configuration mDns64Configuration;
};
-
} // namespace net
} // namespace android