shill: Assign "Default" status to the best connection
Set the highest-ranked connection to be the "Default".
As a result, the highest priority default route will
move with the highest-ranked connection in the service
list.
Bonus changes:
* Service now formally holds a reference to the Connection
object, so call a "SetConnection" method instead of a
Create/Destroy of the HTTPProxy.
* Actually start the routing table service, and do a couple
minor fixes due to how the kernel actually accepts metric
changes.
BUG=chromium-os:7607,chromium-os:23993
TEST=New Unit Test + Manual (watch routes while inserting
USB-Ethernet on a machine connected to WiFi)
Change-Id: Iddf1ed766238d9e8adc97bb54fc12b527f86239f
Reviewed-on: https://gerrit.chromium.org/gerrit/12685
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/connection_unittest.cc b/connection_unittest.cc
index 130302c..e5b0cba 100644
--- a/connection_unittest.cc
+++ b/connection_unittest.cc
@@ -109,14 +109,14 @@
ipconfig_->properties().dns_servers,
ipconfig_->properties().domain_search));
- connection_->SetDefault(true);
+ connection_->SetIsDefault(true);
EXPECT_TRUE(connection_->is_default());
EXPECT_CALL(routing_table_,
SetDefaultMetric(kTestDeviceInterfaceIndex0,
Connection::kNonDefaultMetricBase +
kTestDeviceInterfaceIndex0));
- connection_->SetDefault(false);
+ connection_->SetIsDefault(false);
EXPECT_FALSE(connection_->is_default());
}
@@ -125,7 +125,7 @@
Connection::kDefaultMetric));
vector<std::string> empty_list;
EXPECT_CALL(resolver_, SetDNSFromLists(empty_list, empty_list));
- connection_->SetDefault(true);
+ connection_->SetIsDefault(true);
EXPECT_CALL(rtnl_handler_,
AddInterfaceAddress(kTestDeviceInterfaceIndex0, _, _));