mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
remote control tests.
git-svn-id: file:///svn/unbound/trunk@1270 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
66dcc95a78
commit
556d5407e2
5 changed files with 20 additions and 17 deletions
|
|
@ -939,9 +939,9 @@ do_zone_remove(SSL* ssl, struct worker* worker, char* arg)
|
||||||
nmlabs, LDNS_RR_CLASS_IN))) {
|
nmlabs, LDNS_RR_CLASS_IN))) {
|
||||||
/* present in tree */
|
/* present in tree */
|
||||||
local_zones_del_zone(worker->daemon->local_zones, z);
|
local_zones_del_zone(worker->daemon->local_zones, z);
|
||||||
free(nm);
|
|
||||||
}
|
}
|
||||||
lock_quick_unlock(&worker->daemon->local_zones->lock);
|
lock_quick_unlock(&worker->daemon->local_zones->lock);
|
||||||
|
free(nm);
|
||||||
send_ok(ssl);
|
send_ok(ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
26 September 2008: Wouter
|
||||||
|
- tests for remote-control.
|
||||||
|
- small memory leak in exception during remote control fixed.
|
||||||
|
- fixup for lock checking but not unchecking in remote control.
|
||||||
|
|
||||||
23 September 2008: Wouter
|
23 September 2008: Wouter
|
||||||
- Msg cache is loaded. A cache load enables cache responses.
|
- Msg cache is loaded. A cache load enables cache responses.
|
||||||
- unbound-control flush [name], flush_type and flush_zone.
|
- unbound-control flush [name], flush_type and flush_zone.
|
||||||
|
|
|
||||||
|
|
@ -144,8 +144,8 @@ parse_dname(const char* str, uint8_t** res, size_t* len, int* labs)
|
||||||
|
|
||||||
/** create a new localzone */
|
/** create a new localzone */
|
||||||
static struct local_zone*
|
static struct local_zone*
|
||||||
local_zone_create(struct local_zones* zones, uint8_t* nm, size_t len,
|
local_zone_create(uint8_t* nm, size_t len, int labs,
|
||||||
int labs, enum localzone_type t, uint16_t dclass)
|
enum localzone_type t, uint16_t dclass)
|
||||||
{
|
{
|
||||||
struct local_zone* z = (struct local_zone*)calloc(1, sizeof(*z));
|
struct local_zone* z = (struct local_zone*)calloc(1, sizeof(*z));
|
||||||
if(!z) {
|
if(!z) {
|
||||||
|
|
@ -165,13 +165,7 @@ local_zone_create(struct local_zones* zones, uint8_t* nm, size_t len,
|
||||||
}
|
}
|
||||||
rbtree_init(&z->data, &local_data_cmp);
|
rbtree_init(&z->data, &local_data_cmp);
|
||||||
lock_protect(&z->lock, &z->parent, sizeof(*z)-sizeof(rbnode_t));
|
lock_protect(&z->lock, &z->parent, sizeof(*z)-sizeof(rbnode_t));
|
||||||
lock_protect(&zones->lock, &z->node, sizeof(z->node));
|
/* also the zones->lock protects node, parent, name*, class */
|
||||||
lock_protect(&zones->lock, &z->parent, sizeof(z->parent));
|
|
||||||
lock_protect(&zones->lock, &z->name, sizeof(z->name));
|
|
||||||
lock_protect(&zones->lock, &z->namelen, sizeof(z->namelen));
|
|
||||||
lock_protect(&zones->lock, &z->namelabs, sizeof(z->namelabs));
|
|
||||||
lock_protect(&zones->lock, &z->dclass, sizeof(z->dclass));
|
|
||||||
(void)zones; /* avoid argument unused warning if no lock checks */
|
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -180,7 +174,7 @@ static struct local_zone*
|
||||||
lz_enter_zone_dname(struct local_zones* zones, uint8_t* nm, size_t len,
|
lz_enter_zone_dname(struct local_zones* zones, uint8_t* nm, size_t len,
|
||||||
int labs, enum localzone_type t, uint16_t c)
|
int labs, enum localzone_type t, uint16_t c)
|
||||||
{
|
{
|
||||||
struct local_zone* z = local_zone_create(zones, nm, len, labs, t, c);
|
struct local_zone* z = local_zone_create(nm, len, labs, t, c);
|
||||||
if(!z) {
|
if(!z) {
|
||||||
log_err("out of memory");
|
log_err("out of memory");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -1180,8 +1174,7 @@ struct local_zone* local_zones_add_zone(struct local_zones* zones,
|
||||||
enum localzone_type tp)
|
enum localzone_type tp)
|
||||||
{
|
{
|
||||||
/* create */
|
/* create */
|
||||||
struct local_zone* z = local_zone_create(zones, name, len, labs, tp,
|
struct local_zone* z = local_zone_create(name, len, labs, tp, dclass);
|
||||||
dclass);
|
|
||||||
if(!z) return NULL;
|
if(!z) return NULL;
|
||||||
lock_rw_wrlock(&z->lock);
|
lock_rw_wrlock(&z->lock);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,10 +58,10 @@ usage()
|
||||||
printf(" -s ip[@port] server address, if omitted config is used.\n");
|
printf(" -s ip[@port] server address, if omitted config is used.\n");
|
||||||
printf(" -h show this usage help.\n");
|
printf(" -h show this usage help.\n");
|
||||||
printf("Commands:\n");
|
printf("Commands:\n");
|
||||||
printf(" start start server; runs unbound(8)\n");
|
printf(" start start server; runs unbound(8)\n");
|
||||||
printf(" stop stops the server\n");
|
printf(" stop stops the server\n");
|
||||||
printf(" reload reloads the server\n");
|
printf(" reload reloads the server\n");
|
||||||
printf(" stats print statistics\n");
|
printf(" stats print statistics\n");
|
||||||
printf(" verbosity [number] change logging detail\n");
|
printf(" verbosity [number] change logging detail\n");
|
||||||
printf(" local_zone [name] [type] add new local zone\n");
|
printf(" local_zone [name] [type] add new local zone\n");
|
||||||
printf(" local_zone_remove [name] remove local zone and its contents\n");
|
printf(" local_zone_remove [name] remove local zone and its contents\n");
|
||||||
|
|
@ -302,6 +302,11 @@ int main(int argc, char* argv[])
|
||||||
int c, ret;
|
int c, ret;
|
||||||
char* cfgfile = CONFIGFILE;
|
char* cfgfile = CONFIGFILE;
|
||||||
char* svr = NULL;
|
char* svr = NULL;
|
||||||
|
#ifdef USE_THREAD_DEBUG
|
||||||
|
/* stop the file output from unbound-control, overwites the servers */
|
||||||
|
extern int check_locking_order;
|
||||||
|
check_locking_order = 0;
|
||||||
|
#endif /* USE_THREAD_DEBUG */
|
||||||
log_ident_set("unbound-control");
|
log_ident_set("unbound-control");
|
||||||
log_init(NULL, 0, NULL);
|
log_init(NULL, 0, NULL);
|
||||||
checklock_start();
|
checklock_start();
|
||||||
|
|
|
||||||
BIN
testdata/09-unbound-control.tpkg
vendored
BIN
testdata/09-unbound-control.tpkg
vendored
Binary file not shown.
Loading…
Reference in a new issue