]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Fix first IPv6 console connection being rejected
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 19 Mar 2024 09:14:00 +0000 (10:14 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 19 Mar 2024 09:14:00 +0000 (10:14 +0100)
Manually backported from 1a9b7f5a97e97e371bd4b6043c14d9faccb9013c.

pdns/dnsdist-console.cc

index f40abb3446dc43f83a529db2bfe120251474afb8..3e92b566e9eb7bafbd7b987c1e77a2c0039ac529 100644 (file)
@@ -1033,6 +1033,11 @@ void controlThread(std::shared_ptr<Socket> acceptFD, ComboAddress local)
   {
     setThreadName("dnsdist/control");
     ComboAddress client;
+    // make sure that the family matches the one from the listening IP,
+    // so that getSocklen() returns the correct size later, otherwise
+    // the first IPv6 console connection might get refused
+    client.sin4.sin_family = local.sin4.sin_family;
+
     int sock{-1};
     auto localACL = g_consoleACL.getLocal();
     infolog("Accepting control connections on %s", local.toStringWithPort());