tools: Daemon mode for ndn-autoconfig (re-run detection when connectivity changes)

Change-Id: I3cb870b13ba60d255162862c7dd0053ec5b578c4
Refs: #2417
diff --git a/tools/ndn-autoconfig/base-dns.cpp b/tools/ndn-autoconfig/base-dns.cpp
index 23e8782..60eed48 100644
--- a/tools/ndn-autoconfig/base-dns.cpp
+++ b/tools/ndn-autoconfig/base-dns.cpp
@@ -55,6 +55,12 @@
   std::string srvDomain = "_ndn._udp." + fqdn;
   std::cerr << "Sending DNS query for SRV record for " << srvDomain << std::endl;
 
+  res_init();
+
+  _res.retrans = 1;
+  _res.retry = 2;
+  _res.ndots = 10;
+
   QueryAnswer queryAnswer;
   int answerSize = res_query(srvDomain.c_str(),
                              ns_c_in,
@@ -77,6 +83,9 @@
 
   QueryAnswer queryAnswer;
 
+  res_init();
+
+  _res.retrans = 1;
   _res.retry = 2;
   _res.ndots = 10;