From: bert hubert Date: Sat, 5 Sep 2015 17:40:24 +0000 (+0200) Subject: improve error message if attempting to bind to an address we can't bind to for outgoi... X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~59^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3aa91c3e82bbff18cc27679ce8d3b6b33c32baf1;p=pdns improve error message if attempting to bind to an address we can't bind to for outgoing queries --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 0e30ebbfd..04cfea233 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -359,6 +359,7 @@ public: setCloseOnExec(ret); int tries=10; + ComboAddress sin; while(--tries) { uint16_t port; @@ -367,13 +368,13 @@ public: else port = 1025 + dns_random(64510); - ComboAddress sin=getQueryLocalAddress(family, port); // does htons for us + sin=getQueryLocalAddress(family, port); // does htons for us if (::bind(ret, (struct sockaddr *)&sin, sin.getSocklen()) >= 0) break; } if(!tries) - throw PDNSException("Resolver binding to local query client socket: "+stringerror()); + throw PDNSException("Resolver binding to local query client socket on "+sin.toString()+": "+stringerror()); setNonBlocking(ret); return ret; @@ -1341,6 +1342,16 @@ static void houseKeeping(void *) try { res=sr.beginResolve(".", QType(QType::NS), 1, ret); } + catch(PDNSException& e) + { + L<