Fix routing rules.

Fix the rules in RouteController as per the latest iteration of the routing
design: http://go/android-multinetwork-routing. Changes include:

+ The legacy tables have to be global. So remove the UID being passed in to
  modifyRoute() and remove the associated TODOs.

+ Add UID=0 rules to let the kernel access routes on privileged networks.

+ Add a UID=0 clause to the directly-connected hack, thus fixing the TODO.

+ Add the privileged_legacy table just above the legacy table, when overriding
  the default network. (The same table remains added at the top of the rule
  chain, to override VPNs, but only for CONNECTIVITY_INTERNAL-privileged apps).

Other cosmetic changes:
+ Update the names and values of the rule priorities.
+ Move the legacy table IDs to the .h file in anticipation of using them from
  bugreport / dump commands.
+ Make 'action' the first parameter consistently.

Change-Id: I6634a19ddc8062b2ef55d926c7892fff8c586106
diff --git a/server/RouteController.h b/server/RouteController.h
index 9162023..33db69f 100644
--- a/server/RouteController.h
+++ b/server/RouteController.h
@@ -29,10 +29,12 @@
     // How the routing table number is determined for route modification requests.
     enum TableType {
         INTERFACE,  // Compute the table number based on the interface index.
-        LEGACY,  // Based on the UID; such tables can override the default network routes.
-        PRIVILEGED_LEGACY,  // Based on the UID; such tables can bypass VPNs.
+        LEGACY,  // Use a fixed table that's used to override the default network.
+        PRIVILEGED_LEGACY,  // A fixed table, only modifiable by privileged apps; overrides VPNs.
     };
 
+    static const int ROUTE_TABLE_LEGACY            =   98;
+    static const int ROUTE_TABLE_PRIVILEGED_LEGACY =   99;
     static const int ROUTE_TABLE_OFFSET_FROM_INDEX = 1000;
 
     static int Init() WARN_UNUSED_RESULT;
@@ -61,9 +63,9 @@
                                   const UidRanges& uidRanges) WARN_UNUSED_RESULT;
 
     static int addRoute(const char* interface, const char* destination, const char* nexthop,
-                        TableType tableType, uid_t uid) WARN_UNUSED_RESULT;
+                        TableType tableType) WARN_UNUSED_RESULT;
     static int removeRoute(const char* interface, const char* destination, const char* nexthop,
-                           TableType tableType, uid_t uid) WARN_UNUSED_RESULT;
+                           TableType tableType) WARN_UNUSED_RESULT;
 };
 
 #endif  // NETD_SERVER_ROUTE_CONTROLLER_H