show fwders in use.

git-svn-id: file:///svn/unbound/trunk@1481 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2009-02-12 16:11:53 +00:00
parent df8005ff3c
commit dfef08c21f
3 changed files with 29 additions and 1 deletions

View file

@ -1219,6 +1219,28 @@ do_flush_name(SSL* ssl, struct worker* worker, char* arg)
send_ok(ssl);
}
/** print root forwards */
static int
print_root_fwds(SSL* ssl, struct config_file* cfg)
{
struct config_stub* s;
if(!ssl_printf(ssl, "root-forward:"))
return 0;
for(s = cfg->forwards; s; s = s->next) {
if(s->name && strcmp(s->name, ".") == 0) {
struct config_strlist* p;
for(p = s->hosts; p; p = p->next)
if(!ssl_printf(ssl, " %s", p->str))
return 0;
for(p = s->addrs; p; p = p->next)
if(!ssl_printf(ssl, " %s", p->str))
return 0;
return ssl_printf(ssl, "\n");
}
}
return ssl_printf(ssl, " no (using root hints)\n");
}
/** do the status command */
static void
do_status(SSL* ssl, struct worker* worker)
@ -1239,6 +1261,8 @@ do_status(SSL* ssl, struct worker* worker)
}
if(!ssl_printf(ssl, " ]\n"))
return;
if(!print_root_fwds(ssl, worker->env.cfg))
return;
uptime = (time_t)time(NULL) - (time_t)worker->daemon->time_boot.tv_sec;
if(!ssl_printf(ssl, "uptime: %u seconds\n", (unsigned)uptime))
return;

View file

@ -5,6 +5,8 @@
- stats_noreset feature for unbound-control.
- flush_requestlist feature for unbound-control.
- libunbound version upped API (was changed 5 feb).
- unbound-control status shows if root forwarding is in use.
- slightly nicer memory management in iter-fwd code.
10 February 2009: Wouter
- keys with rfc5011 REVOKE flag are skipped and not considered when

View file

@ -238,6 +238,7 @@ int
forwards_apply_cfg(struct iter_forwards* fwd, struct config_file* cfg)
{
free(fwd->tree);
regional_free_all(fwd->region);
fwd->tree = rbtree_create(fwd_cmp);
if(!fwd->tree)
return 0;
@ -288,5 +289,6 @@ forwards_get_mem(struct iter_forwards* fwd)
{
if(!fwd)
return 0;
return sizeof(*fwd) + regional_get_mem(fwd->region);
return sizeof(*fwd) + sizeof(*fwd->tree) +
regional_get_mem(fwd->region);
}