shill: connection: Flush routes when default connection changes
Also be more verbose with address configuration.
BUG=None
TEST=Unit tests
Change-Id: I7a419f416e6ed6b583d57a06b7be42ed37933593
Reviewed-on: https://gerrit.chromium.org/gerrit/24936
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/connection.cc b/connection.cc
index 476216e..071ce8c 100644
--- a/connection.cc
+++ b/connection.cc
@@ -131,22 +131,27 @@
return;
}
- IPAddress gateway_address(properties.address_family);
+ IPAddress gateway(properties.address_family);
if (!properties.gateway.empty() &&
- !gateway_address.SetAddressFromString(properties.gateway)) {
+ !gateway.SetAddressFromString(properties.gateway)) {
LOG(ERROR) << "Gateway address " << properties.peer_address
<< " is invalid";
return;
}
- if (!FixGatewayReachability(&local, &peer, gateway_address)) {
+ if (!FixGatewayReachability(&local, &peer, gateway)) {
LOG(WARNING) << "Expect limited network connectivity.";
}
+ LOG(INFO) << __func__ << ": Installing with parameters:"
+ << " local=" << local.ToString()
+ << " broadcast=" << broadcast.ToString()
+ << " peer=" << peer.ToString()
+ << " gateway=" << gateway.ToString();
rtnl_handler_->AddInterfaceAddress(interface_index_, local, broadcast, peer);
- if (gateway_address.IsValid()) {
- routing_table_->SetDefaultRoute(interface_index_, gateway_address,
+ if (gateway.IsValid()) {
+ routing_table_->SetDefaultRoute(interface_index_, gateway,
GetMetric(is_default_));
}
@@ -185,6 +190,7 @@
device->RequestPortalDetection();
}
}
+ routing_table_->FlushCache();
}
void Connection::RequestRouting() {