shill: Add connection to device
Also in the process, do a few bits like setting up a run path in
the manager so it can initialize the resolver output path.
BUG=chromium-os:19095
TEST=Ran unit tests (for regression), tested that DNS and routes applied
for Ethernet on real system.
Change-Id: If505200643efa6c3152f6e61db3b91a04e739c18
Reviewed-on: http://gerrit.chromium.org/gerrit/6087
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/resolver.cc b/resolver.cc
index bb7105b..d0d4d7a 100644
--- a/resolver.cc
+++ b/resolver.cc
@@ -31,6 +31,8 @@
}
bool Resolver::SetDNSFromIPConfig(const IPConfigRefPtr &ipconfig) {
+ VLOG(2) << __func__;
+
CHECK(!path_.empty());
const IPConfig::Properties &props = ipconfig->properties();
@@ -40,7 +42,10 @@
bool Resolver::SetDNSFromLists(const std::vector<std::string> &dns_servers,
const std::vector<std::string> &domain_search) {
+ VLOG(2) << __func__;
+
if (dns_servers.empty() && domain_search.empty()) {
+ VLOG(2) << "DNS list is empty";
return ClearDNS();
}
@@ -59,12 +64,16 @@
lines.push_back("");
string contents = JoinString(lines, '\n');
+
+ VLOG(2) << "Writing DNS out to " << path_.value();
int count = file_util::WriteFile(path_, contents.c_str(), contents.size());
return count == static_cast<int>(contents.size());
}
bool Resolver::ClearDNS() {
+ VLOG(2) << __func__;
+
CHECK(!path_.empty());
return file_util::Delete(path_, false);