Always call res_init() before getaddrinfo().
[oweals/tinc.git] / src / net_setup.c
index 765a9ebf37a1ea0bd11b01c49b84247b6e76d87c..121b989279bff7a810d316cc9737396bb33ff43e 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);