namedconf.c revision 603658ea65b34c4b57f154b1e2412b4f01866b6b
5569e7de51513952d89f29de08049ed6bb054d6eAutomatic Updater * Copyright (C) 2001, 2002 Internet Software Consortium.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * Permission to use, copy, modify, and distribute this software for any
ec5347e2c775f027573ce5648b910361aa926c01Automatic Updater * purpose with or without fee is hereby granted, provided that the above
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * copyright notice and this permission notice appear in all copies.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
be69d484434e10d920c4d8a8bb735356eb0c2cc8Evan Hunt/* $Id: namedconf.c,v 1.21 2003/04/17 03:26:58 marka Exp $ */
e419f613d8591885df608cb73065921be07dd12eBob Halley#define TOKEN_STRING(pctx) (pctx->token.value.as_textregion.base)
1b1e1fda4638334b484aa38c15f53a131c0b0fdfAndreas Gustafsson/* Check a return value. */
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington/* Clean up a configuration object if non-NULL. */
09f22ac5b09e70bc526015f37168ba33e21ea91fDavid Lawrence do { if ((obj) != NULL) cfg_obj_destroy(pctx, &(obj)); } while (0)
e419f613d8591885df608cb73065921be07dd12eBob Halley * Forward declarations of static functions.
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrewsparse_enum_or_other(cfg_parser_t *pctx, const cfg_type_t *enumtype,
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrewsparse_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret);
2f012d936b5ccdf6520c96a4de23721dc58a2221Automatic Updaterparse_optional_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret);
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrewsprint_keyvalue(cfg_printer_t *pctx, cfg_obj_t *obj);
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrewsdoc_keyvalue(cfg_printer_t *pctx, const cfg_type_t *type);
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrewsdoc_optional_keyvalue(cfg_printer_t *pctx, const cfg_type_t *type);
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrewsstatic cfg_type_t cfg_type_bracketed_namesockaddrkeylist;
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrewsstatic cfg_type_t cfg_type_bracketed_sockaddrlist;
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews/* tkey-dhkey */
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsstatic cfg_tuplefielddef_t tkey_dhkey_fields[] = {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "tkey-dhkey", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple,
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews/* listen-on */
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrewsstatic cfg_tuplefielddef_t listenon_fields[] = {
ed019cabc1cc75d4412010c331876e4ae5080a4dDavid Lawrence "listenon", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple, listenon_fields };
23e4260821eefa5019808e18e14e2b366461aad7Brian Wellington "acl", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple, acl_fields };
23e4260821eefa5019808e18e14e2b366461aad7Brian Wellingtonstatic cfg_tuplefielddef_t masters_fields[] = {
ed019cabc1cc75d4412010c331876e4ae5080a4dDavid Lawrence { "addresses", &cfg_type_bracketed_namesockaddrkeylist, 0 },
23e4260821eefa5019808e18e14e2b366461aad7Brian Wellington "masters", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple, masters_fields };
76c8294c81fb48b1da6e1fc5b83322a4cedb8e58Andreas Gustafsson * "sockaddrkeylist", a list of socket addresses with optional keys
1b1e1fda4638334b484aa38c15f53a131c0b0fdfAndreas Gustafsson * and an optional default port, as used in the masters option.
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews * "port 1234 { mymasters; 10.0.0.1 key foo; 1::2 port 69; }"
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrewsstatic cfg_tuplefielddef_t namesockaddrkey_fields[] = {
50105afc551903541608b11851d73278b23579a3Mark Andrews { "masterselement", &cfg_type_masterselement, 0 },
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews "namesockaddrkey", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple,
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrewsstatic cfg_type_t cfg_type_bracketed_namesockaddrkeylist = {
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews "bracketed_namesockaddrkeylist", cfg_parse_bracketed_list,
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews cfg_print_bracketed_list, cfg_doc_bracketed_list, &cfg_rep_list, &cfg_type_namesockaddrkey
5be3685b0e57677c0cc03113099cb8f99f9a070bMark Andrewsstatic cfg_tuplefielddef_t namesockaddrkeylist_fields[] = {
5be3685b0e57677c0cc03113099cb8f99f9a070bMark Andrews { "addresses", &cfg_type_bracketed_namesockaddrkeylist, 0 },
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrewsstatic cfg_type_t cfg_type_namesockaddrkeylist = {
5be3685b0e57677c0cc03113099cb8f99f9a070bMark Andrews "sockaddrkeylist", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple,
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley * A list of socket addresses with an optional default port,
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley * as used in the also-notify option. E.g.,
9cd6710f91bdffef5aed68ab02533e398f6134d7Brian Wellington * "port 1234 { 10.0.0.1; 1::2 port 69; }"
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halleystatic cfg_tuplefielddef_t portiplist_fields[] = {
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley { "addresses", &cfg_type_bracketed_sockaddrlist, 0 },
e44487bfc23599b6b240e09d83d1c862fecfcc82Michael Graff "portiplist", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple,
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley * A public key, as in the "pubkey" statement.
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews "pubkey", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple, pubkey_fields };
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews * A list of RR types, used in grant statements.
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews * Note that the old parser allows quotes around the RR type names.
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews "rrtypelist", cfg_parse_spacelist, cfg_print_spacelist, cfg_doc_terminal,
72dbc7216aae3626a66e6154443be219f5edcaf0Mark Andrewsstatic const char *mode_enums[] = { "grant", "deny", NULL };
72dbc7216aae3626a66e6154443be219f5edcaf0Mark Andrews "mode", cfg_parse_enum, cfg_print_ustring, cfg_doc_enum, &cfg_rep_string,
72dbc7216aae3626a66e6154443be219f5edcaf0Mark Andrewsstatic const char *matchtype_enums[] = {
72dbc7216aae3626a66e6154443be219f5edcaf0Mark Andrews "name", "subdomain", "wildcard", "self", NULL };
72dbc7216aae3626a66e6154443be219f5edcaf0Mark Andrews "matchtype", cfg_parse_enum, cfg_print_ustring, cfg_doc_enum, &cfg_rep_string,
72dbc7216aae3626a66e6154443be219f5edcaf0Mark Andrews * A grant statement, used in the update policy.
72dbc7216aae3626a66e6154443be219f5edcaf0Mark Andrews { "identity", &cfg_type_astring, 0 }, /* domain name */
72dbc7216aae3626a66e6154443be219f5edcaf0Mark Andrews { "name", &cfg_type_astring, 0 }, /* domain name */
72dbc7216aae3626a66e6154443be219f5edcaf0Mark Andrews "grant", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple, grant_fields };
72dbc7216aae3626a66e6154443be219f5edcaf0Mark Andrews "update_policy", cfg_parse_bracketed_list, cfg_print_bracketed_list, cfg_doc_bracketed_list,
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * A view statement.
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "view", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple, view_fields };
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * A zone statement.
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews "zone", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple, zone_fields };
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * A "category" clause in the "logging" statement.
93d6dfaf66258337985427c86181f01fc51f0bb4Mark Andrewsstatic cfg_tuplefielddef_t category_fields[] = {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews { "destinations", &cfg_type_destinationlist,0 },
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews "category", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple, category_fields };
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews * A trusted key, as used in the "trusted-keys" statement.
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrewsstatic cfg_tuplefielddef_t trustedkey_fields[] = {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "trustedkey", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple,
7d211b458fed36326b9e125b9d74089f9dccc140Mark Andrewsstatic keyword_type_t wild_class_kw = { "class", &cfg_type_ustring };
7d211b458fed36326b9e125b9d74089f9dccc140Mark Andrewsstatic cfg_type_t cfg_type_optional_wild_class = {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "optional_wild_class", parse_optional_keyvalue, print_keyvalue,
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews doc_optional_keyvalue, &cfg_rep_string, &wild_class_kw
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsstatic keyword_type_t wild_type_kw = { "type", &cfg_type_ustring };
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsstatic cfg_type_t cfg_type_optional_wild_type = {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews print_keyvalue, doc_optional_keyvalue, &cfg_rep_string, &wild_type_kw
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsstatic keyword_type_t wild_name_kw = { "name", &cfg_type_qstring };
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsstatic cfg_type_t cfg_type_optional_wild_name = {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews print_keyvalue, doc_optional_keyvalue, &cfg_rep_string, &wild_name_kw
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * An rrset ordering element.
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsstatic cfg_tuplefielddef_t rrsetorderingelement_fields[] = {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews { "order", &cfg_type_ustring, 0 }, /* must be literal "order" */
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsstatic cfg_type_t cfg_type_rrsetorderingelement = {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "rrsetorderingelement", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple,
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * A global or view "check-names" option. Note that the zone
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * "check-names" option has a different syntax.
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsstatic cfg_tuplefielddef_t checknames_fields[] = {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "checknames", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple,
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsstatic cfg_type_t cfg_type_bracketed_sockaddrlist = {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "bracketed_sockaddrlist", cfg_parse_bracketed_list, cfg_print_bracketed_list, cfg_doc_bracketed_list,
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "rrsetorder", cfg_parse_bracketed_list, cfg_print_bracketed_list, cfg_doc_bracketed_list,
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrewsstatic keyword_type_t port_kw = { "port", &cfg_type_uint32 };
ff380b05fec3746934c74b78bb44f641d2acb359Francis Dupont "optional_port", parse_optional_keyvalue, print_keyvalue,
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews doc_optional_keyvalue, &cfg_rep_uint32, &port_kw
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington/* A list of keys, as in the "key" clause of the controls statement. */
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington "keylist", cfg_parse_bracketed_list, cfg_print_bracketed_list, cfg_doc_bracketed_list, &cfg_rep_list,
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington "trusted-keys", cfg_parse_bracketed_list, cfg_print_bracketed_list, cfg_doc_bracketed_list, &cfg_rep_list,
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellingtonstatic const char *forwardtype_enums[] = { "first", "only", NULL };
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington "forwardtype", cfg_parse_enum, cfg_print_ustring, cfg_doc_enum, &cfg_rep_string,
7d116211ec7b063891130f191e3ed437b45dba70Mark Andrewsstatic const char *zonetype_enums[] = {
7d116211ec7b063891130f191e3ed437b45dba70Mark Andrews "master", "slave", "stub", "hint", "forward", NULL };
7d116211ec7b063891130f191e3ed437b45dba70Mark Andrews "zonetype", cfg_parse_enum, cfg_print_ustring, cfg_doc_enum, &cfg_rep_string,
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellingtonstatic const char *loglevel_enums[] = {
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington "critical", "error", "warning", "notice", "info", "dynamic", NULL };
9cd6710f91bdffef5aed68ab02533e398f6134d7Brian Wellington "loglevel", cfg_parse_enum, cfg_print_ustring, cfg_doc_enum, &cfg_rep_string,
e2c3f8059e77a8e11c4378d22e5d8e78b423a28fMark Andrewsstatic const char *transferformat_enums[] = {
34aa7909371f13b4bc0ba6d155cfc38bfa1e3c5cAndreas Gustafssonstatic cfg_type_t cfg_type_transferformat = {
5c6117688525d0e8d247f50c63364f66bd8d4185Brian Wellington "transferformat", cfg_parse_enum, cfg_print_ustring, cfg_doc_enum, &cfg_rep_string,
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington * The special keyword "none", as used in the pid-file option.
94766449d6125cd5870891b70d46573e5deaceb4Brian Wellingtonprint_none(cfg_printer_t *pctx, cfg_obj_t *obj) {
18b7133679efa8f60fd4e396c628576f3f416b3eBrian Wellington "none", NULL, print_none, NULL, &cfg_rep_void, NULL
8839b6acbf816fedc15b8e9e1c71fd606a9cd8eaBrian Wellington * A quoted string or the special keyword "none". Used in the pid-file option.
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellingtonparse_qstringornone(cfg_parser_t *pctx, const cfg_type_t *type,
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington CHECK(cfg_gettoken(pctx, CFG_LEXOPT_QSTRING));
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews if (pctx->token.type == isc_tokentype_string &&
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews return (cfg_create_obj(pctx, &cfg_type_none, ret));
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrewsdoc_qstringornone(cfg_printer_t *pctx, const cfg_type_t *type) {
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington cfg_print_chars(pctx, "( <quoted_string> | none )", 26);
48ed268b3378a8b729a0037bc4ae2ed73647a96aBrian Wellingtonstatic cfg_type_t cfg_type_qstringornone = {
48ed268b3378a8b729a0037bc4ae2ed73647a96aBrian Wellington "qstringornone", parse_qstringornone, NULL, doc_qstringornone, NULL, NULL };
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington * keyword hostname
7d116211ec7b063891130f191e3ed437b45dba70Mark Andrewsprint_hostname(cfg_printer_t *pctx, cfg_obj_t *obj) {
9cd6710f91bdffef5aed68ab02533e398f6134d7Brian Wellington "hostname", NULL, print_hostname, NULL, &cfg_rep_boolean, NULL
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews * "server-id" arguement.
e2c3f8059e77a8e11c4378d22e5d8e78b423a28fMark Andrewsparse_serverid(cfg_parser_t *pctx, const cfg_type_t *type,
50105afc551903541608b11851d73278b23579a3Mark Andrews if (pctx->token.type == isc_tokentype_string &&
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews return (cfg_create_obj(pctx, &cfg_type_none, ret));
a05f23d07e1b60a1d88119678111a47014480611Mark Andrews if (pctx->token.type == isc_tokentype_string &&
a05f23d07e1b60a1d88119678111a47014480611Mark Andrews strcasecmp(TOKEN_STRING(pctx), "hostname") == 0) {
48ed268b3378a8b729a0037bc4ae2ed73647a96aBrian Wellington return (cfg_create_obj(pctx, &cfg_type_hostname, ret));
34aa7909371f13b4bc0ba6d155cfc38bfa1e3c5cAndreas Gustafssondoc_serverid(cfg_printer_t *pctx, const cfg_type_t *type) {
18b7133679efa8f60fd4e396c628576f3f416b3eBrian Wellington cfg_print_chars(pctx, "( <quoted_string> | none | hostname )", 26);
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews "serverid", parse_serverid, NULL, doc_serverid, NULL, NULL };
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrewsparse_port(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews cfg_parser_error(pctx, CFG_LOG_NEAR, "invalid port");
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrewsstatic cfg_type_t cfg_type_bracketed_portlist = {
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews "bracketed_sockaddrlist", cfg_parse_bracketed_list, cfg_print_bracketed_list, cfg_doc_bracketed_list,
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews * Clauses that can be found within the top level of the named.conf
7d116211ec7b063891130f191e3ed437b45dba70Mark Andrews { "controls", &cfg_type_controls, CFG_CLAUSEFLAG_MULTI },
7d116211ec7b063891130f191e3ed437b45dba70Mark Andrews { "acl", &cfg_type_acl, CFG_CLAUSEFLAG_MULTI },
7d116211ec7b063891130f191e3ed437b45dba70Mark Andrews { "masters", &cfg_type_masters, CFG_CLAUSEFLAG_MULTI },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "view", &cfg_type_view, CFG_CLAUSEFLAG_MULTI },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "lwres", &cfg_type_lwres, CFG_CLAUSEFLAG_MULTI },
e2c3f8059e77a8e11c4378d22e5d8e78b423a28fMark Andrews * Clauses that can occur at the top level or in the view
e2c3f8059e77a8e11c4378d22e5d8e78b423a28fMark Andrews * statement, but not in the options block.
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "key", &cfg_type_key, CFG_CLAUSEFLAG_MULTI },
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews { "zone", &cfg_type_zone, CFG_CLAUSEFLAG_MULTI },
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews { "server", &cfg_type_server, CFG_CLAUSEFLAG_MULTI },
8d414d155953f89a4eff40f16878438a8c9228f3Mark Andrews { "trusted-keys", &cfg_type_trustedkeys, CFG_CLAUSEFLAG_MULTI },
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews * Clauses that can be found within the 'options' statement.
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews { "avoid-v4-udp-ports", &cfg_type_bracketed_portlist, 0 },
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews { "avoid-v6-udp-ports", &cfg_type_bracketed_portlist, 0 },
664e11f0b14c78cef7cf6b8c70323a1da494e351Mark Andrews { "deallocate-on-exit", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE },
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews { "directory", &cfg_type_qstring, CFG_CLAUSEFLAG_CALLBACK },
ff30cdeb783ca7ffe69b222c56197828e882c229Mark Andrews { "fake-iquery", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "has-old-clients", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "host-statistics", &cfg_type_boolean, CFG_CLAUSEFLAG_NOTIMP },
2f012d936b5ccdf6520c96a4de23721dc58a2221Automatic Updater { "interface-interval", &cfg_type_uint32, 0 },
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews { "listen-on", &cfg_type_listenon, CFG_CLAUSEFLAG_MULTI },
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews { "listen-on-v6", &cfg_type_listenon, CFG_CLAUSEFLAG_MULTI },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "match-mapped-addresses", &cfg_type_boolean, 0 },
664e11f0b14c78cef7cf6b8c70323a1da494e351Mark Andrews { "memstatistics-file", &cfg_type_qstring, 0 },
664e11f0b14c78cef7cf6b8c70323a1da494e351Mark Andrews { "multiple-cnames", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "named-xfer", &cfg_type_qstring, CFG_CLAUSEFLAG_OBSOLETE },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "serial-queries", &cfg_type_uint32, CFG_CLAUSEFLAG_OBSOLETE },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "statistics-interval", &cfg_type_uint32, CFG_CLAUSEFLAG_NYI },
48ed268b3378a8b729a0037bc4ae2ed73647a96aBrian Wellington { "tcp-listen-queue", &cfg_type_uint32, 0 },
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews { "tkey-gssapi-credential", &cfg_type_qstring, 0 },
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington { "treat-cr-as-space", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE },
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington { "use-id-pool", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE },
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington * Clauses that can be found within the 'view' statement,
e44487bfc23599b6b240e09d83d1c862fecfcc82Michael Graff * with defaults in the 'options' statement.
6f071989da905bb5ab2c6dfd01a71ee5ecea5918Brian Wellington { "allow-recursion", &cfg_type_bracketed_aml, 0 },
6f071989da905bb5ab2c6dfd01a71ee5ecea5918Brian Wellington { "allow-v6-synthesis", &cfg_type_bracketed_aml,
6f071989da905bb5ab2c6dfd01a71ee5ecea5918Brian Wellington { "sortlist", &cfg_type_bracketed_aml, 0 },
8839b6acbf816fedc15b8e9e1c71fd606a9cd8eaBrian Wellington { "topology", &cfg_type_bracketed_aml, CFG_CLAUSEFLAG_NOTIMP },
9cd6710f91bdffef5aed68ab02533e398f6134d7Brian Wellington { "auth-nxdomain", &cfg_type_boolean, CFG_CLAUSEFLAG_NEWDEFAULT },
34aa7909371f13b4bc0ba6d155cfc38bfa1e3c5cAndreas Gustafsson { "minimal-responses", &cfg_type_boolean, 0 },
34aa7909371f13b4bc0ba6d155cfc38bfa1e3c5cAndreas Gustafsson { "fetch-glue", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE },
76c8294c81fb48b1da6e1fc5b83322a4cedb8e58Andreas Gustafsson { "rfc2308-type1", &cfg_type_boolean, CFG_CLAUSEFLAG_NYI },
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington { "additional-from-auth", &cfg_type_boolean, 0 },
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington { "additional-from-cache", &cfg_type_boolean, 0 },
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington * Note that the query-source option syntax is different
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington * from the other -source options.
3676eeb6ca95c66aae1256f37af8c990d9f25eb4Brian Wellington { "query-source-v6", &cfg_type_querysource6, 0 },
17a3fcecd069130a5f318685493b0db5639a77c9Brian Wellington { "cleaning-interval", &cfg_type_uint32, 0 },
34aa7909371f13b4bc0ba6d155cfc38bfa1e3c5cAndreas Gustafsson { "min-roots", &cfg_type_uint32, CFG_CLAUSEFLAG_NOTIMP },
17a3fcecd069130a5f318685493b0db5639a77c9Brian Wellington { "transfer-format", &cfg_type_transferformat, 0 },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "max-cache-size", &cfg_type_sizenodefault, 0 },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews CFG_CLAUSEFLAG_MULTI | CFG_CLAUSEFLAG_NOTIMP },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "suppress-initial-notify", &cfg_type_boolean, CFG_CLAUSEFLAG_NYI },
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews { "dual-stack-servers", &cfg_type_nameportiplist, 0 },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews * Clauses that can be found within the 'view' statement only.
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "match-clients", &cfg_type_bracketed_aml, 0 },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "match-destinations", &cfg_type_bracketed_aml, 0 },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "match-recursive-only", &cfg_type_boolean, 0 },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews * Clauses that can be found in a 'zone' statement,
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews * with defaults in the 'view' or 'options' statement.
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "allow-transfer", &cfg_type_bracketed_aml, 0 },
17a3fcecd069130a5f318685493b0db5639a77c9Brian Wellington { "allow-update-forwarding", &cfg_type_bracketed_aml, 0 },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "allow-notify", &cfg_type_bracketed_aml, 0 },
e2c3f8059e77a8e11c4378d22e5d8e78b423a28fMark Andrews { "notify-source", &cfg_type_sockaddr4wild, 0 },
e2c3f8059e77a8e11c4378d22e5d8e78b423a28fMark Andrews { "notify-source-v6", &cfg_type_sockaddr6wild, 0 },
664e11f0b14c78cef7cf6b8c70323a1da494e351Mark Andrews { "ixfr-from-differences", &cfg_type_boolean, 0 },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "maintain-ixfr-base", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE },
50105afc551903541608b11851d73278b23579a3Mark Andrews { "max-ixfr-log-size", &cfg_type_size, CFG_CLAUSEFLAG_OBSOLETE },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "max-journal-size", &cfg_type_sizenodefault, 0 },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "max-transfer-time-in", &cfg_type_uint32, 0 },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "max-transfer-time-out", &cfg_type_uint32, 0 },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "max-transfer-idle-in", &cfg_type_uint32, 0 },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "max-transfer-idle-out", &cfg_type_uint32, 0 },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "sig-validity-interval", &cfg_type_uint32, 0 },
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews { "transfer-source", &cfg_type_sockaddr4wild, 0 },
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington { "transfer-source-v6", &cfg_type_sockaddr6wild, 0 },
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington { "alt-transfer-source", &cfg_type_sockaddr4wild, 0 },
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews { "alt-transfer-source-v6", &cfg_type_sockaddr6wild, 0 },
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews { "use-alt-transfer-source", &cfg_type_boolean, 0 },
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews * Clauses that can be found in a 'zone' statement
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington { "allow-update", &cfg_type_bracketed_aml, 0 },
e407562a75eb93073bb72089cced150d7ffe4d4fTatuya JINMEI 神明達哉 { "ixfr-base", &cfg_type_qstring, CFG_CLAUSEFLAG_OBSOLETE },
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews { "ixfr-tmp-file", &cfg_type_qstring, CFG_CLAUSEFLAG_OBSOLETE },
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews { "masters", &cfg_type_namesockaddrkeylist, 0 },
1ea2595e1b33cc63ea73ee1d54b580b717d7d155Mark Andrews CFG_CLAUSEFLAG_MULTI | CFG_CLAUSEFLAG_OBSOLETE },
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington { "update-policy", &cfg_type_updatepolicy, 0 },
4e259c5a2321e994708fb1fe04cd4da30aa3b612Mark Andrews * Note that the format of the check-names option is different between
4e259c5a2321e994708fb1fe04cd4da30aa3b612Mark Andrews * the zone options and the global/view options. Ugh.
93d6dfaf66258337985427c86181f01fc51f0bb4Mark Andrews { "check-names", &cfg_type_ustring, CFG_CLAUSEFLAG_NOTIMP },
c70908209ee26c51a8e7242a56fdb73847249728Brian Wellington/* The top-level named.conf syntax. */
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian WellingtonLIBISCCFG_EXTERNAL_DATA cfg_type_t cfg_type_namedconf = {
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews "namedconf", cfg_parse_mapbody, cfg_print_mapbody, cfg_doc_mapbody,
d1cbf714097e900ed1703529584d3e1a50e8a4a8Brian Wellington/* The "options" statement syntax. */
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews "options", cfg_parse_map, cfg_print_map, cfg_doc_map, &cfg_rep_map, options_clausesets };
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews/* The "view" statement syntax. */
638fe804a524ee0c028863c0301b999c79de7651Mark Andrews "view", cfg_parse_map, cfg_print_map, cfg_doc_map, &cfg_rep_map, view_clausesets };
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews/* The "zone" statement syntax. */
1ea2595e1b33cc63ea73ee1d54b580b717d7d155Mark Andrews "zoneopts", cfg_parse_map, cfg_print_map, cfg_doc_map, &cfg_rep_map, zone_clausesets };
1ea2595e1b33cc63ea73ee1d54b580b717d7d155Mark Andrews * Clauses that can be found within the 'key' statement.
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews "key", cfg_parse_named_map, cfg_print_map, cfg_doc_map, &cfg_rep_map, key_clausesets };
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews * Clauses that can be found in a 'server' statement.
34aa7909371f13b4bc0ba6d155cfc38bfa1e3c5cAndreas Gustafsson { "support-ixfr", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE },
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews { "transfer-format", &cfg_type_transferformat, 0 },
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington "server", cfg_parse_addressed_map, cfg_print_map, cfg_doc_map, &cfg_rep_map,
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews * Clauses that can be found in a 'channel' clause in the
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews * 'logging' statement.
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews * These have some additional constraints that need to be
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews * checked after parsing:
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews * - There must exactly one of file/syslog/null/stderr
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews /* Destinations. We no longer require these to be first. */
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews /* Options. We now accept these for the null channel, too. */
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews "channel", cfg_parse_named_map, cfg_print_map, cfg_doc_map,
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews/* A list of log destination, used in the "category" clause. */
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "destinationlist", cfg_parse_bracketed_list, cfg_print_bracketed_list, cfg_doc_bracketed_list,
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * Clauses that can be found in a 'logging' statement.
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews { "channel", &cfg_type_channel, CFG_CLAUSEFLAG_MULTI },
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews { "category", &cfg_type_category, CFG_CLAUSEFLAG_MULTI },
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "logging", cfg_parse_map, cfg_print_map, cfg_doc_map, &cfg_rep_map, logging_clausesets };
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsparse_unitstring(char *str, isc_resourcevalue_t *valuep) {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews unsigned int len;
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews if (*endp == 0) {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsparse_sizeval(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews if (pctx->token.type != isc_tokentype_string) {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews CHECK(parse_unitstring(TOKEN_STRING(pctx), &val));
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews CHECK(cfg_create_obj(pctx, &cfg_type_uint64, &obj));
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews cfg_parser_error(pctx, CFG_LOG_NEAR, "expected integer and optional unit");
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * A size value (number + optional unit).
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "sizeval", parse_sizeval, cfg_print_uint64, cfg_doc_terminal,
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * A size, "unlimited", or "default".
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsparse_size(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews return (parse_enum_or_other(pctx, type, &cfg_type_sizeval, ret));
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsstatic const char *size_enums[] = { "unlimited", "default", NULL };
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "size", parse_size, cfg_print_ustring, cfg_doc_terminal,
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * A size or "unlimited", but not "default".
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsstatic const char *sizenodefault_enums[] = { "unlimited", NULL };
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "size_no_default", parse_size, cfg_print_ustring, cfg_doc_terminal,
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * optional_keyvalue
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsparse_maybe_optional_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type,
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews if (pctx->token.type == isc_tokentype_string &&
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews strcasecmp(TOKEN_STRING(pctx), kw->name) == 0) {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews cfg_parser_error(pctx, CFG_LOG_NEAR, "expected '%s'",
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsparse_enum_or_other(cfg_parser_t *pctx, const cfg_type_t *enumtype,
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews if (pctx->token.type == isc_tokentype_string &&
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews cfg_is_enum(TOKEN_STRING(pctx), enumtype->of)) {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsdoc_enum_or_other(cfg_printer_t *pctx, const cfg_type_t *type) {
ff380b05fec3746934c74b78bb44f641d2acb359Francis Dupont#if 0 /* XXX */
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsparse_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews return (parse_maybe_optional_keyvalue(pctx, type, ISC_FALSE, ret));
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsparse_optional_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews return (parse_maybe_optional_keyvalue(pctx, type, ISC_TRUE, ret));
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsprint_keyvalue(cfg_printer_t *pctx, cfg_obj_t *obj) {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsdoc_keyvalue(cfg_printer_t *pctx, const cfg_type_t *type) {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsdoc_optional_keyvalue(cfg_printer_t *pctx, const cfg_type_t *type) {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsstatic const char *dialup_enums[] = {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "notify", "notify-passive", "refresh", "passive", NULL };
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsparse_dialup_type(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews return (parse_enum_or_other(pctx, type, &cfg_type_boolean, ret));
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "dialuptype", parse_dialup_type, cfg_print_ustring, doc_enum_or_other,
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsstatic const char *notify_enums[] = { "explicit", NULL };
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsparse_notify_type(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews return (parse_enum_or_other(pctx, type, &cfg_type_boolean, ret));
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "notifytype", parse_notify_type, cfg_print_ustring, doc_enum_or_other,
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsstatic keyword_type_t key_kw = { "key", &cfg_type_astring };
6098d364b690cb9dabf96e9664c4689c8559bd2eMark AndrewsLIBISCCFG_EXTERNAL_DATA cfg_type_t cfg_type_keyref = {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "keyref", parse_keyvalue, print_keyvalue, doc_keyvalue,
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "optional_keyref", parse_optional_keyvalue, print_keyvalue,
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews doc_optional_keyvalue, &cfg_rep_string, &key_kw
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * A "controls" statement is represented as a map with the multivalued
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * "inet" and "unix" clauses. Inet controls are tuples; unix controls
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * are cfg_unsupported_t objects.
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsstatic cfg_tuplefielddef_t inetcontrol_fields[] = {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "inetcontrol", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple,
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews { "inet", &cfg_type_inetcontrol, CFG_CLAUSEFLAG_MULTI },
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "controls", cfg_parse_map, cfg_print_map, cfg_doc_map, &cfg_rep_map, &controls_clausesets
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * An optional class, as used in view and zone statements.
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsparse_optional_class(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews CHECK(cfg_parse_obj(pctx, &cfg_type_ustring, ret));
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews CHECK(cfg_parse_obj(pctx, &cfg_type_void, ret));
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews "optional_class", parse_optional_class, NULL, cfg_doc_terminal,
94766449d6125cd5870891b70d46573e5deaceb4Brian Wellingtonparse_querysource(cfg_parser_t *pctx, int flags, cfg_obj_t **ret) {
94766449d6125cd5870891b70d46573e5deaceb4Brian Wellington unsigned int have_address = 0;
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews unsigned int have_port = 0;
6f071989da905bb5ab2c6dfd01a71ee5ecea5918Brian Wellington CHECK(cfg_create_obj(pctx, &cfg_type_querysource, &obj));
34aa7909371f13b4bc0ba6d155cfc38bfa1e3c5cAndreas Gustafsson if (pctx->token.type == isc_tokentype_string) {
e2c3f8059e77a8e11c4378d22e5d8e78b423a28fMark Andrews "address") == 0)
e2c3f8059e77a8e11c4378d22e5d8e78b423a28fMark Andrews /* read "address" */
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews } else if (strcasecmp(TOKEN_STRING(pctx), "port") == 0)
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews /* read "port" */
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews "expected 'address' or 'port'");
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews cfg_parser_error(pctx, 0, "expected one address and/or port");
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews isc_sockaddr_fromnetaddr(&obj->value.sockaddr, &netaddr, port);
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews cfg_parser_error(pctx, CFG_LOG_NEAR, "invalid query source");
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrewsparse_querysource4(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews return (parse_querysource(pctx, CFG_ADDR_V4OK, ret));
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrewsparse_querysource6(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews return (parse_querysource(pctx, CFG_ADDR_V6OK, ret));
94766449d6125cd5870891b70d46573e5deaceb4Brian Wellingtonprint_querysource(cfg_printer_t *pctx, cfg_obj_t *obj) {
94766449d6125cd5870891b70d46573e5deaceb4Brian Wellington isc_netaddr_fromsockaddr(&na, &obj->value.sockaddr);
94766449d6125cd5870891b70d46573e5deaceb4Brian Wellington cfg_print_rawuint(pctx, isc_sockaddr_getport(&obj->value.sockaddr));
5c6117688525d0e8d247f50c63364f66bd8d4185Brian Wellington "querysource4", parse_querysource4, NULL, cfg_doc_terminal,
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews "querysource6", parse_querysource6, NULL, cfg_doc_terminal,
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews "querysource", NULL, print_querysource, NULL, &cfg_rep_sockaddr, NULL };
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews/* addrmatchelt */
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrewsparse_addrmatchelt(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews CHECK(cfg_peektoken(pctx, CFG_LEXOPT_QSTRING));
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews if (pctx->token.type == isc_tokentype_string ||
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews if (pctx->token.type == isc_tokentype_string &&
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews (strcasecmp(TOKEN_STRING(pctx), "key") == 0)) {
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews CHECK(cfg_parse_obj(pctx, &cfg_type_keyref, ret));
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews if (cfg_lookingat_netaddr(pctx, CFG_ADDR_V4OK |
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington CHECK(cfg_parse_netprefix(pctx, NULL, ret));
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews } else if (pctx->token.type == isc_tokentype_special) {
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews /* Nested match list. */
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews CHECK(cfg_parse_obj(pctx, &cfg_type_bracketed_aml, ret));
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews CHECK(cfg_parse_obj(pctx, &cfg_type_negated, ret));
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews "expected IP match list element");
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews * A negated address match list element (like "! 10.0.0.1").
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews * Somewhat sneakily, the caller is expected to parse the
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews * "!", but not to print it.
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrewsprint_negated(cfg_printer_t *pctx, cfg_obj_t *obj) {
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews "negated", cfg_parse_tuple, print_negated, NULL, &cfg_rep_tuple,
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews/* An address match list element */
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews "address_match_element", parse_addrmatchelt, NULL, cfg_doc_terminal,
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews/* A bracketed address match list */
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews "bracketed_aml", cfg_parse_bracketed_list, cfg_print_bracketed_list,
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews cfg_doc_bracketed_list, &cfg_rep_list, &cfg_type_addrmatchelt
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews * The socket address syntax in the "controls" statement is silly.
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews * It allows both socket address families, but also allows "*",
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews * whis is gratuitously interpreted as the IPv4 wildcard address.
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrewsstatic unsigned int controls_sockaddr_flags =
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews CFG_ADDR_V4OK | CFG_ADDR_V6OK | CFG_ADDR_WILDOK;
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrewsstatic cfg_type_t cfg_type_controls_sockaddr = {
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews "controls_sockaddr", cfg_parse_sockaddr, cfg_print_sockaddr,
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews cfg_doc_sockaddr, &cfg_rep_sockaddr, &controls_sockaddr_flags
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews * Handle the special kludge syntax of the "keys" clause in the "server"
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews * statement, which takes a single key with or without braces and semicolon.
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrewsparse_server_key_kludge(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret)
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews /* Allow opening brace. */
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews if (pctx->token.type == isc_tokentype_special &&
2f012d936b5ccdf6520c96a4de23721dc58a2221Automatic Updater CHECK(cfg_parse_obj(pctx, &cfg_type_astring, ret));
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews /* Skip semicolon if present. */
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews if (pctx->token.type == isc_tokentype_special &&
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrewsstatic cfg_type_t cfg_type_server_key_kludge = {
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews "server_key", parse_server_key_kludge, NULL, cfg_doc_terminal,
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews * An optional logging facility.
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrewsparse_optional_facility(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret)
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews CHECK(cfg_peektoken(pctx, CFG_LEXOPT_QSTRING));
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews if (pctx->token.type == isc_tokentype_string ||
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews CHECK(cfg_parse_obj(pctx, &cfg_type_astring, ret));
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews CHECK(cfg_parse_obj(pctx, &cfg_type_void, ret));
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrewsstatic cfg_type_t cfg_type_optional_facility = {
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews "optional_facility", parse_optional_facility, NULL, cfg_doc_terminal,
613efcd8fbd0d1ce0d0afd1ac85d95cf85bffc27Brian Wellington * A log severity. Return as a string, except "debug N",
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews * which is returned as a keyword object.
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrewsstatic keyword_type_t debug_kw = { "debug", &cfg_type_uint32 };
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrewsparse_logseverity(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews if (pctx->token.type == isc_tokentype_string &&
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews strcasecmp(TOKEN_STRING(pctx), "debug") == 0) {
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews CHECK(cfg_gettoken(pctx, 0)); /* read "debug" */
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews if (pctx->token.type == isc_tokentype_number) {
613efcd8fbd0d1ce0d0afd1ac85d95cf85bffc27Brian Wellington * The debug level is optional and defaults to 1.
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews * This makes little sense, but we support it for
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews * compatibility with BIND 8.
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews CHECK(cfg_create_obj(pctx, &cfg_type_uint32, ret));
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews (*ret)->type = &cfg_type_debuglevel; /* XXX kludge */
48ed268b3378a8b729a0037bc4ae2ed73647a96aBrian Wellington CHECK(cfg_parse_obj(pctx, &cfg_type_loglevel, ret));
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews "log_severity", parse_logseverity, NULL, cfg_doc_terminal,
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews * The "file" clause of the "channel" statement.
5be3685b0e57677c0cc03113099cb8f99f9a070bMark Andrews * This is yet another special case.
48ed268b3378a8b729a0037bc4ae2ed73647a96aBrian Wellingtonstatic const char *logversions_enums[] = { "unlimited", NULL };
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrewsparse_logversions(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
93c786e0924aeca2c258e32355349e6ae60a0f72Andreas Gustafsson return (parse_enum_or_other(pctx, type, &cfg_type_uint32, ret));
93c786e0924aeca2c258e32355349e6ae60a0f72Andreas Gustafssonstatic cfg_type_t cfg_type_logversions = {
93c786e0924aeca2c258e32355349e6ae60a0f72Andreas Gustafsson "logversions", parse_logversions, cfg_print_ustring, cfg_doc_terminal,
d6643ef587324e40d8bda63e9f80be8141e101edBrian Wellingtonparse_logfile(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
d6643ef587324e40d8bda63e9f80be8141e101edBrian Wellington const cfg_tuplefielddef_t *fields = type->of;
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley /* Parse the mandatory "file" field */
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley CHECK(cfg_parse_obj(pctx, fields[0].type, &obj->value.tuple[0]));
feb40fc5f911d0b2050fb9fd34950a52930b981dBrian Wellington /* Parse "versions" and "size" fields in any order. */
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley "versions") == 0 &&
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley "size") == 0 &&
d6643ef587324e40d8bda63e9f80be8141e101edBrian Wellington /* Create void objects for missing optional values. */
c50936eb40263b65ebf6afe4e6556e2dc67c10e4Brian Wellington CHECK(cfg_parse_void(pctx, NULL, &obj->value.tuple[1]));
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley CHECK(cfg_parse_void(pctx, NULL, &obj->value.tuple[2]));
d6643ef587324e40d8bda63e9f80be8141e101edBrian Wellingtonprint_logfile(cfg_printer_t *pctx, cfg_obj_t *obj) {
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley cfg_print_obj(pctx, obj->value.tuple[0]); /* file */
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley if (obj->value.tuple[1]->type->print != cfg_print_void) {
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews if (obj->value.tuple[2]->type->print != cfg_print_void) {
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley "log_file", parse_logfile, print_logfile, cfg_doc_terminal,
23e4260821eefa5019808e18e14e2b366461aad7Brian Wellington/* An IPv4/IPv6 address with optional port, "*" accepted as wildcard. */
3fb1637c9265cc593973326ae193783413f68699Tatuya JINMEI 神明達哉static unsigned int sockaddr4wild_flags = CFG_ADDR_WILDOK | CFG_ADDR_V4OK;
23e4260821eefa5019808e18e14e2b366461aad7Brian Wellington "sockaddr4wild", cfg_parse_sockaddr, cfg_print_sockaddr,
e407562a75eb93073bb72089cced150d7ffe4d4fTatuya JINMEI 神明達哉 cfg_doc_sockaddr, &cfg_rep_sockaddr, &sockaddr4wild_flags
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halleystatic unsigned int sockaddr6wild_flags = CFG_ADDR_WILDOK | CFG_ADDR_V6OK;
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews "v6addrportwild", cfg_parse_sockaddr, cfg_print_sockaddr, cfg_doc_sockaddr,
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrewsstatic cfg_tuplefielddef_t lwres_view_fields[] = {
50df1ec60af410fca6b7a85d5c85e8f31bb13bc3Mark Andrews "lwres_view", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple,
50df1ec60af410fca6b7a85d5c85e8f31bb13bc3Mark Andrews "lwres_searchlist", cfg_parse_bracketed_list, cfg_print_bracketed_list, cfg_doc_bracketed_list,
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley "lwres", cfg_parse_map, cfg_print_map, cfg_doc_map, &cfg_rep_map, lwres_clausesets };
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellingtonstatic cfg_type_t cfg_type_rndcconf_options = {
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley "rndcconf_options", cfg_parse_map, cfg_print_map, cfg_doc_map, &cfg_rep_map,
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellingtonstatic cfg_type_t cfg_type_rndcconf_server = {
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington "rndcconf_server", cfg_parse_named_map, cfg_print_map, cfg_doc_map, &cfg_rep_map,
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley { "server", &cfg_type_rndcconf_server, CFG_CLAUSEFLAG_MULTI },
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian WellingtonLIBISCCFG_EXTERNAL_DATA cfg_type_t cfg_type_rndcconf = {
b5debbe212097d1c573a2ba3bd9a3d526d86b0aeBrian Wellington "rndcconf", cfg_parse_mapbody, cfg_print_mapbody, cfg_doc_mapbody,
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian WellingtonLIBISCCFG_EXTERNAL_DATA cfg_type_t cfg_type_rndckey = {
ca9af3aaf798f98624fc1dc69d8c7d51bf01334dBrian Wellington "rndckey", cfg_parse_mapbody, cfg_print_mapbody, cfg_doc_mapbody,
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews "nameport", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple,
25496cebadd170fd5fae2aabf0469eef551259aaBrian Wellingtondoc_sockaddrnameport(cfg_printer_t *pctx, const cfg_type_t *type) {
25496cebadd170fd5fae2aabf0469eef551259aaBrian Wellingtonparse_sockaddrnameport(cfg_parser_t *pctx, const cfg_type_t *type,
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews CHECK(cfg_peektoken(pctx, CFG_LEXOPT_QSTRING));
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews if (pctx->token.type == isc_tokentype_string ||
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews if (cfg_lookingat_netaddr(pctx, CFG_ADDR_V4OK | CFG_ADDR_V6OK))
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews CHECK(cfg_parse_sockaddr(pctx, &cfg_type_sockaddr, ret));
25496cebadd170fd5fae2aabf0469eef551259aaBrian Wellington CHECK(cfg_create_tuple(pctx, &cfg_type_nameport,
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews "expected IP address or hostname");
60ab03125c137c48a6b2ed6df1d2c8657757e09dMark Andrews "sockaddrnameport_element", parse_sockaddrnameport, NULL,
fabf2ee6b01ee06a0de940b83d53cf57f9f79265Mark Andrewsstatic cfg_type_t cfg_type_bracketed_sockaddrnameportlist = {
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews "bracketed_sockaddrnameportlist", cfg_parse_bracketed_list,
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews cfg_print_bracketed_list, cfg_doc_bracketed_list,
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews * A list of socket addresses or name with an optional default port,
fabf2ee6b01ee06a0de940b83d53cf57f9f79265Mark Andrews * as used in the dual-stack-servers option. E.g.,
fabf2ee6b01ee06a0de940b83d53cf57f9f79265Mark Andrews * "port 1234 { dual-stack-servers.net; 10.0.0.1; 1::2 port 69; }"
fabf2ee6b01ee06a0de940b83d53cf57f9f79265Mark Andrewsstatic cfg_tuplefielddef_t nameportiplist_fields[] = {
fabf2ee6b01ee06a0de940b83d53cf57f9f79265Mark Andrews { "addresses", &cfg_type_bracketed_sockaddrnameportlist, 0 },
fabf2ee6b01ee06a0de940b83d53cf57f9f79265Mark Andrews "nameportiplist", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple,
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews * masters element.
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrewsdoc_masterselement(cfg_printer_t *pctx, const cfg_type_t *type) {
3ce4b8b03ebd017c1d1b320429219ba91e705ea4Andreas Gustafsson cfg_print_cstr(pctx, "[port <integer>]");
c03bb27f0675a6e60ceea66b451548e8481bc05cMark Andrewsparse_masterselement(cfg_parser_t *pctx, const cfg_type_t *type,
93c786e0924aeca2c258e32355349e6ae60a0f72Andreas Gustafsson if (pctx->token.type == isc_tokentype_string ||
78951552dccf0d0004d61072bbc71fa4b1aab30fAndreas Gustafsson if (cfg_lookingat_netaddr(pctx, CFG_ADDR_V4OK | CFG_ADDR_V6OK))
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence CHECK(cfg_parse_sockaddr(pctx, &cfg_type_sockaddr, ret));
34aa7909371f13b4bc0ba6d155cfc38bfa1e3c5cAndreas Gustafsson CHECK(cfg_parse_astring(pctx, &cfg_type_astring, ret));
0ec4b862c9abd11c82c88ed62438f0cf06fed25dBob Halley "expected IP address or masters name");
23e4260821eefa5019808e18e14e2b366461aad7Brian Wellingtonstatic cfg_type_t cfg_type_masterselement = {
23e4260821eefa5019808e18e14e2b366461aad7Brian Wellington "masters_element", parse_masterselement, NULL,