2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

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

@@ -1134,7 +1134,6 @@ doc_btext(cfg_printer_t *pctx, const cfg_type_t *type) {
cfg_print_cstr(pctx, "{ <unspecified-text> }");
}
bool
cfg_is_enum(const char *s, const char *const *enums) {
const char * const *p;
@@ -1275,6 +1274,51 @@ LIBISCCFG_EXTERNAL_DATA cfg_type_t cfg_type_bracketed_text = {
&cfg_rep_string, NULL
};
/*
* Optional bracketed text
*/
static isc_result_t
parse_optional_btext(cfg_parser_t *pctx, const cfg_type_t *type,
cfg_obj_t **ret)
{
isc_result_t result;
UNUSED(type);
CHECK(cfg_peektoken(pctx, ISC_LEXOPT_BTEXT));
if (pctx->token.type == isc_tokentype_btext) {
CHECK(cfg_parse_obj(pctx, &cfg_type_bracketed_text, ret));
} else {
CHECK(cfg_parse_obj(pctx, &cfg_type_void, ret));
}
cleanup:
return (result);
}
static void
print_optional_btext(cfg_printer_t *pctx, const cfg_obj_t *obj) {
if (obj->type == &cfg_type_void) {
return;
}
pctx->indent++;
cfg_print_cstr(pctx, "{");
cfg_print_chars(pctx, obj->value.string.base, obj->value.string.length);
print_close(pctx);
}
static void
doc_optional_btext(cfg_printer_t *pctx, const cfg_type_t *type) {
UNUSED(type);
cfg_print_cstr(pctx, "[ { <unspecified-text> } ]");
}
cfg_type_t cfg_type_optional_bracketed_text = {
"optional_btext", parse_optional_btext, print_optional_btext,
doc_optional_btext, NULL, NULL
};
/*
* Booleans
*/
@@ -1485,7 +1529,7 @@ print_list(cfg_printer_t *pctx, const cfg_obj_t *obj) {
isc_result_t
cfg_parse_bracketed_list(cfg_parser_t *pctx, const cfg_type_t *type,
cfg_obj_t **ret)
cfg_obj_t **ret)
{
isc_result_t result;