From: Remi Gacogne Date: Tue, 16 Jan 2024 10:34:21 +0000 (+0100) Subject: dnsdist: Add default values for the map and number of frames in `newXsk` X-Git-Tag: dnsdist-1.9.0-rc1^2~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70b5d529ab3438bcc936d3f8a80089057c505466;p=thirdparty%2Fpdns.git dnsdist: Add default values for the map and number of frames in `newXsk` --- diff --git a/pdns/dnsdist-lua-bindings.cc b/pdns/dnsdist-lua-bindings.cc index d0e602e22d..12bf665268 100644 --- a/pdns/dnsdist-lua-bindings.cc +++ b/pdns/dnsdist-lua-bindings.cc @@ -727,10 +727,15 @@ void setupLuaBindings(LuaContext& luaCtx, bool client, bool configCheck) return std::shared_ptr(nullptr); } uint32_t queue_id; - uint32_t frameNums; + uint32_t frameNums{65536}; std::string ifName; - std::string path; - std::string poolName; + std::string path("/sys/fs/bpf/dnsdist/xskmap"); + if (opts.count("ifName") == 1) { + ifName = boost::get(opts.at("ifName")); + } + else { + throw std::runtime_error("ifName field is required!"); + } if (opts.count("NIC_queue_id") == 1) { queue_id = boost::get(opts.at("NIC_queue_id")); } @@ -740,21 +745,9 @@ void setupLuaBindings(LuaContext& luaCtx, bool client, bool configCheck) if (opts.count("frameNums") == 1) { frameNums = boost::get(opts.at("frameNums")); } - else { - throw std::runtime_error("frameNums field is required!"); - } - if (opts.count("ifName") == 1) { - ifName = boost::get(opts.at("ifName")); - } - else { - throw std::runtime_error("ifName field is required!"); - } if (opts.count("xskMapPath") == 1) { path = boost::get(opts.at("xskMapPath")); } - else { - throw std::runtime_error("xskMapPath field is required!"); - } auto socket = std::make_shared(frameNums, ifName, queue_id, path); dnsdist::xsk::g_xsk.push_back(socket); return socket;