* `DropAction()`: drop these packets
* `NoRecurseAction()`: strip RD bit from the question, let it go through
* `TCAction()`: create answer to query with TC and RD bits set, to move to TCP/IP
+ * `DisableValidationAction()`: set the CD bit in the question, let it go through
* Specialist rule generators
* addAnyTCRule(): generate TC=1 answers to ANY queries, moving them to TCP
* setDNSSECPool(): move queries requesting DNSSEC processing to this pool
return std::shared_ptr<DNSAction>(new TCAction);
});
+ g_lua.writeFunction("DisableValidationAction", []() {
+ return std::shared_ptr<DNSAction>(new DisableValidationAction);
+ });
+
g_lua.writeFunction("MaxQPSIPRule", [](unsigned int qps, boost::optional<int> ipv4trunc, boost::optional<int> ipv6trunc) {
return std::shared_ptr<DNSRule>(new MaxQPSIPRule(qps, ipv4trunc.get_value_or(32), ipv6trunc.get_value_or(64)));
});
});
+ g_lua.writeFunction("addDisableValidationRule", [](luadnsrule_t var) {
+ auto rule=makeRule(var);
+ g_rulactions.modify([rule](decltype(g_rulactions)::value_type& rulactions) {
+ rulactions.push_back({
+ rule,
+ std::make_shared<DisableValidationAction>() });
+ });
+ });
+
g_lua.writeFunction("addQPSPoolRule", [](luadnsrule_t var, int limit, string pool) {
auto rule = makeRule(var);
return "set rd=0";
}
};
+
+class DisableValidationAction : public DNSAction
+{
+public:
+ DNSAction::Action operator()(const ComboAddress& remote, const DNSName& qname, uint16_t qtype, dnsheader* dh, int len, string* ruleresult) const override
+ {
+ dh->cd = true;
+ return Action::HeaderModify;
+ }
+ string toString() const override
+ {
+ return "set cd=1";
+ }
+};