From: Remi Gacogne Date: Tue, 5 Mar 2024 09:46:27 +0000 (+0100) Subject: dnsdist: Fix formatting in dnsdist-lua-bindings-dnsquestion.cc X-Git-Tag: dnsdist-1.10.0-alpha0~8^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69534a0995c4dfa0651f407a1229c1be70feaf0f;p=thirdparty%2Fpdns.git dnsdist: Fix formatting in dnsdist-lua-bindings-dnsquestion.cc --- diff --git a/pdns/dnsdistdist/dnsdist-lua-bindings-dnsquestion.cc b/pdns/dnsdistdist/dnsdist-lua-bindings-dnsquestion.cc index 7eea39f084..6003f5c5e8 100644 --- a/pdns/dnsdistdist/dnsdist-lua-bindings-dnsquestion.cc +++ b/pdns/dnsdistdist/dnsdist-lua-bindings-dnsquestion.cc @@ -42,18 +42,22 @@ void setupLuaBindingsDNSQuestion(LuaContext& luaCtx) luaCtx.registerMember( "qclass", [](const DNSQuestion& dnsQuestion) -> uint16_t { return dnsQuestion.ids.qclass; }, [](DNSQuestion& dnsQuestion, uint16_t newClass) { (void)newClass; }); luaCtx.registerMember( - "rcode", [](const DNSQuestion& dnsQuestion) -> int { return static_cast(dnsQuestion.getHeader()->rcode); }, [](DNSQuestion& dnsQuestion, int newRCode) { dnsdist::PacketMangling::editDNSHeaderFromPacket(dnsQuestion.getMutableData(), [newRCode](dnsheader& header) { - header.rcode = static_cast(newRCode); - return true; - }); }); + "rcode", [](const DNSQuestion& dnsQuestion) -> int { return static_cast(dnsQuestion.getHeader()->rcode); }, [](DNSQuestion& dnsQuestion, int newRCode) { + dnsdist::PacketMangling::editDNSHeaderFromPacket(dnsQuestion.getMutableData(), [newRCode](dnsheader& header) { + header.rcode = static_cast(newRCode); + return true; + }); + }); luaCtx.registerMember( "remoteaddr", [](const DNSQuestion& dnsQuestion) -> ComboAddress { return dnsQuestion.ids.origRemote; }, [](DNSQuestion& dnsQuestion, const ComboAddress newRemote) { (void)newRemote; }); /* DNSDist DNSQuestion */ luaCtx.registerMember( - "dh", [](const DNSQuestion& dnsQuestion) -> dnsheader* { return dnsQuestion.getMutableHeader(); }, [](DNSQuestion& dnsQuestion, const dnsheader* dnsHeader) { dnsdist::PacketMangling::editDNSHeaderFromPacket(dnsQuestion.getMutableData(), [&dnsHeader](dnsheader& header) { - header = *dnsHeader; - return true; - }); }); + "dh", [](const DNSQuestion& dnsQuestion) -> dnsheader* { return dnsQuestion.getMutableHeader(); }, [](DNSQuestion& dnsQuestion, const dnsheader* dnsHeader) { + dnsdist::PacketMangling::editDNSHeaderFromPacket(dnsQuestion.getMutableData(), [&dnsHeader](dnsheader& header) { + header = *dnsHeader; + return true; + }); + }); luaCtx.registerMember( "len", [](const DNSQuestion& dnsQuestion) -> uint16_t { return dnsQuestion.getData().size(); }, [](DNSQuestion& dnsQuestion, uint16_t newlen) { dnsQuestion.getMutableData().resize(newlen); }); luaCtx.registerMember( @@ -372,17 +376,21 @@ void setupLuaBindingsDNSQuestion(LuaContext& luaCtx) luaCtx.registerMember( "qclass", [](const DNSResponse& dnsQuestion) -> uint16_t { return dnsQuestion.ids.qclass; }, [](DNSResponse& dnsQuestion, uint16_t newClass) { (void)newClass; }); luaCtx.registerMember( - "rcode", [](const DNSResponse& dnsQuestion) -> int { return static_cast(dnsQuestion.getHeader()->rcode); }, [](DNSResponse& dnsQuestion, int newRCode) { dnsdist::PacketMangling::editDNSHeaderFromPacket(dnsQuestion.getMutableData(), [newRCode](dnsheader& header) { - header.rcode = static_cast(newRCode); - return true; - }); }); + "rcode", [](const DNSResponse& dnsQuestion) -> int { return static_cast(dnsQuestion.getHeader()->rcode); }, [](DNSResponse& dnsQuestion, int newRCode) { + dnsdist::PacketMangling::editDNSHeaderFromPacket(dnsQuestion.getMutableData(), [newRCode](dnsheader& header) { + header.rcode = static_cast(newRCode); + return true; + }); + }); luaCtx.registerMember( "remoteaddr", [](const DNSResponse& dnsQuestion) -> ComboAddress { return dnsQuestion.ids.origRemote; }, [](DNSResponse& dnsQuestion, const ComboAddress newRemote) { (void)newRemote; }); luaCtx.registerMember( - "dh", [](const DNSResponse& dnsResponse) -> dnsheader* { return dnsResponse.getMutableHeader(); }, [](DNSResponse& dnsResponse, const dnsheader* dnsHeader) { dnsdist::PacketMangling::editDNSHeaderFromPacket(dnsResponse.getMutableData(), [&dnsHeader](dnsheader& header) { - header = *dnsHeader; - return true; - }); }); + "dh", [](const DNSResponse& dnsResponse) -> dnsheader* { return dnsResponse.getMutableHeader(); }, [](DNSResponse& dnsResponse, const dnsheader* dnsHeader) { + dnsdist::PacketMangling::editDNSHeaderFromPacket(dnsResponse.getMutableData(), [&dnsHeader](dnsheader& header) { + header = *dnsHeader; + return true; + }); + }); luaCtx.registerMember( "len", [](const DNSResponse& dnsQuestion) -> uint16_t { return dnsQuestion.getData().size(); }, [](DNSResponse& dnsQuestion, uint16_t newlen) { dnsQuestion.getMutableData().resize(newlen); }); luaCtx.registerMember(