Always call res_init() before getaddrinfo().
[tinc] / src / net_setup.c
index 765a9eb..121b989 100644 (file)
@@ -813,6 +813,10 @@ static bool setup_myself(void) {
                        hint.ai_protocol = IPPROTO_TCP;
                        hint.ai_flags = AI_PASSIVE;
 
+#ifdef HAVE_DECL_RES_INIT
+                       // ensure glibc reloads /etc/resolv.conf.
+                       res_init();
+#endif
                        err = getaddrinfo(address && *address ? address : NULL, port, &hint, &ai);
                        free(address);