From 0321315d4e94dacd5ef2e0de217059cbc72d803d Mon Sep 17 00:00:00 2001 From: Sreeram Ramachandran Date: Thu, 30 Oct 2014 10:01:07 -0700 Subject: Don't fail when trying to add routes that already exist. Previously, we suppressed failures for the special case of requestRouteToHost() being called multiple times. Turns out that other parts of the system also try to add duplicate routes, so just suppress EEXIST errors in general (as far as adding routes is concerned). For example, this happens when the WiFi P2P DHCP client renews its lease and blindly requests to add a route that it had already added before. (cherry picked from commit 64166e7666e3cc7f4b9c715f2b4e19d28ae44c5a) Bug: 17205769 Change-Id: I11d50052f616cb48a912d647b8024ccef01b736d --- server/RouteController.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'server/RouteController.cpp') diff --git a/server/RouteController.cpp b/server/RouteController.cpp index 4cb145b2b..56e3c2866 100644 --- a/server/RouteController.cpp +++ b/server/RouteController.cpp @@ -815,11 +815,8 @@ WARN_UNUSED_RESULT int modifyRoute(uint16_t action, const char* interface, const } int ret = modifyIpRoute(action, table, interface, destination, nexthop); - // We allow apps to call requestRouteToHost() multiple times with the same route, so ignore - // EEXIST failures when adding routes to legacy tables. - if (ret && !(action == RTM_NEWROUTE && ret == -EEXIST && - (tableType == RouteController::LEGACY_NETWORK || - tableType == RouteController::LEGACY_SYSTEM))) { + // Trying to add a route that already exists shouldn't cause an error. + if (ret && !(action == RTM_NEWROUTE && ret == -EEXIST)) { return ret; } -- cgit v1.2.3