From a20a14a60d68ebad7061f7dcede9cb6cb952f189 Mon Sep 17 00:00:00 2001 From: bert hubert Date: Mon, 20 Nov 2017 12:13:19 +0100 Subject: [PATCH] add realwho --- pdns/lua-auth4.cc | 3 ++- pdns/lua-auth4.hh | 3 ++- pdns/packethandler.cc | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pdns/lua-auth4.cc b/pdns/lua-auth4.cc index 1ce405467..8cc2fac33 100644 --- a/pdns/lua-auth4.cc +++ b/pdns/lua-auth4.cc @@ -429,13 +429,14 @@ void IsUpOracle::checkURLThread(ComboAddress rem, std::string url, opts_t opts) IsUpOracle g_up; -std::vector> luaSynth(const std::string& code, const DNSName& query, const DNSName& zone, int zoneid, const ComboAddress& who, uint16_t qtype) +std::vector> luaSynth(const std::string& code, const DNSName& query, const DNSName& zone, int zoneid, const ComboAddress& who, const Netmask& realWho, uint16_t qtype) { std::vector> ret; LuaContext lua; lua.writeVariable("qname", query.toString()); lua.writeVariable("who", who.toString()); + lua.writeVariable("realwho", realWho.toString()); lua.writeFunction("ifportup", [](int port, const vector >& ips) { vector candidates; diff --git a/pdns/lua-auth4.hh b/pdns/lua-auth4.hh index ca3797585..5d6ccf9e1 100644 --- a/pdns/lua-auth4.hh +++ b/pdns/lua-auth4.hh @@ -43,4 +43,5 @@ private: luacall_axfr_filter_t d_axfr_filter; }; std::vector> luaSynth(const std::string& code, const DNSName& qname, - const DNSName& zone, int zoneid, const ComboAddress& who, uint16_t qtype); + const DNSName& zone, int zoneid, const ComboAddress& who, + const Netmask& realwho, uint16_t qtype); diff --git a/pdns/packethandler.cc b/pdns/packethandler.cc index 397caeae4..d0ab73c2d 100644 --- a/pdns/packethandler.cc +++ b/pdns/packethandler.cc @@ -1288,7 +1288,7 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p) if(rec->d_type != QType::CNAME && rec->d_type != p->qtype.getCode()) continue; - auto recvec=luaSynth(rec->getCode(), target, sd.qname, sd.domain_id, p->getRemote(), rec->d_type); + auto recvec=luaSynth(rec->getCode(), target, sd.qname, sd.domain_id, p->getRemote(), p->getRealRemote(), rec->d_type); if(!recvec.empty()) { for(const auto& r : recvec) { rr.dr.d_type = rec->d_type; // might be CNAME -- 2.40.0