Merge "Address leftover comments on aosp/2194515"
diff --git a/server/RouteController.h b/server/RouteController.h
index 1b3a093..0d4e2b9 100644
--- a/server/RouteController.h
+++ b/server/RouteController.h
@@ -85,13 +85,6 @@
constexpr int32_t RULE_PRIORITY_UNREACHABLE = 32000;
// clang-format on
-static const char* V4_FIXED_LOCAL_PREFIXES[] = {
- // The multicast range is 224.0.0.0/4 but only limit it to 224.0.0.0/24 since the IPv4
- // definitions are not as precise as for IPv6, it is the only range that the standards
- // (RFC 2365 and RFC 5771) specify is link-local and must not be forwarded.
- "224.0.0.0/24" // Link-local multicast; non-internet routable
-};
-
class UidRanges;
class RouteController {
@@ -205,6 +198,14 @@
private:
friend class RouteControllerTest;
+ // An expandable array for fixed local prefix though it's only one element now.
+ static constexpr const char* V4_FIXED_LOCAL_PREFIXES[] = {
+ // The multicast range is 224.0.0.0/4 but only limit it to 224.0.0.0/24 since the IPv4
+ // definitions are not as precise as for IPv6, it is the only range that the standards
+ // (RFC 2365 and RFC 5771) specify is link-local and must not be forwarded.
+ "224.0.0.0/24" // Link-local multicast; non-internet routable
+ };
+
static std::mutex sInterfaceToTableLock;
static std::map<std::string, uint32_t> sInterfaceToTable GUARDED_BY(sInterfaceToTableLock);
diff --git a/tests/binder_test.cpp b/tests/binder_test.cpp
index 2ca21ff..0709204 100644
--- a/tests/binder_test.cpp
+++ b/tests/binder_test.cpp
@@ -138,7 +138,6 @@
using android::net::TunInterface;
using android::net::UidRangeParcel;
using android::net::UidRanges;
-using android::net::V4_FIXED_LOCAL_PREFIXES;
using android::net::mdns::aidl::DiscoveryInfo;
using android::net::mdns::aidl::GetAddressInfo;
using android::net::mdns::aidl::IMDns;
@@ -1689,6 +1688,10 @@
{IP_RULE_V6, "2001:db8::/32", ""},
};
+ // This should ba aligned with V4_FIXED_LOCAL_PREFIXES in system/netd/server/RouteController.cpp
+ // An expandable array for fixed local prefix though it's only one element now.
+ static const char* kV4LocalPrefixes[] = {"224.0.0.0/24"};
+
// Add test physical network
const auto& config = makeNativeNetworkConfig(TEST_NETID1, NativeNetworkType::PHYSICAL,
INetd::PERMISSION_NONE, false, false);
@@ -1705,8 +1708,8 @@
std::string localTableName = std::string(sTun.name() + "_local");
// Verify the fixed routes exist in the local table.
- for (size_t i = 0; i < std::size(V4_FIXED_LOCAL_PREFIXES); i++) {
- expectNetworkRouteExists(IP_RULE_V4, sTun.name(), V4_FIXED_LOCAL_PREFIXES[i], "",
+ for (size_t i = 0; i < std::size(kV4LocalPrefixes); i++) {
+ expectNetworkRouteExists(IP_RULE_V4, sTun.name(), kV4LocalPrefixes[i], "",
localTableName.c_str());
}