]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth: on OpenBSD, try harder to send on a non-blocking socket 13867/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 6 Mar 2024 14:19:22 +0000 (15:19 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 6 Mar 2024 14:25:18 +0000 (15:25 +0100)
Should fix #13857 in many cases, though you can still argue this
is a OpenBSD bug (or at least an undesirable difference between other
systems and OpenBSD).

pdns/nameserver.cc

index db66bc9e62164dbffa087766f39dc0352fe0d839..74ea7105cd0df89ecddc12aa67ece2462cbf59be 100644 (file)
@@ -233,8 +233,10 @@ void UDPNameserver::send(DNSPacket& p)
   if(buffer.length() > p.getMaxReplyLen()) {
     g_log<<Logger::Error<<"Weird, trying to send a message that needs truncation, "<< buffer.length()<<" > "<<p.getMaxReplyLen()<<". Question was for "<<p.qdomain<<"|"<<p.qtype.toString()<<endl;
   }
-  if(sendmsg(p.getSocket(), &msgh, 0) < 0)
-    g_log<<Logger::Error<<"Error sending reply with sendmsg (socket="<<p.getSocket()<<", dest="<<p.d_remote.toStringWithPort()<<"): "<<stringerror()<<endl;
+  if (sendOnNBSocket(p.getSocket(), &msgh) < 0) {
+    int err = errno;
+    g_log<<Logger::Error<<"Error sending reply with sendmsg (socket="<<p.getSocket()<<", dest="<<p.d_remote.toStringWithPort()<<"): "<<stringerror(err)<<endl;
+  }
 }
 
 bool UDPNameserver::receive(DNSPacket& packet, std::string& buffer)