shill: Connection: Create a link route if we are bound
Due to the behavior of some VPN servers, we may lose our route
to the default gateway of a physical interface due to the routes
assigned by a virtual interfaces. To avert this, set a host route
for the default gateway as we bind a lower connection.
BUG=chromium-os:32643
TEST=New unit tests; tried on a known-misbehaving net (actually
working from there right now); VPN autotests
Change-Id: I68db1da339f61c415f9ba8c2c26d8cdb0276b209
Reviewed-on: https://gerrit.chromium.org/gerrit/27705
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/ip_address.cc b/ip_address.cc
index 2ddaeb0..33e4c07 100644
--- a/ip_address.cc
+++ b/ip_address.cc
@@ -210,7 +210,7 @@
return out;
}
-IPAddress IPAddress::MaskWith(const IPAddress &b) {
+IPAddress IPAddress::MaskWith(const IPAddress &b) const {
CHECK(IsValid());
CHECK(b.IsValid());
CHECK_EQ(family(), b.family());
@@ -221,7 +221,7 @@
return IPAddress(family(), address_bytes);
}
-IPAddress IPAddress::MergeWith(const IPAddress &b) {
+IPAddress IPAddress::MergeWith(const IPAddress &b) const {
CHECK(IsValid());
CHECK(b.IsValid());
CHECK_EQ(family(), b.family());
@@ -232,7 +232,7 @@
return IPAddress(family(), address_bytes);
}
-IPAddress IPAddress::GetNetworkPart() {
+IPAddress IPAddress::GetNetworkPart() const {
return MaskWith(GetAddressMaskFromPrefix(family(), prefix()));
}
@@ -243,7 +243,7 @@
return MergeWith(IPAddress(family(), broadcast_bytes));
}
-bool IPAddress::CanReachAddress(const IPAddress &b) {
+bool IPAddress::CanReachAddress(const IPAddress &b) const {
CHECK_EQ(family(), b.family());
IPAddress b_prefixed(b);
b_prefixed.set_prefix(prefix());