From: <no...@so...> - 2006-09-23 13:16:34
|
Update of /cvsroot/ijbswa/current/debian/patches In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv4799/debian/patches Modified Files: 03_ipv6.dpatch Log Message: Added up to 10 retries to DNS resolver getaddrinfo() if EAI_AGAIN (timeout) Index: 03_ipv6.dpatch =================================================================== RCS file: /cvsroot/ijbswa/current/debian/patches/03_ipv6.dpatch,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- 03_ipv6.dpatch 23 Sep 2006 12:43:51 -0000 1.3 +++ 03_ipv6.dpatch 23 Sep 2006 13:16:29 -0000 1.4 @@ -66,9 +66,8 @@ + * + * Revisions : + * $Log$ -+ * Revision 1.3 2006/09/23 12:43:51 roro -+ * Adapt to CVS version as of 2006-09-23. -+ * Remove unused Debian patches and add new patches. ++ * Revision 1.4 2006/09/23 13:16:29 roro ++ * Added up to 10 retries to DNS resolver getaddrinfo() if EAI_AGAIN (timeout) + * + * + *********************************************************************/ @@ -274,9 +273,8 @@ + * + * Revisions : + * $Log$ -+ * Revision 1.3 2006/09/23 12:43:51 roro -+ * Adapt to CVS version as of 2006-09-23. -+ * Remove unused Debian patches and add new patches. ++ * Revision 1.4 2006/09/23 13:16:29 roro ++ * Added up to 10 retries to DNS resolver getaddrinfo() if EAI_AGAIN (timeout) + * + * + *********************************************************************/ @@ -1111,9 +1109,8 @@ + * + * Revisions : + * $Log$ -+ * Revision 1.3 2006/09/23 12:43:51 roro -+ * Adapt to CVS version as of 2006-09-23. -+ * Remove unused Debian patches and add new patches. ++ * Revision 1.4 2006/09/23 13:16:29 roro ++ * Added up to 10 retries to DNS resolver getaddrinfo() if EAI_AGAIN (timeout) + * + * + *********************************************************************/ @@ -1295,9 +1292,8 @@ + * + * Revisions : + * $Log$ -+ * Revision 1.3 2006/09/23 12:43:51 roro -+ * Adapt to CVS version as of 2006-09-23. -+ * Remove unused Debian patches and add new patches. ++ * Revision 1.4 2006/09/23 13:16:29 roro ++ * Added up to 10 retries to DNS resolver getaddrinfo() if EAI_AGAIN (timeout) + * + * + *********************************************************************/ @@ -1966,7 +1962,7 @@ return 1; -@@ -784,108 +913,42 @@ +@@ -784,108 +913,48 @@ * * Function : resolve_hostname_to_ip * @@ -1988,7 +1984,15 @@ -{ - struct sockaddr_in inaddr; - struct hostent *hostp; -- unsigned int dns_retries = 0; ++addr_list *resolve_hostname_to_ip(const char *host, const char *port, int pf) ++ { ++ /* TODO ++ * Do all supported platforms have "getaddrinfo"? ++ */ ++ ++ struct addrinfo hints, *res0; ++ int result; + unsigned int dns_retries = 0; -#if defined(HAVE_GETHOSTBYNAME_R_6_ARGS) || defined(HAVE_GETHOSTBYNAME_R_5_ARGS) || defined(HAVE_GETHOSTBYNAME_R_3_ARGS) - struct hostent result; -#if defined(HAVE_GETHOSTBYNAME_R_6_ARGS) || defined(HAVE_GETHOSTBYNAME_R_5_ARGS) @@ -1998,7 +2002,7 @@ - struct hostent_data hdata; -#endif /* def HAVE_GETHOSTBYNAME_R_(6|5)_ARGS */ -#endif /* def HAVE_GETHOSTBYNAME_R_(6|5|3)_ARGS */ -- + - if ((host == NULL) || (*host == '\0')) - { - return(INADDR_ANY); @@ -2072,24 +2076,19 @@ - (char *) hostp->h_addr, - sizeof(inaddr.sin_addr) - ); -- } -- return(inaddr.sin_addr.s_addr); -- --} -- -+addr_list *resolve_hostname_to_ip(const char *host, const char *port, int pf) -+ { -+ /* TODO -+ * Do all supported platforms have "getaddrinfo"? -+ */ -+ -+ struct addrinfo hints, *res0; -+ int result; + memset(&hints, 0, sizeof(hints)); + hints.ai_family = pf; + hints.ai_socktype = SOCK_STREAM; + -+ result = getaddrinfo(host, port, &hints, &res0); ++ while ((result = getaddrinfo(host, port, &hints, &res0)) ++ && (result == EAI_AGAIN) && (dns_retries++ < 10)) { ++ log_error(LOG_LEVEL_ERROR, "Timeout #%u while trying to resolve %s. Trying again.", ++ dns_retries, host); + } +- return(inaddr.sin_addr.s_addr); +- +-} +- + if ( result != 0 ) + { + log_error(LOG_LEVEL_ERROR, "could not resolve hostname %s because %s", host,gai_strerror(result)); @@ -3021,7 +3020,7 @@ * Based on the Internet Junkbuster originally written * by and Copyright (C) 1997 Anonymous Coders and * Junkbusters Corporation. http://www.junkbusters.com -@@ -1932,6 +1935,167 @@ +@@ -1935,6 +1938,167 @@ return JB_ERR_OK; } |