diff options
Diffstat (limited to 'lib/isccfg/namedconf.c')
-rw-r--r-- | lib/isccfg/namedconf.c | 107 |
1 files changed, 83 insertions, 24 deletions
diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c index 1c82f9bfd068..0787ec5e0ddc 100644 --- a/lib/isccfg/namedconf.c +++ b/lib/isccfg/namedconf.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2002, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -105,6 +105,7 @@ static cfg_type_t cfg_type_optional_class; static cfg_type_t cfg_type_optional_facility; static cfg_type_t cfg_type_optional_keyref; static cfg_type_t cfg_type_optional_port; +static cfg_type_t cfg_type_optional_uint32; static cfg_type_t cfg_type_options; static cfg_type_t cfg_type_portiplist; static cfg_type_t cfg_type_querysource4; @@ -745,7 +746,10 @@ parse_serverid(cfg_parser_t *pctx, const cfg_type_t *type, return (cfg_create_obj(pctx, &cfg_type_none, ret)); if (pctx->token.type == isc_tokentype_string && strcasecmp(TOKEN_STRING(pctx), "hostname") == 0) { - return (cfg_create_obj(pctx, &cfg_type_hostname, ret)); + result = cfg_create_obj(pctx, &cfg_type_hostname, ret); + if (result == ISC_R_SUCCESS) + (*ret)->value.boolean = ISC_TRUE; + return (result); } cfg_ungettoken(pctx); return (cfg_parse_qstring(pctx, type, ret)); @@ -841,6 +845,58 @@ static cfg_type_t cfg_type_bracketed_portlist = { &cfg_rep_list, &cfg_type_portrange }; +#ifdef ENABLE_FETCHLIMIT +/*% + * fetch-quota-params + */ +static cfg_tuplefielddef_t fetchquota_fields[] = { + { "frequency", &cfg_type_uint32, 0 }, + { "low", &cfg_type_fixedpoint, 0 }, + { "high", &cfg_type_fixedpoint, 0 }, + { "discount", &cfg_type_fixedpoint, 0 }, + { NULL, NULL, 0 } +}; + +static cfg_type_t cfg_type_fetchquota = { + "fetchquota", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, + &cfg_rep_tuple, fetchquota_fields +}; + +/*% + * fetches-per-server or fetches-per-zone + */ +static const char *response_enums[] = { "drop", "fail", NULL }; + +static isc_result_t +parse_optional_response(cfg_parser_t *pctx, const cfg_type_t *type, + cfg_obj_t **ret) +{ + return (parse_enum_or_other(pctx, type, &cfg_type_void, ret)); +} + +static void +doc_optional_response(cfg_printer_t *pctx, const cfg_type_t *type) { + UNUSED(type); + cfg_print_cstr(pctx, "[ ( drop | fail ) ]"); +} + +static cfg_type_t cfg_type_responsetype = { + "responsetype", parse_optional_response, cfg_print_ustring, + doc_optional_response, &cfg_rep_string, response_enums +}; + +static cfg_tuplefielddef_t fetchesper_fields[] = { + { "fetches", &cfg_type_uint32, 0 }, + { "response", &cfg_type_responsetype, 0 }, + { NULL, NULL, 0 } +}; + +static cfg_type_t cfg_type_fetchesper = { + "fetchesper", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, + &cfg_rep_tuple, fetchesper_fields +}; +#endif /* ENABLE_FETCHLIMIT */ + /*% * Clauses that can be found within the top level of the named.conf * file only. @@ -1029,7 +1085,7 @@ static cfg_type_t cfg_type_masterformat = { * zone <string> [ policy (given|disabled|passthru| * nxdomain|nodata|cname <domain> ) ] * [ recursive-only yes|no ] [ max-policy-ttl number ] ; - * } [ recursive-only yes|no ] [ max-policy-ttl number ] ; + * } [ recursive-only yes|no ] [ max-policy-ttl number ] * [ break-dnssec yes|no ] [ min-ns-dots number ] ; */ @@ -1088,7 +1144,7 @@ cleanup: } /* - * Parse a tuple consisting of any kind of required field followed + * Parse a tuple consisting of any kind of required field followed * by 2 or more optional keyvalues that can be in any order. */ static isc_result_t @@ -1280,8 +1336,7 @@ static cfg_type_t cfg_type_rrl = { */ static void -print_lookaside(cfg_printer_t *pctx, const cfg_obj_t *obj) -{ +print_lookaside(cfg_printer_t *pctx, const cfg_obj_t *obj) { const cfg_obj_t *domain = obj->value.tuple[0]; if (domain->value.string.length == 4 && @@ -1384,6 +1439,11 @@ view_clauses[] = { { "empty-server", &cfg_type_astring, 0 }, { "empty-zones-enable", &cfg_type_boolean, 0 }, { "fetch-glue", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE }, +#ifdef ENABLE_FETCHLIMIT + { "fetch-quota-params", &cfg_type_fetchquota, 0 }, + { "fetches-per-server", &cfg_type_fetchesper, 0 }, + { "fetches-per-zone", &cfg_type_fetchesper, 0 }, +#endif /* ENABLE_FETCHLIMIT */ { "ixfr-from-differences", &cfg_type_ixfrdifftype, 0 }, { "lame-ttl", &cfg_type_uint32, 0 }, { "max-acache-size", &cfg_type_sizenodefault, 0 }, @@ -1610,24 +1670,6 @@ LIBISCCFG_EXTERNAL_DATA cfg_type_t cfg_type_bindkeys = { &cfg_rep_map, bindkeys_clausesets }; -/*% The new-zone-file syntax (for zones added by 'rndc addzone') */ -static cfg_clausedef_t -newzones_clauses[] = { - { "zone", &cfg_type_zone, CFG_CLAUSEFLAG_MULTI }, - { NULL, NULL, 0 } -}; - -static cfg_clausedef_t * -newzones_clausesets[] = { - newzones_clauses, - NULL -}; - -LIBISCCFG_EXTERNAL_DATA cfg_type_t cfg_type_newzones = { - "newzones", cfg_parse_mapbody, cfg_print_mapbody, cfg_doc_mapbody, - &cfg_rep_map, newzones_clausesets -}; - /*% The "options" statement syntax. */ static cfg_clausedef_t * @@ -1824,6 +1866,23 @@ LIBISCCFG_EXTERNAL_DATA cfg_type_t cfg_type_addzoneconf = { &cfg_rep_map, addzoneconf_clausesets }; +/*% The new-zone-file syntax (for zones added by 'rndc addzone') */ +static cfg_clausedef_t +newzones_clauses[] = { + { "zone", &cfg_type_addzone, CFG_CLAUSEFLAG_MULTI }, + { NULL, NULL, 0 } +}; + +static cfg_clausedef_t * +newzones_clausesets[] = { + newzones_clauses, + NULL +}; + +LIBISCCFG_EXTERNAL_DATA cfg_type_t cfg_type_newzones = { + "newzones", cfg_parse_mapbody, cfg_print_mapbody, cfg_doc_mapbody, + &cfg_rep_map, newzones_clausesets +}; static isc_result_t parse_unitstring(char *str, isc_resourcevalue_t *valuep) { |