]> granicus.if.org Git - pdns/commitdiff
improve error message if attempting to bind to an address we can't bind to for outgoi...
authorbert hubert <bert.hubert@netherlabs.nl>
Sat, 5 Sep 2015 17:40:24 +0000 (19:40 +0200)
committerbert hubert <bert.hubert@netherlabs.nl>
Sat, 5 Sep 2015 17:40:24 +0000 (19:40 +0200)
pdns/pdns_recursor.cc

index 0e30ebbfdf2fdd009b32953dd0ce1931a8bbe8e5..04cfea233b4b27657b280f616092c4a161dbe1fc 100644 (file)
@@ -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<<Logger::Error<<"Failed to update . records, got an exception: "<<e.reason<<endl;
+       }
+
+      catch(std::exception& e)
+       {
+         L<<Logger::Error<<"Failed to update . records, got an exception: "<<e.what()<<endl;
+       }
+
       catch(...)
        {
          L<<Logger::Error<<"Failed to update . records, got an exception"<<endl;