add hook statement to configuration parser

- allow multiple "hook" statements at global or view level
- add "optional bracketed text" type for optional parameter list
- load hook module from specified path rather than hardcoded path
- add a hooktable pointer (and a callback for freeing it) to the
  view structure
- change the hooktable functions so they no longer update ns__hook_table
  by default, and modify PROCESS_HOOK so it uses the view hooktable, if
  set, rather than ns__hook_table. (ns__hook_table is retained for
  use by unit tests.)
- update the filter-aaaa system test to load filter-aaaa.so
- add a prereq script to check for dlopen support before running
  the filter-aaaa system test

not yet done:
- configuration parameters are not being passed to the filter-aaaa
  module; the filter-aaaa ACL and filter-aaaa-on-{v4,v6} settings are
  still stored in dns_view
This commit is contained in:
Evan Hunt
2018-08-12 11:19:36 -07:00
parent e2ac439e28
commit d2f4644388
22 changed files with 289 additions and 87 deletions

View File

@@ -84,6 +84,9 @@ static void
run_sfcache_test(const ns__query_sfcache_test_params_t *test) {
query_ctx_t *qctx = NULL;
isc_result_t result;
ns_hook_t hook = {
.callback = ns_test_hook_catch_call,
};
REQUIRE(test != NULL);
REQUIRE(test->id.description != NULL);
@@ -93,14 +96,9 @@ run_sfcache_test(const ns__query_sfcache_test_params_t *test) {
/*
* Interrupt execution if ns_query_done() is called.
*/
ns_hook_t hook = {
.callback = ns_test_hook_catch_call,
};
ns_hooktable_t query_hooks;
ns_hooktable_init(&query_hooks);
ns_hook_add(&query_hooks, NS_QUERY_DONE_BEGIN, &hook);
ns_hooktable_reset(&query_hooks);
ns_hooktable_init(ns__hook_table);
ns_hook_add(ns__hook_table, NS_QUERY_DONE_BEGIN, &hook);
/*
* Construct a query context for a ./NS query with given flags.
@@ -283,6 +281,9 @@ static void
run_start_test(const ns__query_start_test_params_t *test) {
query_ctx_t *qctx = NULL;
isc_result_t result;
ns_hook_t hook = {
.callback = ns_test_hook_catch_call,
};
REQUIRE(test != NULL);
REQUIRE(test->id.description != NULL);
@@ -294,16 +295,10 @@ run_start_test(const ns__query_start_test_params_t *test) {
/*
* Interrupt execution if query_lookup() or ns_query_done() is called.
*/
ns_hook_t hook = {
.callback = ns_test_hook_catch_call,
};
ns_hooktable_t query_hooks;
ns_hooktable_init(&query_hooks);
ns_hook_add(&query_hooks, NS_QUERY_LOOKUP_BEGIN, &hook);
ns_hook_add(&query_hooks, NS_QUERY_DONE_BEGIN, &hook);
ns_hooktable_reset(&query_hooks);
ns_hooktable_init(ns__hook_table);
ns_hook_add(ns__hook_table, NS_QUERY_LOOKUP_BEGIN, &hook);
ns_hook_add(ns__hook_table, NS_QUERY_DONE_BEGIN, &hook);
/*
* Construct a query context using the supplied parameters.