From: bert hubert Date: Tue, 1 Dec 2015 21:13:01 +0000 (+0100) Subject: fix up TTL for RPZ zones, and allow override from config X-Git-Tag: dnsdist-1.0.0-alpha1~151 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3876ee44173178b17f9ca24850965d35ebe1367b;p=pdns fix up TTL for RPZ zones, and allow override from config --- diff --git a/pdns/filterpo.hh b/pdns/filterpo.hh index 95810eb87..8eb198edb 100644 --- a/pdns/filterpo.hh +++ b/pdns/filterpo.hh @@ -51,6 +51,7 @@ public: } PolicyKind d_kind; std::shared_ptr d_custom; + int d_ttl; }; DNSFilterEngine(); diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 261dbc510..da2b23b9f 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -694,7 +694,7 @@ void startDoResolve(void *p) res=RCode::NoError; spoofed.d_name=dc->d_mdp.d_qname; spoofed.d_type=dfepol.d_custom->getType(); - spoofed.d_ttl = 1234; + spoofed.d_ttl = dfepol.d_ttl; spoofed.d_class = 1; spoofed.d_content = dfepol.d_custom; spoofed.d_place = DNSResourceRecord::ANSWER; @@ -754,7 +754,7 @@ void startDoResolve(void *p) res=RCode::NoError; spoofed.d_name=dc->d_mdp.d_qname; spoofed.d_type=dfepol.d_custom->getType(); - spoofed.d_ttl = 1234; + spoofed.d_ttl = dfepol.d_ttl; spoofed.d_class = 1; spoofed.d_content = dfepol.d_custom; spoofed.d_place = DNSResourceRecord::ANSWER; diff --git a/pdns/rec-lua-conf.cc b/pdns/rec-lua-conf.cc index 55c05f637..6b298c205 100644 --- a/pdns/rec-lua-conf.cc +++ b/pdns/rec-lua-conf.cc @@ -98,6 +98,11 @@ void loadRecursorLuaConfig(const std::string& fname) boost::get(constGet(have,"defcontent")) ) ); + + if(have.count("defttl")) + defpol->d_ttl = boost::get(constGet(have, "defttl")); + else + defpol->d_ttl = -1; // get it from the zone } } @@ -127,6 +132,11 @@ void loadRecursorLuaConfig(const std::string& fname) boost::get(constGet(have,"defcontent")) ) ); + if(have.count("defttl")) + defpol->d_ttl = boost::get(constGet(have, "defttl")); + else + defpol->d_ttl = -1; // get it from the zone + } } diff --git a/pdns/rpzloader.cc b/pdns/rpzloader.cc index bfdfd13ae..118e07097 100644 --- a/pdns/rpzloader.cc +++ b/pdns/rpzloader.cc @@ -59,6 +59,9 @@ void RPZRecordToPolicy(const DNSRecord& dr, DNSFilterEngine& target, bool addOrR // cerr<<"Wants custom "<getZoneRepresentation()<<" for "<