From: Ensar Sarajčić Date: Tue, 26 May 2026 08:51:00 +0000 (+0200) Subject: dnsdist: move MMDB feature flag to `mmdb.hh` X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=815f0b536596ea3cc1ec2ea97539466dfc4a802d;p=thirdparty%2Fpdns.git dnsdist: move MMDB feature flag to `mmdb.hh` Signed-off-by: Ensar Sarajčić --- diff --git a/pdns/dnsdistdist/dnsdist-configuration-yaml.cc b/pdns/dnsdistdist/dnsdist-configuration-yaml.cc index 5ab50ca0d6..426cfdbf40 100644 --- a/pdns/dnsdistdist/dnsdist-configuration-yaml.cc +++ b/pdns/dnsdistdist/dnsdist-configuration-yaml.cc @@ -47,9 +47,7 @@ #include "dnsdist-xsk.hh" #include "fstrm_logger.hh" #include "iputils.hh" -#ifdef HAVE_MMDB #include "mmdb.hh" -#endif #include "remote_logger.hh" #include "remote_logger_pool.hh" #include "xsk.hh" @@ -75,12 +73,7 @@ struct Context using XSKMap = std::vector>; -using RegisteredTypes = std::variant, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr -#ifdef HAVE_MMDB - , - std::shared_ptr -#endif - >; +using RegisteredTypes = std::variant, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr>; static LockGuarded> s_registeredTypesMap; static std::atomic s_inConfigCheckMode; static std::atomic s_inClientMode; @@ -1403,12 +1396,7 @@ bool loadConfigurationFromFile(const std::string& fileName, [[maybe_unused]] boo void addLuaBindingsForYAMLObjects([[maybe_unused]] LuaContext& luaCtx) { #if defined(HAVE_YAML_CONFIGURATION) - using ReturnValue = std::optional, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr -#ifdef HAVE_MMDB - , - std::shared_ptr -#endif - >>; + using ReturnValue = std::optional, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr, std::shared_ptr>>; luaCtx.writeFunction("getObjectFromYAMLConfiguration", [](const std::string& name) -> ReturnValue { auto map = s_registeredTypesMap.lock(); diff --git a/pdns/dnsdistdist/dnsdist-lua-bindings-mmdb.cc b/pdns/dnsdistdist/dnsdist-lua-bindings-mmdb.cc index 7aa1fbe4a9..2388f0be62 100644 --- a/pdns/dnsdistdist/dnsdist-lua-bindings-mmdb.cc +++ b/pdns/dnsdistdist/dnsdist-lua-bindings-mmdb.cc @@ -23,9 +23,7 @@ #include "dnsdist-lua.hh" #include "iputils.hh" #include -#ifdef HAVE_MMDB #include "mmdb.hh" -#endif void setupLuaBindingsMMDB([[maybe_unused]] LuaContext& luaCtx) { diff --git a/pdns/dnsdistdist/mmdb.cc b/pdns/dnsdistdist/mmdb.cc index 19c5560670..c0b6b7a99c 100644 --- a/pdns/dnsdistdist/mmdb.cc +++ b/pdns/dnsdistdist/mmdb.cc @@ -20,13 +20,16 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_MMDB +#include "dnsdist-logging.hh" #include "dnsdist-lua-types.hh" #include #include #include -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif #include "dolog.hh" #include "iputils.hh" @@ -254,3 +257,4 @@ std::optional MMDB::getEntryList(MMDB_entry_s* entry) const } return {entry_data_list}; } +#endif diff --git a/pdns/dnsdistdist/mmdb.hh b/pdns/dnsdistdist/mmdb.hh index bfab18fc86..f7ce2f8f40 100644 --- a/pdns/dnsdistdist/mmdb.hh +++ b/pdns/dnsdistdist/mmdb.hh @@ -21,6 +21,7 @@ */ #pragma once +#ifdef HAVE_MMDB #include "dnsdist-lua-types.hh" #include "iputils.hh" #include @@ -77,3 +78,8 @@ public: private: std::unique_ptr d_entry_list_first; }; +#else +class MMDB +{ +}; +#endif