]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
debug option.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 7 Dec 2007 08:29:09 +0000 (08:29 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 7 Dec 2007 08:29:09 +0000 (08:29 +0000)
git-svn-id: file:///svn/unbound/trunk@813 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
libunbound/ubsyms.def
libunbound/unbound.c
libunbound/unbound.h
smallapp/unbound-host.c

index 07fcf62415f237c91cc17b735a5f35f3965610d9..63e7a97120a7135e678a8045b7c75c8243bb5b07 100644 (file)
@@ -1,3 +1,7 @@
+7 December 2007: Wouter
+       - unbound-host has a -d option to show what happens. This can help
+         with debugging (why do I get this answer).
+
 6 December 2007: Wouter
        - library resolution works in foreground mode, unbound-host app
          receives data.
index 966c2bc28eda37ce8a183de9bccf842e8be2dc45..8e4ae9d48354c698ab4e8d958720b15b665e7017 100644 (file)
@@ -4,6 +4,7 @@ ub_val_ctx_config
 ub_val_ctx_add_ta
 ub_val_ctx_add_ta_file
 ub_val_ctx_trustedkeys
+ub_val_ctx_debuglevel
 ub_val_ctx_async
 ub_val_ctx_poll
 ub_val_ctx_wait
index ea02141bf56ea0ff5455e334313b34d267c8dc16..fc39982b332ceed31927672cf6a893420b604737 100644 (file)
@@ -221,6 +221,16 @@ ub_val_ctx_trustedkeys(struct ub_val_ctx* ctx, char* fname)
        return UB_NOERROR;
 }
 
+int
+ub_val_ctx_debuglevel(struct ub_val_ctx* ctx, int d)
+{
+       lock_basic_lock(&ctx->cfglock);
+       verbosity = d;
+       ctx->env->cfg->verbosity = d;
+       lock_basic_unlock(&ctx->cfglock);
+       return UB_NOERROR;
+}
+
 int 
 ub_val_ctx_async(struct ub_val_ctx* ctx, int dothread)
 {
index 7f2538c91a0452fb1793b304aadc24c36c082079..8a2a87811bf9bcb5205065c4911d0fa357fed150 100644 (file)
@@ -239,6 +239,16 @@ int ub_val_ctx_add_ta_file(struct ub_val_ctx* ctx, char* fname);
  */
 int ub_val_ctx_trustedkeys(struct ub_val_ctx* ctx, char* fname);
 
+/**
+ * Set debug verbosity for the context
+ * Output is directed to stderr.
+ * @param ctx: context.
+ * @param d: debug level, 0 is off, 1 is very minimal, 2 is detailed, 
+ *     and 3 is lots.
+ * @return 0 if OK, else error.
+ */
+int ub_val_ctx_debuglevel(struct ub_val_ctx* ctx, int d);
+
 /**
  * Set a context behaviour for asynchronous action.
  * @param ctx: context.
index 9d6594a987fd204ca1f3deee8fed6bfe2fd06ab4..68150f38b27964ae37c323874a6179e349bc5300 100644 (file)
@@ -64,6 +64,7 @@ usage()
        printf("    -f keyfile          read trust anchors from file, with lines as -y.\n");
        printf("    -F keyfile          read named.conf-style trust anchors.\n");
        printf("    -v                  be more verbose, shows nodata and security.\n");
+       printf("    -d                  debug, traces the action, -d -d shows more.\n");
        printf("    -h                  show this usage help.\n");
        printf("Version %s\n", PACKAGE_VERSION);
        printf("BSD licensed, see LICENSE in source package for details.\n");
@@ -375,6 +376,7 @@ int main(int argc, char* argv[])
        char* qclass = NULL;
        char* qtype = NULL;
        struct ub_val_ctx* ctx = NULL;
+       int debuglevel = 0;
        
        ctx = ub_val_ctx_create();
        if(!ctx) {
@@ -383,11 +385,17 @@ int main(int argc, char* argv[])
        }
 
        /* parse the options */
-       while( (c=getopt(argc, argv, "F:c:f:ht:vy:")) != -1) {
+       while( (c=getopt(argc, argv, "F:c:df:ht:vy:")) != -1) {
                switch(c) {
                case 'c':
                        qclass = optarg;
                        break;
+               case 'd':
+                       debuglevel++;
+                       if(debuglevel < 2) 
+                               debuglevel = 2; /* at least VERB_DETAIL */
+                       ub_val_ctx_debuglevel(ctx, debuglevel);
+                       break;
                case 't':
                        qtype = optarg;
                        break;