Receive all the resolver info from ConnectivityService
Note that as of this change we still only program bionic with one
set of servers (TLS if available, locally assigned otherwise). This
will be remedied in a future change.
Test: ./system/netd/tests/runtests.sh
Test: manual testing of opportunistic and strictm mode works
Bug: 34953048
Bug: 64133961
Bug: 72345192
Change-Id: I6a0ec6672ce88e61118b34ed03818bbf53158103
diff --git a/tests/binder_test.cpp b/tests/binder_test.cpp
index c26705e..6ab98dc 100644
--- a/tests/binder_test.cpp
+++ b/tests/binder_test.cpp
@@ -751,6 +751,7 @@
}
TEST_F(BinderTest, TestSetResolverConfiguration_Tls) {
+ const std::vector<std::string> LOCALLY_ASSIGNED_DNS{"8.8.8.8", "2001:4860:4860::8888"};
std::vector<uint8_t> fp(SHA256_SIZE);
std::vector<uint8_t> short_fp(1);
std::vector<uint8_t> long_fp(SHA256_SIZE + 1);
@@ -762,13 +763,14 @@
const std::string tlsName;
const std::vector<std::vector<uint8_t>> tlsFingerprints;
const int expectedReturnCode;
- } kTestData[] = {
+ } kTlsTestData[] = {
{ {"192.0.2.1"}, "", {}, 0 },
{ {"2001:db8::2"}, "host.name", {}, 0 },
{ {"192.0.2.3"}, "@@@@", { fp }, 0 },
{ {"2001:db8::4"}, "", { fp }, 0 },
- { {"192.0.*.5"}, "", {}, EINVAL },
+ { {}, "", {}, 0 },
{ {""}, "", {}, EINVAL },
+ { {"192.0.*.5"}, "", {}, EINVAL },
{ {"2001:dg8::6"}, "", {}, EINVAL },
{ {"2001:db8::c"}, "", { short_fp }, EINVAL },
{ {"192.0.2.12"}, "", { long_fp }, EINVAL },
@@ -776,16 +778,16 @@
{ {"192.0.2.14"}, "", { fp, short_fp }, EINVAL },
};
- for (unsigned int i = 0; i < arraysize(kTestData); i++) {
- const auto &td = kTestData[i];
+ for (unsigned int i = 0; i < arraysize(kTlsTestData); i++) {
+ const auto &td = kTlsTestData[i];
std::vector<std::string> fingerprints;
for (const auto& fingerprint : td.tlsFingerprints) {
fingerprints.push_back(base64Encode(fingerprint));
}
binder::Status status = mNetd->setResolverConfiguration(
- test_netid, td.servers, test_domains, test_params,
- true, td.tlsName, fingerprints);
+ test_netid, LOCALLY_ASSIGNED_DNS, test_domains, test_params,
+ td.tlsName, td.servers, fingerprints);
if (td.expectedReturnCode == 0) {
SCOPED_TRACE(String8::format("test case %d should have passed", i));
@@ -799,8 +801,8 @@
}
// Ensure TLS is disabled before the start of the next test.
mNetd->setResolverConfiguration(
- test_netid, kTestData[0].servers, test_domains, test_params,
- false, "", {});
+ test_netid, kTlsTestData[0].servers, test_domains, test_params,
+ "", {}, {});
}
void expectNoTestCounterRules() {