Support legacy routes added by apps via ensureRouteToHost().
This adds the routes to two fixed tables:
+ LEGACY, which has higher priority than other non-explicit lookup tables
(per-network and default network).
+ PRIVILEGED_LEGACY, available only to system apps and has higher priority than
VPNs (system apps are those with the CONNECTIVITY_INTERNAL permission).
This will be changed to per-UID tables once the kernel supports UID-based
routing, so that these legacy routes are scoped to each app and not global.
Also, fix a TODO: The framework (as of http://ag/471599) will not set the
gateway argument if it's actually a direct-connected route.
Change-Id: I0ee1ca89fdc859d75a89021ca8c1902811b1e4a9
diff --git a/server/NetworkController.h b/server/NetworkController.h
index 27785d3..30c9142 100644
--- a/server/NetworkController.h
+++ b/server/NetworkController.h
@@ -68,9 +68,9 @@
// Routes are added to tables determined by the interface, so only |interface| is actually used.
// |netId| is given only to sanity check that the interface has the correct netId.
bool addRoute(unsigned netId, const char* interface, const char* destination,
- const char* nexthop);
+ const char* nexthop, bool legacy, unsigned uid);
bool removeRoute(unsigned netId, const char* interface, const char* destination,
- const char* nexthop);
+ const char* nexthop, bool legacy, unsigned uid);
bool isValidNetwork(unsigned netId) const;
@@ -80,7 +80,7 @@
typedef std::pair<InterfaceIterator, InterfaceIterator> InterfaceRange;
bool modifyRoute(unsigned netId, const char* interface, const char* destination,
- const char* nexthop, bool add);
+ const char* nexthop, bool add, bool legacy, unsigned uid);
struct UidEntry {
int uid_start;