uint16_t family;
uint8_t sourceMask;
uint8_t scopeMask;
- } GCCPACKATTRIBUTE;
+ } GCCPACKATTRIBUTE; // BRRRRR
}
return ret;
}
-boost::optional<Netmask> getEDNSSubnetMask(const ComboAddress& local, const DNSName&dn, const ComboAddress& rem)
-{
- if(local.sin4.sin_family != AF_INET || local.sin4.sin_addr.s_addr) { // detect unset 'requestor'
- if(g_ednsdomains.check(dn) || g_ednssubnets.match(rem)) {
- int bits =local.sin4.sin_family == AF_INET ? 24 : 64;
- ComboAddress trunc(local);
- trunc.truncate(bits);
- return boost::optional<Netmask>(Netmask(trunc, bits));
- }
- }
- return boost::optional<Netmask>();
-}
-
-void parseEDNSSubnetWhitelist(const std::string& wlist)
-{
- vector<string> parts;
- stringtok(parts, wlist, ",;");
- for(const auto& a : parts) {
- try {
- Netmask nm(a);
- g_ednssubnets.addMask(nm);
- }
- catch(...) {
- g_ednsdomains.add(DNSName(a));
- }
- }
-}
bool getEDNSSubnetOptsFromString(const string& options, EDNSSubnetOpts* eso);
string makeEDNSSubnetOptsString(const EDNSSubnetOpts& eso);
-boost::optional<Netmask> getEDNSSubnetMask(const ComboAddress& local, const DNSName&dn, const ComboAddress& rem);
-void parseEDNSSubnetWhitelist(const std::string& wlist);
#endif
l_initialized = true;
}
+boost::optional<Netmask> getEDNSSubnetMask(const ComboAddress& local, const DNSName&dn, const ComboAddress& rem)
+{
+ if(local.sin4.sin_family != AF_INET || local.sin4.sin_addr.s_addr) { // detect unset 'requestor'
+ if(g_ednsdomains.check(dn) || g_ednssubnets.match(rem)) {
+ int bits =local.sin4.sin_family == AF_INET ? 24 : 64;
+ ComboAddress trunc(local);
+ trunc.truncate(bits);
+ return boost::optional<Netmask>(Netmask(trunc, bits));
+ }
+ }
+ return boost::optional<Netmask>();
+}
+
+void parseEDNSSubnetWhitelist(const std::string& wlist)
+{
+ vector<string> parts;
+ stringtok(parts, wlist, ",;");
+ for(const auto& a : parts) {
+ try {
+ Netmask nm(a);
+ g_ednssubnets.addMask(nm);
+ }
+ catch(...) {
+ g_ednsdomains.add(DNSName(a));
+ }
+ }
+}
+
+
int serviceMain(int argc, char*argv[])
{
uint64_t* pleaseWipePacketCache(const DNSName& canon, bool subtree);
uint64_t* pleaseWipeAndCountNegCache(const DNSName& canon, bool subtree=false);
void doCarbonDump(void*);
+boost::optional<Netmask> getEDNSSubnetMask(const ComboAddress& local, const DNSName&dn, const ComboAddress& rem);
+void parseEDNSSubnetWhitelist(const std::string& wlist);
+
#endif