shill: Connection: Don't call Resolver::SetDNSFromIPConfig

Don't ever call this function (in fact, remove this from the
resolver), and refactor the code that correctly generates the
DNS search list so that it is usable both from
Connection::UpdateFromIPConfig() and from void
Connection::SetIsDefault().

BUG=chromium-os:34260
TEST=Rerun unit tests + Manual: Connect to AP that supplies only
"DomainName", and ensure that /etc/resolv.conf contains this domain
in the search field both initially and after DHCP renewal.

Change-Id: I9a0705cb54e6588915533cc343b05efcdee71293
Reviewed-on: https://gerrit.chromium.org/gerrit/32996
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/connection.cc b/connection.cc
index 4e18521..20496fb 100644
--- a/connection.cc
+++ b/connection.cc
@@ -191,7 +191,7 @@
   ipconfig_rpc_identifier_ = config->GetRpcIdentifier();
 
   if (is_default_) {
-    resolver_->SetDNSFromIPConfig(config, dns_timeout_parameters_);
+    PushDNSConfig();
   }
 
   local_ = local;
@@ -212,12 +212,7 @@
   is_default_ = is_default;
 
   if (is_default) {
-    vector<string> domain_search = dns_domain_search_;
-    if (domain_search.empty() && !dns_domain_name_.empty()) {
-      domain_search.push_back(dns_domain_name_ + ".");
-    }
-    resolver_->SetDNSFromLists(dns_servers_, domain_search,
-                               dns_timeout_parameters_);
+    PushDNSConfig();
     DeviceRefPtr device = device_info_->GetDevice(interface_index_);
     if (device) {
       device->RequestPortalDetection();
@@ -226,6 +221,17 @@
   routing_table_->FlushCache();
 }
 
+void Connection::PushDNSConfig() {
+  vector<string> domain_search = dns_domain_search_;
+  if (domain_search.empty() && !dns_domain_name_.empty()) {
+    SLOG(Connection, 2) << "Setting domain search to domain name "
+                        << dns_domain_name_;
+    domain_search.push_back(dns_domain_name_ + ".");
+  }
+  resolver_->SetDNSFromLists(dns_servers_, domain_search,
+                             dns_timeout_parameters_);
+}
+
 void Connection::RequestRouting() {
   if (routing_request_count_++ == 0) {
     DeviceRefPtr device = device_info_->GetDevice(interface_index_);