namedconf.c revision 0439bfedd97fa2e004cbf572773d703b33fda10f
7d32c065c7bb56f281651ae3dd2888f32ce4f1d9Bob Halley * Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC")
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * Copyright (C) 2002, 2003 Internet Software Consortium.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * Permission to use, copy, modify, and/or distribute this software for any
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * purpose with or without fee is hereby granted, provided that the above
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * copyright notice and this permission notice appear in all copies.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * PERFORMANCE OF THIS SOFTWARE.
940e4ef72b64a8a82a1038fdf08b324eec6e43a9Michael Graff#define TOKEN_STRING(pctx) (pctx->token.value.as_textregion.base)
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews/*% Check a return value. */
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews/*% Clean up a configuration object if non-NULL. */
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews do { if ((obj) != NULL) cfg_obj_destroy(pctx, &(obj)); } while (0)
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * Forward declarations of static functions.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsparse_enum_or_other(cfg_parser_t *pctx, const cfg_type_t *enumtype,
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsdoc_enum_or_other(cfg_printer_t *pctx, const cfg_type_t *type);
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsparse_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret);
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafssonparse_optional_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type,
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsparse_updatepolicy(cfg_parser_t *pctx, const cfg_type_t *type,
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsprint_updatepolicy(cfg_printer_t *pctx, const cfg_obj_t *obj);
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsdoc_updatepolicy(cfg_printer_t *pctx, const cfg_type_t *type);
f7b99290c31abeb20c55fc55391510450ce60423Mark Andrewsprint_keyvalue(cfg_printer_t *pctx, const cfg_obj_t *obj);
1ef8965366d91e02a4672c35a187d30aa4a4c72cMark Andrewsdoc_keyvalue(cfg_printer_t *pctx, const cfg_type_t *type);
1ef8965366d91e02a4672c35a187d30aa4a4c72cMark Andrewsdoc_optional_keyvalue(cfg_printer_t *pctx, const cfg_type_t *type);
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsparse_geoip(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret);
940e4ef72b64a8a82a1038fdf08b324eec6e43a9Michael Graffprint_geoip(cfg_printer_t *pctx, const cfg_obj_t *obj);
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsdoc_geoip(cfg_printer_t *pctx, const cfg_type_t *type);
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews#endif /* HAVE_GEOIP */
52637f592f705ca93fadc218e403fd55e8ce4aeaMark Andrewsstatic cfg_type_t cfg_type_bracketed_namesockaddrkeylist;
52637f592f705ca93fadc218e403fd55e8ce4aeaMark Andrewsstatic cfg_type_t cfg_type_bracketed_dscpsockaddrlist;
52637f592f705ca93fadc218e403fd55e8ce4aeaMark Andrewsstatic cfg_type_t cfg_type_bracketed_sockaddrlist;
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsstatic cfg_type_t cfg_type_bracketed_sockaddrnameportlist;
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews/*% tkey-dhkey */
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Graffstatic cfg_tuplefielddef_t tkey_dhkey_fields[] = {
940e4ef72b64a8a82a1038fdf08b324eec6e43a9Michael Graff "tkey-dhkey", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple,
94a3bcd132e515b4baa0884ba9dd0f361d2e17bcMark Andrews/*% listen-on */
940e4ef72b64a8a82a1038fdf08b324eec6e43a9Michael Graffstatic cfg_tuplefielddef_t listenon_fields[] = {
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Graff "listenon", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple,
82ca33427bdd4f3bc4ed3431e86bd810fe751674Andreas Gustafssonstatic cfg_tuplefielddef_t acl_fields[] = {
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Graff "acl", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple, acl_fields };
940e4ef72b64a8a82a1038fdf08b324eec6e43a9Michael Graff/*% masters */
e27a69f8bd9538e08f775265167ba6cc5f47c587Bob Halley { "addresses", &cfg_type_bracketed_namesockaddrkeylist, 0 },
e27a69f8bd9538e08f775265167ba6cc5f47c587Bob Halley "masters", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple, masters_fields };
854d0238dbc2908490197984b3b9d558008a53dfMark Andrews * "sockaddrkeylist", a list of socket addresses with optional keys
static isc_result_t
return (result);
static isc_result_t
return (result);
static const char *matchtype_enums[] = {
static isc_result_t
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
return (ISC_R_UNEXPECTEDTOKEN);
return (result);
static const char *updatemethods_enums[] = {
static isc_result_t
static const char *zonetype_enums[] = {
static const char *loglevel_enums[] = {
static const char *transferformat_enums[] = {
static isc_result_t
return (result);
static isc_result_t
return (result);
static isc_result_t
return (result);
return (result);
static isc_result_t
return (result);
static isc_result_t
return (ISC_R_UNEXPECTEDTOKEN);
goto cleanup;
return (result);
* Clauses that can be found within the top level of the named.conf
static cfg_clausedef_t
namedconf_clauses[] = {
static cfg_clausedef_t
static cfg_clausedef_t
bindkeys_clauses[] = {
static cfg_clausedef_t
options_clauses[] = {
#ifdef HAVE_GEOIP
#ifdef ISC_PLATFORM_USESIT
static isc_result_t
return (ISC_R_SUCCESS);
return (result);
static isc_result_t
int fn;
goto cleanup;
return (ISC_R_SUCCESS);
return (result);
if (f != fields) {
if (f != fields)
static const char *rpz_policies[] = {
static isc_result_t
return (result);
static cfg_clausedef_t
dns64_clauses[] = {
static cfg_clausedef_t *
dns64_clausesets[] = {
static cfg_clausedef_t
view_clauses[] = {
#ifdef ISC_PLATFORM_USESIT
#ifdef ISC_PLATFORM_USESIT
#ifdef ALLOW_FILTER_AAAA
static cfg_clausedef_t
view_only_clauses[] = {
static cfg_clausedef_t
zone_clauses[] = {
static cfg_clausedef_t
zone_only_clauses[] = {
/*% The top-level named.conf syntax. */
static cfg_clausedef_t *
namedconf_clausesets[] = {
/*% The bind.keys syntax (trusted-keys/managed-keys only). */
static cfg_clausedef_t *
bindkeys_clausesets[] = {
static cfg_clausedef_t *
options_clausesets[] = {
static cfg_clausedef_t *
view_clausesets[] = {
static cfg_clausedef_t *
zone_clausesets[] = {
static cfg_clausedef_t
dlz_clauses[] = {
static cfg_clausedef_t *
dlz_clausesets[] = {
static cfg_clausedef_t
key_clauses[] = {
static cfg_clausedef_t *
key_clausesets[] = {
static cfg_clausedef_t
server_clauses[] = {
#ifdef ISC_PLATFORM_USESIT
static cfg_clausedef_t *
server_clausesets[] = {
static cfg_clausedef_t
channel_clauses[] = {
static cfg_clausedef_t *
channel_clausesets[] = {
static cfg_clausedef_t
logging_clauses[] = {
static cfg_clausedef_t *
logging_clausesets[] = {
static cfg_clausedef_t
addzoneconf_clauses[] = {
static cfg_clausedef_t *
addzoneconf_clausesets[] = {
static isc_result_t
char *endp;
unsigned int len;
if (*endp == 0) {
return (ISC_R_SUCCESS);
return (ISC_R_FAILURE);
return (ISC_R_FAILURE);
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
static isc_result_t
goto cleanup;
return (ISC_R_SUCCESS);
return (result);
static isc_result_t
static isc_result_t
if (optional) {
goto cleanup;
return (result);
static isc_result_t
return (result);
static isc_result_t
static isc_result_t
static const char *dialup_enums[] = {
static isc_result_t
static isc_result_t
static isc_result_t
static isc_result_t
#ifdef HAVE_GEOIP
static const char *geoiptype_enums[] = {
static const char *geoipdb_enums[] = {
static isc_result_t
return (ISC_R_SUCCESS);
return (result);
static cfg_clausedef_t
controls_clauses[] = {
static cfg_clausedef_t *
controls_clausesets[] = {
static cfg_clausedef_t
statservers_clauses[] = {
static cfg_clausedef_t *
statservers_clausesets[] = {
static isc_result_t
return (result);
static isc_result_t
unsigned int have_address = 0;
unsigned int have_port = 0;
unsigned int have_dscp = 0;
INSIST(0);
&netaddr));
have_address++;
&port));
have_port++;
have_dscp++;
have_address == 0)
return (ISC_R_UNEXPECTEDTOKEN);
return (ISC_R_UNEXPECTEDTOKEN);
return (ISC_R_UNEXPECTEDTOKEN);
return (ISC_R_SUCCESS);
return (result);
static isc_result_t
#ifdef HAVE_GEOIP
return (ISC_R_UNEXPECTEDTOKEN);
goto bad;
bad:
return (ISC_R_UNEXPECTEDTOKEN);
return (result);
static unsigned int controls_sockaddr_flags =
static isc_result_t
if (braces) {
return (result);
static isc_result_t
return (result);
static isc_result_t
return (result);
static isc_result_t
static isc_result_t
return (ISC_R_SUCCESS);
return (result);
static cfg_clausedef_t
lwres_clauses[] = {
static cfg_clausedef_t *
lwres_clausesets[] = {
static cfg_clausedef_t
rndcconf_options_clauses[] = {
static cfg_clausedef_t *
static cfg_clausedef_t
rndcconf_server_clauses[] = {
static cfg_clausedef_t *
static cfg_clausedef_t
rndcconf_clauses[] = {
static cfg_clausedef_t *
rndcconf_clausesets[] = {
static cfg_clausedef_t
rndckey_clauses[] = {
static cfg_clausedef_t *
rndckey_clausesets[] = {
static isc_result_t
&obj));
return (ISC_R_UNEXPECTEDTOKEN);
return (result);
static isc_result_t
return (ISC_R_UNEXPECTEDTOKEN);
return (result);
static isc_result_t
goto cleanup;
return (result);
goto cleanup;
return (ISC_R_SUCCESS);
return (result);
static isc_result_t