summaryrefslogtreecommitdiff
path: root/server/RouteController.cpp
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2017-09-26 19:13:50 +0900
committerLorenzo Colitti <lorenzo@google.com>2017-09-27 12:53:07 +0900
commit92e8f96e43320efd5183d7452fb90883fd96415e (patch)
tree15ff98ad654842679ad7cf6466e920077cf62df1 /server/RouteController.cpp
parent9a2b6aafa87a059628b34b03ae2decda19ae0695 (diff)
Don't look up the main table any more.
After https://android-review.googlesource.com/#/c/481397/ , directly-connected routes for all network types are added to the correct routing tables by ConnectivityService. So there should be no reason to look up the main table. Bug: 28825988 Test: bullhead builds, boots Test: netd_{unit,integration}_test pass Test: dual-stack wifi and IPv4-only mobile data work Change-Id: I64ba7dbf71478afcd9d2880440f93ef346116b6b
Diffstat (limited to 'server/RouteController.cpp')
-rw-r--r--server/RouteController.cpp23
1 files changed, 1 insertions, 22 deletions
diff --git a/server/RouteController.cpp b/server/RouteController.cpp
index f6c0d47b..27990759 100644
--- a/server/RouteController.cpp
+++ b/server/RouteController.cpp
@@ -67,7 +67,6 @@ const uint32_t RULE_PRIORITY_IMPLICIT_NETWORK = 19000;
const uint32_t RULE_PRIORITY_BYPASSABLE_VPN = 20000;
const uint32_t RULE_PRIORITY_VPN_FALLTHROUGH = 21000;
const uint32_t RULE_PRIORITY_DEFAULT_NETWORK = 22000;
-const uint32_t RULE_PRIORITY_DIRECTLY_CONNECTED = 23000;
const uint32_t RULE_PRIORITY_UNREACHABLE = 32000;
const uint32_t ROUTE_TABLE_LOCAL_NETWORK = 97;
@@ -678,22 +677,6 @@ int configureDummyNetwork() {
return 0;
}
-// Add a new rule to look up the 'main' table, with the same selectors as the "default network"
-// rule, but with a lower priority. We will never create routes in the main table; it should only be
-// used for directly-connected routes implicitly created by the kernel when adding IP addresses.
-// This is necessary, for example, when adding a route through a directly-connected gateway: in
-// order to add the route, there must already be a directly-connected route that covers the gateway.
-WARN_UNUSED_RESULT int addDirectlyConnectedRule() {
- Fwmark fwmark;
- Fwmark mask;
-
- fwmark.netId = NETID_UNSET;
- mask.netId = FWMARK_NET_ID_MASK;
-
- return modifyIpRule(RTM_NEWRULE, RULE_PRIORITY_DIRECTLY_CONNECTED, RT_TABLE_MAIN,
- fwmark.intValue, mask.intValue, IIF_NONE, OIF_NONE, UID_ROOT, UID_ROOT);
-}
-
// Add an explicit unreachable rule close to the end of the prioriy list to make it clear that
// relying on the kernel-default "from all lookup main" rule at priority 32766 is not intended
// behaviour. We do flush the kernel-default rules at startup, but having an explicit unreachable
@@ -844,8 +827,7 @@ WARN_UNUSED_RESULT int modifyTetheredNetwork(uint16_t action, const char* inputI
inputInterface, OIF_NONE, INVALID_UID, INVALID_UID);
}
-// Adds or removes an IPv4 or IPv6 route to the specified table and, if it's a directly-connected
-// route, to the main table as well.
+// Adds or removes an IPv4 or IPv6 route to the specified table.
// Returns 0 on success or negative errno on failure.
WARN_UNUSED_RESULT int modifyRoute(uint16_t action, const char* interface, const char* destination,
const char* nexthop, RouteController::TableType tableType) {
@@ -947,9 +929,6 @@ int RouteController::Init(unsigned localNetId) {
if (int ret = addLocalNetworkRules(localNetId)) {
return ret;
}
- if (int ret = addDirectlyConnectedRule()) {
- return ret;
- }
if (int ret = addUnreachableRule()) {
return ret;
}