+sub has_dnskey_parent {
+ my $zone = shift;
+
+ my $potential_parent = $zone;
+ $potential_parent =~ s/^[^.]*\.//;
+
+ my $pkt = $RES->send($potential_parent, 'DNSKEY');
+ return undef unless $pkt;
+ return undef unless $pkt->header;
+
+ # try to find the zone start
+ unless ($pkt->answer) {
+ #print "Looking for zone apex\n";
+ return undef unless $pkt->authority;
+ for my $rr ($pkt->authority) {
+ next unless ($rr->type eq 'SOA');
+
+ $potential_parent = $rr->name;
+ #print "Found it at $potential_parent\n";
+ $pkt = $RES->send($potential_parent, 'DNSKEY');
+ return undef unless $pkt;
+ last;
+ };
+ };
+
+ return 0 unless $pkt->answer;
+ for my $rr ($pkt->answer) {
+ next unless ($rr->type eq 'DNSKEY');
+ return 1;
+ };
+}