From: Remi Gacogne Date: Tue, 8 Nov 2022 09:36:07 +0000 (+0100) Subject: dnsdist: Fix building with boost < 1.56 X-Git-Tag: dnsdist-1.8.0-rc1~241^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F12177%2Fhead;p=thirdparty%2Fpdns.git dnsdist: Fix building with boost < 1.56 boost::optional::value_or() has been introduced in 1.56 and we only require 1.53, so stop using it. --- diff --git a/pdns/dnsdist-lua-bindings.cc b/pdns/dnsdist-lua-bindings.cc index 8f0894d925..ced2f8a3d7 100644 --- a/pdns/dnsdist-lua-bindings.cc +++ b/pdns/dnsdist-lua-bindings.cc @@ -538,12 +538,12 @@ void setupLuaBindings(LuaContext& luaCtx, bool client) default: throw std::runtime_error("Unsupported action for BPFFilter::block"); } - return bpf->addRangeRule(Netmask(range), force.value_or(false), match); + return bpf->addRangeRule(Netmask(range), force ? *force : false, match); }); luaCtx.registerFunction::*)(const DNSName& qname, boost::optional qtype, boost::optional action)>("blockQName", [](std::shared_ptr bpf, const DNSName& qname, boost::optional qtype, boost::optional action) { if (bpf) { if (!action) { - return bpf->block(qname, BPFFilter::MatchAction::Drop, qtype.value_or(255)); + return bpf->block(qname, BPFFilter::MatchAction::Drop, qtype ? *qtype : 255); } else { BPFFilter::MatchAction match; @@ -561,7 +561,7 @@ void setupLuaBindings(LuaContext& luaCtx, bool client) default: throw std::runtime_error("Unsupported action for BPFFilter::blockQName"); } - return bpf->block(qname, match, qtype.value_or(255)); + return bpf->block(qname, match, qtype ? *qtype : 255); } } });