- Add unbound-control view_local_datas command, like local_datas.

git-svn-id: file:///svn/unbound/trunk@4977 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2018-11-26 13:37:23 +00:00
parent 8fcc82171a
commit 470806b097
4 changed files with 30 additions and 0 deletions

View file

@ -1428,6 +1428,28 @@ do_view_data_add(RES* ssl, struct worker* worker, char* arg)
lock_rw_unlock(&v->lock);
}
/** Add new RR data from stdin to view */
static void
do_view_datas_add(RES* ssl, struct worker* worker, char* arg)
{
struct view* v;
v = views_find_view(worker->daemon->views,
arg, 1 /* get write lock*/);
if(!v) {
ssl_printf(ssl,"no view with name: %s\n", arg);
return;
}
if(!v->local_zones) {
if(!(v->local_zones = local_zones_create())){
lock_rw_unlock(&v->lock);
ssl_printf(ssl,"error out of memory\n");
return;
}
}
do_datas_add(ssl, v->local_zones);
lock_rw_unlock(&v->lock);
}
/** Remove RR data from view */
static void
do_view_data_remove(RES* ssl, struct worker* worker, char* arg)
@ -2963,6 +2985,8 @@ execute_cmd(struct daemon_remote* rc, RES* ssl, char* cmd,
do_view_data_remove(ssl, worker, skipwhite(p+22));
} else if(cmdcmp(p, "view_local_data", 15)) {
do_view_data_add(ssl, worker, skipwhite(p+15));
} else if(cmdcmp(p, "view_local_datas", 16)) {
do_view_datas_add(ssl, worker, skipwhite(p+16));
} else if(cmdcmp(p, "flush_zone", 10)) {
do_flush_zone(ssl, worker, skipwhite(p+10));
} else if(cmdcmp(p, "flush_type", 10)) {

View file

@ -3,6 +3,7 @@
sorted and in a predictable order.
- Fix #4193: Fix that prefetch failure does not overwrite valid cache
entry with SERVFAIL.
- Add unbound-control view_local_datas command, like local_datas.
22 November 2018: Wouter
- With ./configure --with-pyunbound --with-pythonmodule

View file

@ -322,6 +322,9 @@ serial check). And then the zone is transferred for a newer zone version.
.TP
.B view_local_data_remove \fIview\fR \fIname
\fIlocal_data_remove\fR for given view.
.TP
.B view_local_datas \fIview\fR
Add a list of \fIlocal_data\fR for given view from stdin. Like local_datas.
.SH "EXIT CODE"
The unbound\-control program exits with status code 1 on error, 0 on success.
.SH "SET UP"

View file

@ -154,6 +154,8 @@ usage(void)
printf(" view_local_zone view name type add local-zone in view\n");
printf(" view_local_zone_remove view name remove local-zone in view\n");
printf(" view_local_data view RR... add local-data in view\n");
printf(" view_local_datas view add list of local-data to view\n");
printf(" one entry per line read from stdin\n");
printf(" view_local_data_remove view name remove local-data in view\n");
printf("Version %s\n", PACKAGE_VERSION);
printf("BSD licensed, see LICENSE in source package for details.\n");