From f35ae11ff44f842076028342f436cf062b253abc Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Fri, 7 Mar 2008 10:16:09 +0000 Subject: [PATCH] harvest opt. git-svn-id: file:///svn/unbound/trunk@1016 be551aaa-1e26-0410-a405-d3ace91eadb9 --- doc/Changelog | 3 +++ testcode/harvest.c | 17 ++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index b2bcd36a8..ea5482231 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +7 March 2008: Wouter + - -C config feature for harvest program. + 5 March 2008: Wouter - patch from Hugo Koji Kobayashi for iterator logs spelling. diff --git a/testcode/harvest.c b/testcode/harvest.c index 4944cba66..0f04730b6 100644 --- a/testcode/harvest.c +++ b/testcode/harvest.c @@ -160,6 +160,7 @@ static void usage(char* nm) printf("-f fnm query list to read from file\n"); printf(" every line has format: qname qclass qtype\n"); printf("-v verbose (-v -v even more)\n"); + printf("-C cfg config file with resolver options\n"); exit(1); } @@ -479,14 +480,19 @@ process(struct harvest_data* data, struct todo_item* it) free(nm); return; } + if(result->rcode == LDNS_RCODE_SERVFAIL) { + free(nm); + return; + } /* even if result is a negative, try to store resulting SOA/NSEC */ /* create ldns pkt */ s = ldns_wire2pkt(&pkt, result->answer_packet, (size_t)result->answer_len); if(s != LDNS_STATUS_OK) { - printf("ldns_wire2pkt failed! %s %d %d %s", nm, - it->qtype, it->qclass, ldns_get_errorstr_by_id(s)); + printf("ldns_wire2pkt failed! %s %d %d %s %d\n", nm, + it->qtype, it->qclass, ldns_get_errorstr_by_id(s), + result->answer_len); free(nm); return; } @@ -531,6 +537,7 @@ harvest_main(struct harvest_data* data) } data->numtodo--; process(data, it); + usleep(1000000/100); } } @@ -785,8 +792,12 @@ int main(int argc, char* argv[]) data.maxdepth = 2; /* parse the options */ - while( (c=getopt(argc, argv, "hf:v")) != -1) { + while( (c=getopt(argc, argv, "hf:vC:")) != -1) { switch(c) { + case 'C': + if(ub_ctx_config(data.ctx, optarg) != 0) + error_exit("config read failed"); + break; case 'f': qlist_read_file(&data, optarg); break; -- 2.47.2