From 348bd85500f5cb5dc4b239e98d9459dbe71f96bc Mon Sep 17 00:00:00 2001 From: John Denker Date: Sat, 24 Nov 2012 09:28:10 -0800 Subject: make rare DNS errors non-fatal --- tools/libltgrey.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'tools/libltgrey.c') diff --git a/tools/libltgrey.c b/tools/libltgrey.c index 827dcee..eb6d904 100644 --- a/tools/libltgrey.c +++ b/tools/libltgrey.c @@ -217,7 +217,7 @@ int whatsit::check_dns(const char* ipvar, const char* namevar){ vector checked; int rslt = check_dns_sub(ipvar, namevar, addr, host, checked); int sts = rslt; -#if 1 +#ifndef badDNSfatal sts = 0; // demote badDNS to just a warning #endif if (rslt || verbosity) { @@ -238,6 +238,12 @@ int whatsit::check_dns(const char* ipvar, const char* namevar){ int whatsit::check_dns_sub(const char* ipvar, const char* namevar, string &addr, string &host, vector &checked){ +#ifdef badDNSfatal + int ex_dns_fail = ex_syserr; +#else + int ex_dns_fail = ex_badDNS; +#endif + struct addrinfo *result; struct addrinfo *ipresult; struct addrinfo *res; @@ -259,11 +265,11 @@ int whatsit::check_dns_sub(const char* ipvar, const char* namevar, << " odd error " << error << " in getaddrinfo for " << ipvar << " : " << gai_strerror(error) << endl; - return ex_syserr; + return ex_dns_fail; } if (!ipresult) { cerr << "should never happen (addr with no addrs?)" << endl; - return ex_syserr; + return ex_dns_fail; } // reconvert from bits to string + family info @@ -304,7 +310,7 @@ int whatsit::check_dns_sub(const char* ipvar, const char* namevar, << " compare " << EAI_NONAME << " in getaddrinfo for " << ipvar << " :: " << gai_strerror(error) << endl; - return ex_syserr; + return ex_dns_fail; } // loop over all returned results and check for a match. -- cgit v1.2.3