: Report running version.
wipe-cache *DOMAIN* [*DOMAIN*] [...]
-: Wipe entries for *DOMAIN* from the cache. This is useful if, for example,
- an important server has a new IP address, but the TTL has not yet
- expired. Multiple domain names can be passed. Note that you must
- terminate a domain with a .! So to wipe powerdns.org, issue
- 'rec_control wipe-cache powerdns.org.'.
- Versions beyond 3.1 don't need the trailing dot. Consider not only
- wiping 'www.domain.com.' but also 'domain.com.', as the cached nameservers
- or target of CNAME may continue to be undesired.
+: Wipe entries for *DOMAIN* (exact name match) from the cache. This is useful
+ if, for example, an important server has a new IP address, but the TTL has
+ not yet expired. Multiple domain names can be passed. *DOMAIN* can be
+ suffixed with a '$' to delete the whole tree from the cache. i.e. 'powerdns.com$'
+ will remove all cached entries under and including the powerdns.com name.
# BUGS
None known. File new ones at https://github.com/PowerDNS/pdns/issues.
# RESOURCES
-Website: http://wiki.powerdns.com, http://www.powerdns.com
+Website: https://docs.powerdns.com, https://www.powerdns.com
# SEE ALSO
pdns_recursor(1)
template<typename T>
string doWipeCache(T begin, T end)
{
- int count=0, pcount=0, countNeg=0;
+ vector<pair<DNSName, bool> > toWipe;
for(T i=begin; i != end; ++i) {
DNSName canon;
bool subtree=false;
- if(boost::ends_with(*i, "$")) {
- canon=DNSName(i->substr(0, i->size()-1));
- subtree=true;
+
+ try {
+ if(boost::ends_with(*i, "$")) {
+ canon=DNSName(i->substr(0, i->size()-1));
+ subtree=true;
+ } else {
+ canon=DNSName(*i);
+ }
+ } catch (std::exception &e) {
+ return "Error: " + std::string(e.what()) + ", nothing wiped\n";
}
- else
- canon=DNSName(*i);
-
- count+= broadcastAccFunction<uint64_t>(boost::bind(pleaseWipeCache, canon, subtree));
- pcount+= broadcastAccFunction<uint64_t>(boost::bind(pleaseWipePacketCache, canon, subtree));
- countNeg+=broadcastAccFunction<uint64_t>(boost::bind(pleaseWipeAndCountNegCache, canon, subtree));
+ toWipe.push_back({canon, subtree});
+ }
+
+ int count=0, pcount=0, countNeg=0;
+ for (auto wipe : toWipe) {
+ count+= broadcastAccFunction<uint64_t>(boost::bind(pleaseWipeCache, wipe.first, wipe.second));
+ pcount+= broadcastAccFunction<uint64_t>(boost::bind(pleaseWipePacketCache, wipe.first, wipe.second));
+ countNeg+=broadcastAccFunction<uint64_t>(boost::bind(pleaseWipeAndCountNegCache, wipe.first, wipe.second));
}
return "wiped "+std::to_string(count)+" records, "+std::to_string(countNeg)+" negative records, "+std::to_string(pcount)+" packets\n";