return true;
}
-bool DNSFilterEngine::rmNSIPTrigger(const Netmask& nm, Policy pol, size_t zone)
+bool DNSFilterEngine::Zone::rmNSIPTrigger(const Netmask& nm, Policy pol)
{
- assureZones(zone);
- auto& pols = d_zones[zone].propolNSAddr;
- pols.erase(nm);
+ d_propolNSAddr.erase(nm);
return true;
}
+
+ DNSRecord DNSFilterEngine::Policy::getCustomRecord(const DNSName& qname) const
+ {
+ if (d_kind != PolicyKind::Custom) {
+ throw std::runtime_error("Asking for a custom record from a filtering policy of a non-custom type");
+ }
+
+ DNSRecord result;
+ result.d_name = qname;
+ result.d_type = d_custom->getType();
+ result.d_ttl = d_ttl;
+ result.d_class = QClass::IN;
+ result.d_place = DNSResourceRecord::ANSWER;
+ result.d_content = d_custom;
+
+ if (result.d_type == QType::CNAME) {
+ const auto content = std::dynamic_pointer_cast<CNAMERecordContent>(d_custom);
+ if (content) {
+ DNSName target = content->getTarget();
+ if (target.isWildcard()) {
+ target.chopOff();
+ result.d_content = std::make_shared<CNAMERecordContent>(qname + target);
+ }
+ }
+ }
+
+ return result;
+ }