]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
harvest opt.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 7 Mar 2008 10:16:09 +0000 (10:16 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 7 Mar 2008 10:16:09 +0000 (10:16 +0000)
git-svn-id: file:///svn/unbound/trunk@1016 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
testcode/harvest.c

index b2bcd36a8b5e0fa7e293b7facdcc3e14c082f505..ea54822316a8a5f06ad3874df1bea2a267f615a2 100644 (file)
@@ -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.
 
index 4944cba663d3a56f917ef9f7db2b5488bfd05456..0f04730b65c6a8a593595b4389353688b865118c 100644 (file)
@@ -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;