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/libnetdutils/InternetAddresses.cpp b/libnetdutils/InternetAddresses.cpp
index ebe92e8..944ed91 100644
--- a/libnetdutils/InternetAddresses.cpp
+++ b/libnetdutils/InternetAddresses.cpp
@@ -120,6 +120,11 @@
}
}
+bool IPPrefix::isUninitialized() const noexcept {
+ static const internal_::compact_ipdata empty{};
+ return mData == empty;
+}
+
std::string IPPrefix::toString() const noexcept {
return StringPrintf("%s/%d", ip().toString().c_str(), mData.cidrlen);
}