-#if defined(HAVE_RES_SEARCH) && defined(USE_TCPIP_FOR_DNS)
- /*
- * This was an efficiency hack that backfired. The theory
- * was that using TCP/IP for DNS queries would get us better
- * reliability and shave off some per-UDP-packet costs.
- * Unfortunately it interacted badly with diald, which effectively
- * filters out DNS queries over TCP/IP for reasons having to do
- * with some obscure Linux kernel problem involving bootstrapping of
- * dynamically-addressed links. I don't understand this mess
- * and don't want to, so it's "See ya!" to this hack.
- */
- sethostent(TRUE); /* use TCP/IP for mailserver queries */
-#endif /* HAVE_RES_SEARCH */
+#ifdef HAVE_RES_SEARCH
+ /* Boldly assume that we also have res_init() if we have
+ * res_search(), and call res_init() to re-read the resolv.conf
+ * file, so that we can pick up changes to that file that are
+ * written by dhpccd, dhclient, pppd, openvpn and similar. */
+
+ /* NOTE: This assumes that /etc/resolv.conf is written
+ * atomically (i. e. a temporary file is written, flushed and
+ * then renamed into place). To fix Debian Bug#389270. */
+
+ /* NOTE: If this leaks memory or doesn't re-read
+ * /etc/resolv.conf, we're in trouble. The res_init() interface
+ * is only lightly documented :-( */
+ res_init();
+#endif