* `getRecords()`: get a table of DNS Records in this DNS Question (or answer by now)
* `setPolicyTags(tags)`: update the policy tags, taking a table of strings.
* `setRecords(records)`: after your edits, update the answers of this question
+* `getEDNSFlag(name)`: returns true if the EDNS flag with `name` is set in the query
+* `getEDNSFlags()`: returns a list of strings with all the EDNS flag mnemonics in the query
* `getEDNSOption(num)`: get the EDNS Option with number `num`
* `getEDNSOptions()`: get a map of all EDNS Options
* `getEDNSSubnet()`: returns the netmask specified in the EDNSSubnet option, or empty if there was none
return boost::optional<dnsheader>();
}
+vector<string> RecursorLua4::DNSQuestion::getEDNSFlags() const
+{
+ vector<string> ret;
+ if (ednsFlags) {
+ if (*ednsFlags & EDNSOpts::DNSSECOK)
+ ret.push_back("DO");
+ }
+ return ret;
+}
+
+bool RecursorLua4::DNSQuestion::getEDNSFlag(string flag) const
+{
+ if (ednsFlags) {
+ if (flag == "DO" && (*ednsFlags & EDNSOpts::DNSSECOK))
+ return true;
+ }
+ return false;
+}
+
vector<pair<uint16_t, string> > RecursorLua4::DNSQuestion::getEDNSOptions() const
{
if(ednsOptions)
d_lw->registerFunction("getEDNSOptions", &DNSQuestion::getEDNSOptions);
d_lw->registerFunction("getEDNSOption", &DNSQuestion::getEDNSOption);
d_lw->registerFunction("getEDNSSubnet", &DNSQuestion::getEDNSSubnet);
+ d_lw->registerFunction("getEDNSFlags", &DNSQuestion::getEDNSFlags);
+ d_lw->registerFunction("getEDNSFlag", &DNSQuestion::getEDNSFlag);
d_lw->registerMember("name", &DNSRecord::d_name);
d_lw->registerMember("type", &DNSRecord::d_type);
d_lw->registerMember("ttl", &DNSRecord::d_ttl);
const struct dnsheader* dh{nullptr};
const bool isTcp;
const std::vector<pair<uint16_t, string>>* ednsOptions{nullptr};
+ const uint16_t* ednsFlags{nullptr};
vector<DNSRecord>* currentRecords{nullptr};
DNSFilterEngine::Policy* appliedPolicy{nullptr};
std::vector<std::string>* policyTags{nullptr};
vector<pair<uint16_t, string> > getEDNSOptions() const;
boost::optional<string> getEDNSOption(uint16_t code) const;
boost::optional<Netmask> getEDNSSubnet() const;
+ vector<string> getEDNSFlags() const;
+ bool getEDNSFlag(string flag) const;
void setRecords(const vector<pair<int,DNSRecord> >& records);
int rcode{0};
std::shared_ptr<RecursorLua4::DNSQuestion> dq = nullptr;
if (t_pdl->get() && (*t_pdl)->needDQ()) {
dq = std::make_shared<RecursorLua4::DNSQuestion>(dc->d_remote, dc->d_local, dc->d_mdp.d_qname, dc->d_mdp.d_qtype, dc->d_tcp, variableAnswer, wantsRPZ);
+ dq->ednsFlags = &edo.d_Z;
dq->ednsOptions = &dc->d_ednsOpts;
dq->tag = dc->d_tag;
dq->discardedPolicies = &sr.d_discardedPolicies;