]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Fix console ("client mode") on non-default address or port 15148/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 13 Feb 2025 10:48:23 +0000 (11:48 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 13 Feb 2025 10:48:23 +0000 (11:48 +0100)
The console address and port were not properly set in client mode,
so `dnsdist` tried to connect to the default console address and port.

pdns/dnsdistdist/dnsdist-lua.cc

index 464f0192251d5d6a1eb3677b18a0d7a46d20f3ed..29e0d19491e8823693d2adf66643769f28264cc0 100644 (file)
@@ -1171,14 +1171,15 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck)
     setLuaSideEffect();
     ComboAddress local(str, 5199);
 
-    if (client || configCheck) {
-      return;
-    }
-
     dnsdist::configuration::updateRuntimeConfiguration([local](dnsdist::configuration::RuntimeConfiguration& config) {
       config.d_consoleServerAddress = local;
       config.d_consoleEnabled = true;
     });
+
+    if (client || configCheck) {
+      return;
+    }
+
 #if defined(HAVE_LIBSODIUM) || defined(HAVE_LIBCRYPTO)
     if (dnsdist::configuration::isImmutableConfigurationDone() && dnsdist::configuration::getCurrentRuntimeConfiguration().d_consoleKey.empty()) {
       warnlog("Warning, the console has been enabled via 'controlSocket()' but no key has been set with 'setKey()' so all connections will fail until a key has been set");