Customized hostname/address table for DNS query
- Some Android OEMs would like to create their own customized table
(hostname/address mapping lists) that the resolver looks up before
querying dns servers and gets the result directly.
- About DNS query, resolver checks system/etc/hosts first. If no data is
found, resolver will query dns from the server. We add a new parameter to
ResolverParamsParcel for OEMs to customize the table and OEMs can use
setDnsConfigurationForNetwork to create the hostname/address lists. After
OEMs create their own lists,the dns query will be following sequence.
system/ect/hosts -> customized table -> dns server
- Add test cases: GetAddrInfoFromCustTable,
GetAddrInfoFromCustTable_InvalidInput,
GetAddrInfoFromCustTable_Modify
Bug: 122998288
Test: cd packages/modules/DnsResolver && atest
Change-Id: I7a2d689de74f0076f0115e0cb20fdc028903ae86
diff --git a/ResolverController.cpp b/ResolverController.cpp
index df3f457..f25a8d9 100644
--- a/ResolverController.cpp
+++ b/ResolverController.cpp
@@ -232,7 +232,7 @@
res_params.retry_count = resolverParams.retryCount;
return resolv_set_nameservers(resolverParams.netId, resolverParams.servers,
- resolverParams.domains, res_params);
+ resolverParams.domains, res_params, resolverParams.hosts);
}
int ResolverController::getResolverInfo(int32_t netId, std::vector<std::string>* servers,