Subject: | SharedCache (and probably other caches are incorrectly caching OPT records |
Net::DNSServer::SharedCache.pm is incorrectly storing ephemeral pseudo OPT records; these are required for EDNS and are different from request to request and shouldn't be cached. The patch I have attached fixes SharedCache; a similar patch should probably be applied to N::D::Cache as well.
You'll know you have this problem if you see the following error when using SharedCache and EDNS:
You should not try to create a OPT RR from a string
Not implemented at /usr/local/share/perl/5.18.2/Net/DNSServer/SharedCache.pm line 136.
Subject: | dont-cache-opt-records.patch |
diff -urN Net-DNSServer-0.11/lib/Net/DNSServer/SharedCache.pm Net-DNSServer-0.12/lib/Net/DNSServer/SharedCache.pm
--- Net-DNSServer-0.11/lib/Net/DNSServer/SharedCache.pm 2002-04-08 08:20:48.000000000 +0100
+++ Net-DNSServer-0.12/lib/Net/DNSServer/SharedCache.pm 2014-06-09 21:35:58.094407734 +0100
@@ -169,6 +169,8 @@
my $answer_hash = {};
my $dns_cache = $self -> {dns_cache};
foreach my $rr (@_) {
+ # don't store ephemeral pseudo type OPT
+ next if uc $rr->type eq 'OPT';
my $key = join("\t",$rr->name.".",$rr->class,$rr->type);
my $rdatastr = $rr->rdatastr();
my $ttl = $rr->ttl();