OSDN Git Service

Add default routing tables to rt_tables.
authorSreeram Ramachandran <sreeram@google.com>
Fri, 11 Jul 2014 18:45:14 +0000 (11:45 -0700)
committerSreeram Ramachandran <sreeram@google.com>
Fri, 11 Jul 2014 20:05:56 +0000 (13:05 -0700)
This is so that these tables also get dumped by bugreport / dumpstate.

Change-Id: Ia5ed8a23911d7b34ba964934dec42849f4a73824

server/RouteController.cpp

index d33c47c..0b6a50c 100644 (file)
@@ -57,6 +57,9 @@ const uint32_t ROUTE_TABLE_LEGACY_SYSTEM  = 99;
 const char* const ROUTE_TABLE_NAME_LEGACY_NETWORK = "legacy_network";
 const char* const ROUTE_TABLE_NAME_LEGACY_SYSTEM  = "legacy_system";
 
+const char* const ROUTE_TABLE_NAME_LOCAL = "local";
+const char* const ROUTE_TABLE_NAME_MAIN  = "main";
+
 // TODO: These values aren't defined by the Linux kernel, because our UID routing changes are not
 // upstream (yet?), so we can't just pick them up from kernel headers. When (if?) the changes make
 // it upstream, we'll remove this and rely on the kernel header values. For now, add a static assert
@@ -140,8 +143,13 @@ void addTableName(uint32_t table, const std::string& name, std::string* contents
 // Doesn't return success/failure as the file is optional; it's okay if we fail to update it.
 void updateTableNamesFile() {
     std::string contents;
+
+    addTableName(RT_TABLE_LOCAL, ROUTE_TABLE_NAME_LOCAL, &contents);
+    addTableName(RT_TABLE_MAIN,  ROUTE_TABLE_NAME_MAIN,  &contents);
+
     addTableName(ROUTE_TABLE_LEGACY_NETWORK, ROUTE_TABLE_NAME_LEGACY_NETWORK, &contents);
     addTableName(ROUTE_TABLE_LEGACY_SYSTEM,  ROUTE_TABLE_NAME_LEGACY_SYSTEM,  &contents);
+
     for (const auto& entry : interfaceToTable) {
         addTableName(entry.second, entry.first, &contents);
     }