Initialize resolver after failure in cups-polld #2920
Comments
CUPS.org User: twaugh.redhat Second patch includes the necessary addition to config.h.in. |
CUPS.org User: mike Tim, Would it make better sense to put this in libcups whenever httpAddrGetList fails? Also, there is a res_init function (no leading underscores) that seems to be a public API on multiple OS's - would that function be sufficient? Finally, shouldn't libresolv be smart enough to reinitialize itself if it was unable to do so the first time? |
CUPS.org User: twaugh.redhat
Perhaps.
Yes.
This would mean every application continually re-reading /etc/resolv.conf, which is why glibc does not do this. See Ulrich Drepper's comment about this here: |
CUPS.org User: mike Fixed in Subversion repository. We now call res_init before new lookups when the previous lookup failed. |
CUPS.org User: mike And a patch for CUPS 1.3.x... |
"cups-res_init.patch": diff -up cups-1.3.8/config-scripts/cups-network.m4.res_init cups-1.3.8/config-scripts/cups-network.m4 Tru64 5.1b leaks file descriptors with these functions; disable untilwe can come up with a test for this...diff -up cups-1.3.8/scheduler/cups-polld.c.res_init cups-1.3.8/scheduler/cups-polld.c +#ifdef HAVE_RES_INIT
|
"cups-res_init_v2.patch": diff -up cups-1.3.8/config.h.in.res_init cups-1.3.8/config.h.in /*
diff -up cups-1.3.8/config-scripts/cups-network.m4.res_init cups-1.3.8/config-scripts/cups-network.m4 Tru64 5.1b leaks file descriptors with these functions; disable untilwe can come up with a test for this...diff -up cups-1.3.8/scheduler/cups-polld.c.res_init cups-1.3.8/scheduler/cups-polld.c +#ifdef HAVE_RES_INIT
|
"str2920.patch": Index: notifier/Dependencies--- notifier/Dependencies (revision 7908) DO NOT DELETE THIS LINE -- make depend depends on it.+dbus.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/versioning.h Index: backend/Dependencies--- backend/Dependencies (revision 7908) Index: config-scripts/cups-network.m4--- config-scripts/cups-network.m4 (revision 7908) +AC_CHECK_HEADER(resolv.h,AC_DEFINE(HAVE_RESOLV_H))
Tru64 5.1b leaks file descriptors with these functions; disable untilwe can come up with a test for this...Index: cups/http-addrlist.c--- cups/http-addrlist.c (revision 7908) /*
+#ifdef HAVE_RES_INIT
@@ -246,7 +273,9 @@
+#include "http-private.h" /*
@@ -193,9 +201,33 @@ #ifdef AF_LOCAL
+#ifdef HAVE_RES_INIT
#ifdef HAVE_GETNAMEINFO
/* ipp.c / Index: config.h.in--- config.h.in (revision 7908) /*
|
"str2920-1.3.patch": Index: notifier/Dependencies--- notifier/Dependencies (revision 7908) DO NOT DELETE THIS LINE -- make depend depends on it.-mailto.o: mailto.c ../cups/cups.h ../cups/ipp.h ../cups/http.h \
+mailto.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/ppd.h
|
+util.64.o: util.c ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h i18n.h Index: cups/globals.h--- cups/globals.h (revision 7908) ifdef HAVE_GETADDRINFOchar hostname[1024]; /* Hostname _/ endif /_ HAVE_GETADDRINFO */
/* ipp.c / Index: test/Dependencies--- test/Dependencies (revision 7908) DO NOT DELETE THIS LINE -- make depend depends on it.-ipptest.o: ipptest.c ../cups/string.h ../config.h ../cups/cups.h \
+ipptest.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h
|
+textcommon.64.o: textcommon.c ../config.h ../cups/i18n.h ../cups/transcode.h Index: monitor/Dependencies--- monitor/Dependencies (revision 7908) DO NOT DELETE THIS LINE -- make depend depends on it.-bcp.o: bcp.c ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h \
+bcp.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h Index: config.h.in--- config.h.in (revision 7908) /*
Index: cgi-bin/Dependencies--- cgi-bin/Dependencies (revision 7908) DO NOT DELETE THIS LINE -- make depend depends on it.-help-index.o: help-index.c cgi-private.h cgi.h ../cups/cups.h \
+help-index.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
|
Version: 1.3.8
CUPS.org User: twaugh.redhat
When cups-polld has started, it may fail to resolve the required hostname because the network interface is not yet up.
On Linux (and perhaps other operating systems), hostname resolution failures are cached. When the network interface becomes available, getaddrinfo() remembers the previous failure and returns without querying the name server.
Here is a patch to reinit the resolver if we haven't yet resolved the hostname.
The text was updated successfully, but these errors were encountered: