Fix regressions in flushRoutes().

http://ag/486276 left out a comma, causing the command to be "routeflush" (which
is invalid), instead of the correct "route flush".

http://ag/495068 changed the order, causing the interface to be removed from the
interfaceToIndex map before we are done using it in modifyPerNetworkRules().

Change-Id: I65af0b5763b13e47b48e7e2b81d243dc19e1a03b
diff --git a/server/RouteController.cpp b/server/RouteController.cpp
index 5d8cc0f..799a531 100644
--- a/server/RouteController.cpp
+++ b/server/RouteController.cpp
@@ -567,7 +567,7 @@
         const char* argv[] = {
             IP_PATH,
             IP_VERSIONS[i],
-            "route"
+            "route",
             "flush",
             "table",
             tableString,
@@ -642,11 +642,11 @@
 
 int RouteController::removeInterfaceFromNetwork(unsigned netId, const char* interface,
                                                 Permission permission) {
-    if (int ret = flushRoutes(interface)) {
+    if (int ret = modifyPerNetworkRules(netId, interface, 0, permission, INVALID_UID, INVALID_UID,
+                                        false, true)) {
         return ret;
     }
-    return modifyPerNetworkRules(netId, interface, 0, permission, INVALID_UID, INVALID_UID, false,
-                                 true);
+    return flushRoutes(interface);
 }
 
 int RouteController::addInterfaceToVpn(unsigned netId, const char* interface,
@@ -656,10 +656,10 @@
 
 int RouteController::removeInterfaceFromVpn(unsigned netId, const char* interface,
                                             const UidRanges& uidRanges) {
-    if (int ret = flushRoutes(interface)) {
+    if (int ret = modifyVpnRules(netId, interface, uidRanges, false, true)) {
         return ret;
     }
-    return modifyVpnRules(netId, interface, uidRanges, false, true);
+    return flushRoutes(interface);
 }
 
 int RouteController::modifyNetworkPermission(unsigned netId, const char* interface,