int ttl;
map<DNSName, string> services;
map<DNSName, vector<DNSResourceRecord> > records;
+ uint8_t ipv4EDNSScope{24}, ipv6EDNSScope{64};
};
static vector<GeoIPDomain> s_domains;
dom.id = s_domains.size();
dom.domain = DNSName(domain["domain"].as<string>());
dom.ttl = domain["ttl"].as<int>();
+ dom.ipv4EDNSScope = domain["ipv4ednsscope"].as<int>(24);
+ dom.ipv6EDNSScope = domain["ipv6ednsscope"].as<int>(64);
+
for(YAML::const_iterator recs = domain["records"].begin(); recs != domain["records"].end(); recs++) {
DNSName qname = DNSName(recs->first.as<string>());
if (ri != dom.records.end()) { // return static value
for(DNSResourceRecord& rr : ri->second) {
if (qtype == QType::ANY || rr.qtype == qtype) {
- rr.scopeMask = (v6 ? 128 : 32);
+ rr.scopeMask = (v6 ? dom.ipv6EDNSScope : dom.ipv4EDNSScope);
d_result.push_back(rr);
d_result.back().qname = qdomain;
}
rr.content = format;
rr.auth = 1;
rr.ttl = dom.ttl;
- rr.scopeMask = (v6 ? 128 : 32);
+ rr.scopeMask = (v6 ? dom.ipv6EDNSScope : dom.ipv4EDNSScope);
d_result.push_back(rr);
}
dnsrecords.cc dnsrecords.hh \
dnssecinfra.cc \
dnswriter.cc dnswriter.hh \
+ ednssubnet.cc ednssubnet.hh \
filterpo.cc filterpo.hh \
gss_context.cc gss_context.hh \
iputils.cc \
#include "dns_random.hh"
#include <boost/scoped_array.hpp>
#include <boost/algorithm/string.hpp>
+#include "ednssubnet.hh"
//! returns -2 for OS limits error, -1 for permanent error that has to do with remote **transport**, 0 for timeout, 1 for success
/** lwr is only filled out in case 1 was returned, and even when returning 1 for 'success', lwr might contain DNS errors
if(EDNS0Level && !doTCP) {
DNSPacketWriter::optvect_t opts;
+ EDNSSubnetOpts eo;
+ eo.source = Netmask("2001:470:1f0b:27e:1850:ae41:cc31:7765");
+ opts.push_back(make_pair(8, makeEDNSSubnetOptsString(eo)));
pw.addOpt(1200, 0, EDNSOpts::DNSSECOK, opts); // 1200 bytes answer size
pw.commit();
#include <boost/multi_index/key_extractors.hpp>
#include <boost/multi_index/sequenced_index.hpp>
#include <boost/version.hpp>
-
+#include "iputils.hh"
#undef max
#define L theL()
struct CacheEntry
{
CacheEntry(const boost::tuple<DNSName, uint16_t>& key, const vector<shared_ptr<DNSRecordContent>>& records, bool auth) :
- d_qname(key.get<0>()), d_qtype(key.get<1>()), d_auth(auth), d_records(records), d_ttd(0)
+ d_qname(key.get<0>()), d_qtype(key.get<1>()), d_auth(auth), d_ttd(0), d_records(records)
{}
typedef vector<std::shared_ptr<DNSRecordContent>> records_t;
return d_ttd;
}
- DNSName d_qname;
+ DNSName d_qname;
uint16_t d_qtype;
bool d_auth;
- records_t d_records;
uint32_t d_ttd;
+ records_t d_records;
+ vector<pair<Netmask, records_t> > d_subnetspecific;
};
typedef multi_index_container<
bufsize=2800;
DNSPacketWriter::optvect_t opts;
if(ednsnm) {
-
-
EDNSSubnetOpts eo;
eo.source = *ednsnm;
opts.push_back(make_pair(8, makeEDNSSubnetOptsString(eo)));