shill: Delete existing routes when the device is started.

BUG=chromium-os:27358
TEST=Unit tests, network_WiFiManager, manually add foreign routes and
ensure they are deleted, also test to make sure default route remains
after DHCP renewal

Change-Id: Ic26b70d685491f31699ff4684ed289e76af8a9ca
Reviewed-on: https://gerrit.chromium.org/gerrit/17640
Commit-Ready: Thieu Le <thieule@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
diff --git a/routing_table.cc b/routing_table.cc
index b0f606d..bfc761f 100644
--- a/routing_table.cc
+++ b/routing_table.cc
@@ -136,9 +136,6 @@
                                    uint32 metric) {
   VLOG(2) << __func__ << " index " << interface_index << " metric " << metric;
 
-  // Delete routes that we did not explicitly create.
-  FlushRoutes(interface_index, false);
-
   const IPConfig::Properties &ipconfig_props = ipconfig->properties();
   RoutingTableEntry *old_entry;
   IPAddress gateway_address(ipconfig_props.address_family);
@@ -175,7 +172,7 @@
                                     false));
 }
 
-void RoutingTable::FlushRoutes(int interface_index, bool all_routes) {
+void RoutingTable::FlushRoutes(int interface_index) {
   VLOG(2) << __func__;
 
   base::hash_map<int, vector<RoutingTableEntry> >::iterator table =
@@ -188,10 +185,9 @@
   vector<RoutingTableEntry>::iterator nent;
 
   for (nent = table->second.begin(); nent != table->second.end(); ++nent) {
-    if (all_routes ||
-        (nent->from_rtnl && nent->dst.family() == IPAddress::kFamilyIPv4))
       ApplyRoute(interface_index, *nent, RTNLMessage::kModeDelete, 0);
   }
+  table->second.clear();
 }
 
 void RoutingTable::ResetTable(int interface_index) {