shill: Support of DNS auto fallback
Automatically switch to fallback DNS server when broken DNS setting
is detected. This feature is disabled by default (due to property
defaulting to "false").
BUG=chromium:377056
TEST=unit tests, manual test
1. Manually update the code to allow DNS auto fallback.
2. Connect a chrome device to GoogleGuest.
3. Update the name servers setting to an invalid
DNS server "192.168.1.1"
4. Browse to "chrome://net-internals/#dns", and verify
the nameserver changed from "192.168.1.1" to Google's
DNS servers "8.8.8.8" and "8.8.4.4" within a minute.
CQ-DEPEND=CL:201412
Change-Id: I31dbaf715b5b11dd2f736e0664ee432e55bdeeb9
Reviewed-on: https://chromium-review.googlesource.com/207155
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
diff --git a/service.h b/service.h
index fd02b7d..486a62b 100644
--- a/service.h
+++ b/service.h
@@ -69,6 +69,7 @@
// crbug.com/208736
static const char kStorageAutoConnect[];
static const char kStorageCheckPortal[];
+ static const char kStorageDNSAutoFallback[];
static const char kStorageError[];
static const char kStorageFavorite[];
static const char kStorageGUID[];
@@ -202,6 +203,12 @@
return state() == kStatePortal;
}
+ // Return true if service is allowed to automatically switch to fallback
+ // DNS server.
+ virtual bool is_dns_auto_fallback_allowed() const {
+ return is_dns_auto_fallback_allowed_;
+ }
+
virtual ConnectFailure failure() const { return failure_; }
// Sets the |previous_error_| property based on the current |failure_|, and
// sets a serial number for this failure.
@@ -293,6 +300,9 @@
virtual void SetConnection(const ConnectionRefPtr &connection);
virtual const ConnectionRefPtr &connection() const { return connection_; }
+ // Emit service's IP config change event to chrome.
+ virtual void NotifyIPConfigChanges();
+
// Examines the EAP credentials for the service and returns true if a
// connection attempt can be made.
virtual bool Is8021xConnectable() const;
@@ -809,6 +819,10 @@
// Network identifier indicating the network (gateway) the service is
// connected to.
int connection_id_;
+ // When set to true, this service will automatically fallback to Google's DNS
+ // servers if the portal detection failed due to DNS failure and Google's DNS
+ // servers are working.
+ bool is_dns_auto_fallback_allowed_;
DISALLOW_COPY_AND_ASSIGN(Service);
};