From: Mark Andrews Date: Wed, 9 Sep 2015 07:02:11 +0000 (+1000) Subject: 4196. [doc] Improve how "enum + other" types are documented. X-Git-Tag: v9.11.0a1~502^2~10 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=4ca7391e640bd4f0abb31508019d3bd62819fa8e;p=thirdparty%2Fbind9.git 4196. [doc] Improve how "enum + other" types are documented. [RT #40608] 4195. [bug] 'max-zone-ttl unlimited;' was broken. [RT #40608] --- diff --git a/CHANGES b/CHANGES index 5769b16166c..954f9ae55dc 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +4196. [doc] Improve how "enum + other" types are documented. + [RT #40608] + +4195. [bug] 'max-zone-ttl unlimited;' was broken. [RT #40608] + 4194. [bug] named-checkconf -p failed to properly print a port range. [RT #40634] diff --git a/bin/named/zoneconf.c b/bin/named/zoneconf.c index 7592e6d440d..e46c52e1c7f 100644 --- a/bin/named/zoneconf.c +++ b/bin/named/zoneconf.c @@ -991,7 +991,10 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, "with 'masterfile-format map'", zname); return (ISC_R_FAILURE); } else if (result == ISC_R_SUCCESS) { - dns_ttl_t maxttl = cfg_obj_asuint32(obj); + dns_ttl_t maxttl = 0; /* unlimited */ + + if (cfg_obj_isuint32(obj)) + maxttl = cfg_obj_asuint32(obj); dns_zone_setmaxttl(zone, maxttl); if (raw != NULL) dns_zone_setmaxttl(raw, maxttl); diff --git a/bin/tests/system/resolver/ns1/named.conf b/bin/tests/system/resolver/ns1/named.conf index 96f4aa1923d..4fe510c064f 100644 --- a/bin/tests/system/resolver/ns1/named.conf +++ b/bin/tests/system/resolver/ns1/named.conf @@ -35,6 +35,7 @@ options { except-from { "goodcname.example.net"; "gooddname.example.net"; }; allow-query {!10.53.0.8; any; }; + max-zone-ttl unlimited; }; server 10.42.23.3/32 { diff --git a/doc/arm/Bv9ARM-book.xml b/doc/arm/Bv9ARM-book.xml index eb56c97152f..dd5c65640a8 100644 --- a/doc/arm/Bv9ARM-book.xml +++ b/doc/arm/Bv9ARM-book.xml @@ -4932,7 +4932,7 @@ badresp:1,adberr:0,findfail:0,valfail:0] lame-ttl number; max-ncache-ttl number; max-cache-ttl number; - max-zone-ttl number ; + max-zone-ttl ( unlimited | number ; servfail-ttl number; sig-validity-interval number number ; sig-signing-nodes number ; @@ -5913,6 +5913,11 @@ options { load directly into memory, this option cannot be used with them.) + + The default value is unlimited. + A of zero is treated as + unlimited. + diff --git a/doc/misc/options b/doc/misc/options index 26e409e975a..b661ecf023f 100644 --- a/doc/misc/options +++ b/doc/misc/options @@ -101,14 +101,14 @@ options { clients-per-query ; cookie-algorithm ( aes | sha1 | sha256 ); cookie-secret ; - coresize ; - datasize ; + coresize ( unlimited | default | ); + datasize ( unlimited | default | ); deallocate-on-exit ; // obsolete deny-answer-addresses { ; ... } [ except-from { ; ... } ]; deny-answer-aliases { ; ... } [ except-from { ; ... } ]; - dialup ; + dialup ( notify | notify-passive | refresh | passive | ); directory ; disable-algorithms { ; ... }; disable-ds-digests { ; ... }; @@ -147,10 +147,10 @@ options { fetch-quota-params ; fetches-per-server [ ( drop | fail ) ]; fetches-per-zone [ ( drop | fail ) ]; - files ; + files ( unlimited | default | ); filter-aaaa { ; ... }; // not configured - filter-aaaa-on-v4 ; // not configured - filter-aaaa-on-v6 ; // not configured + filter-aaaa-on-v4 ( break-dnssec | ); // not configured + filter-aaaa-on-v6 ( break-dnssec | ); // not configured flush-zones-on-shutdown ; forward ( first | only ); forwarders [ port ] [ dscp ] { ( @@ -164,7 +164,7 @@ options { hostname ( | none ); inline-signing ; interface-interval ; - ixfr-from-differences ; + ixfr-from-differences ( master | slave | ); keep-response-order { ; ... }; key-directory ; lame-ttl ; @@ -182,7 +182,7 @@ options { max-cache-size ; max-cache-ttl ; max-clients-per-query ; - max-ixfr-log-size ; // obsolete + max-ixfr-log-size ( unlimited | default | ); // obsolete max-journal-size ; max-ncache-ttl ; max-recursion-depth ; @@ -195,7 +195,7 @@ options { max-transfer-time-in ; max-transfer-time-out ; max-udp-size ; - max-zone-ttl ; + max-zone-ttl ( unlimited | ); memstatistics ; memstatistics-file ; min-refresh-time ; @@ -208,7 +208,7 @@ options { no-case-compress { ; ... }; nocookie-udp-size ; nosit-udp-size ; // obsolete - notify ; + notify ( explicit | master-only | ); notify-delay ; notify-rate ; notify-source ( | * ) [ port ( | * ) ] [ @@ -285,7 +285,7 @@ options { sig-validity-interval [ ]; sit-secret ; // obsolete sortlist { ; ... }; - stacksize ; + stacksize ( unlimited | default | ); startup-notify-rate ; statistics-file ; statistics-interval ; // not yet implemented @@ -317,7 +317,7 @@ options { version ( | none ); zero-no-soa-ttl ; zero-no-soa-ttl-cache ; - zone-statistics ; + zone-statistics ( full | terse | none | ); }; server { @@ -399,7 +399,7 @@ view { except-from { ; ... } ]; deny-answer-aliases { ; ... } [ except-from { ; ... } ]; - dialup ; + dialup ( notify | notify-passive | refresh | passive | ); disable-algorithms { ; ... }; disable-ds-digests { ; ... }; disable-empty-zone ; @@ -439,13 +439,13 @@ view { fetches-per-server [ ( drop | fail ) ]; fetches-per-zone [ ( drop | fail ) ]; filter-aaaa { ; ... }; // not configured - filter-aaaa-on-v4 ; // not configured - filter-aaaa-on-v6 ; // not configured + filter-aaaa-on-v4 ( break-dnssec | ); // not configured + filter-aaaa-on-v6 ( break-dnssec | ); // not configured forward ( first | only ); forwarders [ port ] [ dscp ] { ( | ) [ port ] [ dscp ]; ... }; inline-signing ; - ixfr-from-differences ; + ixfr-from-differences ( master | slave | ); key { algorithm ; secret ; @@ -464,7 +464,7 @@ view { max-cache-size ; max-cache-ttl ; max-clients-per-query ; - max-ixfr-log-size ; // obsolete + max-ixfr-log-size ( unlimited | default | ); // obsolete max-journal-size ; max-ncache-ttl ; max-recursion-depth ; @@ -476,7 +476,7 @@ view { max-transfer-time-in ; max-transfer-time-out ; max-udp-size ; - max-zone-ttl ; + max-zone-ttl ( unlimited | ); min-refresh-time ; min-retry-time ; min-roots ; // not implemented @@ -485,7 +485,7 @@ view { no-case-compress { ; ... }; nocookie-udp-size ; nosit-udp-size ; // obsolete - notify ; + notify ( explicit | master-only | ); notify-delay ; notify-source ( | * ) [ port ( | * ) ] [ dscp ]; @@ -616,7 +616,8 @@ view { check-wildcard ; database ; delegation-only ; - dialup ; + dialup ( notify | notify-passive | refresh | passive | + ); dlz ; dnssec-dnskey-kskonly ; dnssec-loadkeys-interval ; @@ -640,7 +641,8 @@ view { masters [ port ] [ dscp ] { ( | [ port ] | [ port ] ) [ key ]; ... }; - max-ixfr-log-size ; // obsolete + max-ixfr-log-size ( unlimited | default | + ); // obsolete max-journal-size ; max-refresh-time ; max-retry-time ; @@ -648,11 +650,11 @@ view { max-transfer-idle-out ; max-transfer-time-in ; max-transfer-time-out ; - max-zone-ttl ; + max-zone-ttl ( unlimited | ); min-refresh-time ; min-retry-time ; multi-master ; - notify ; + notify ( explicit | master-only | ); notify-delay ; notify-source ( | * ) [ port ( | * ) ] [ dscp ]; @@ -687,9 +689,9 @@ view { ] ; ... }; use-alt-transfer-source ; zero-no-soa-ttl ; - zone-statistics ; + zone-statistics ( full | terse | none | ); }; - zone-statistics ; + zone-statistics ( full | terse | none | ); }; zone { @@ -718,7 +720,7 @@ zone { check-wildcard ; database ; delegation-only ; - dialup ; + dialup ( notify | notify-passive | refresh | passive | ); dlz ; dnssec-dnskey-kskonly ; dnssec-loadkeys-interval ; @@ -741,7 +743,7 @@ zone { masters [ port ] [ dscp ] { ( | [ port ] | [ port ] ) [ key ]; ... }; - max-ixfr-log-size ; // obsolete + max-ixfr-log-size ( unlimited | default | ); // obsolete max-journal-size ; max-refresh-time ; max-retry-time ; @@ -749,11 +751,11 @@ zone { max-transfer-idle-out ; max-transfer-time-in ; max-transfer-time-out ; - max-zone-ttl ; + max-zone-ttl ( unlimited | ); min-refresh-time ; min-retry-time ; multi-master ; - notify ; + notify ( explicit | master-only | ); notify-delay ; notify-source ( | * ) [ port ( | * ) ] [ dscp ]; @@ -786,6 +788,6 @@ zone { | zonesub | external ) [ ] ; ... }; use-alt-transfer-source ; zero-no-soa-ttl ; - zone-statistics ; + zone-statistics ( full | terse | none | ); }; diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c index 613961c24f4..329665f7f9c 100644 --- a/lib/isccfg/namedconf.c +++ b/lib/isccfg/namedconf.c @@ -56,7 +56,8 @@ parse_enum_or_other(cfg_parser_t *pctx, const cfg_type_t *enumtype, const cfg_type_t *othertype, cfg_obj_t **ret); static void -doc_enum_or_other(cfg_printer_t *pctx, const cfg_type_t *type); +doc_enum_or_other(cfg_printer_t *pctx, const cfg_type_t *enumtype, + const cfg_type_t *othertype); static isc_result_t parse_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); @@ -586,8 +587,12 @@ static isc_result_t parse_zonestat(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { return (parse_enum_or_other(pctx, type, &cfg_type_boolean, ret)); } +static void +doc_zonestat(cfg_printer_t *pctx, const cfg_type_t *type) { + doc_enum_or_other(pctx, type, &cfg_type_boolean); +} static cfg_type_t cfg_type_zonestat = { - "zonestat", parse_zonestat, cfg_print_ustring, doc_enum_or_other, + "zonestat", parse_zonestat, cfg_print_ustring, doc_zonestat, &cfg_rep_string, zonestat_enums }; @@ -927,8 +932,7 @@ parse_optional_response(cfg_parser_t *pctx, const cfg_type_t *type, static void doc_optional_response(cfg_printer_t *pctx, const cfg_type_t *type) { - UNUSED(type); - cfg_print_cstr(pctx, "[ ( drop | fail ) ]"); + doc_enum_or_other(pctx, type, &cfg_type_void); } static cfg_type_t cfg_type_responsetype = { @@ -2073,9 +2077,14 @@ parse_size(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { return (parse_enum_or_other(pctx, type, &cfg_type_sizeval, ret)); } +static void +doc_size(cfg_printer_t *pctx, const cfg_type_t *type) { + doc_enum_or_other(pctx, type, &cfg_type_sizeval); +} + static const char *size_enums[] = { "unlimited", "default", NULL }; static cfg_type_t cfg_type_size = { - "size", parse_size, cfg_print_ustring, cfg_doc_terminal, + "size", parse_size, cfg_print_ustring, doc_size, &cfg_rep_string, size_enums }; @@ -2137,12 +2146,34 @@ parse_enum_or_other(cfg_parser_t *pctx, const cfg_type_t *enumtype, } static void -doc_enum_or_other(cfg_printer_t *pctx, const cfg_type_t *type) { - cfg_doc_terminal(pctx, type); -#if 0 /* XXX */ - cfg_print_chars(pctx, "( ", 2);... -#endif +doc_enum_or_other(cfg_printer_t *pctx, const cfg_type_t *enumtype, + const cfg_type_t *othertype) +{ + const char * const *p; + isc_boolean_t first = ISC_TRUE; + /* + * If othertype is cfg_type_void, it means that enumtype is + * optional. + */ + + if (othertype == &cfg_type_void) + cfg_print_cstr(pctx, "[ "); + cfg_print_cstr(pctx, "( "); + for (p = enumtype->of; *p != NULL; p++) { + if (!first) + cfg_print_cstr(pctx, " | "); + first = ISC_FALSE; + cfg_print_cstr(pctx, *p); + } + if (othertype != &cfg_type_void) { + if (!first) + cfg_print_cstr(pctx, " | "); + cfg_doc_terminal(pctx, othertype); + } + cfg_print_cstr(pctx, " )"); + if (othertype == &cfg_type_void) + cfg_print_cstr(pctx, " ]"); } static isc_result_t @@ -2189,8 +2220,12 @@ static isc_result_t parse_dialup_type(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { return (parse_enum_or_other(pctx, type, &cfg_type_boolean, ret)); } +static void +doc_dialup_type(cfg_printer_t *pctx, const cfg_type_t *type) { + doc_enum_or_other(pctx, type, &cfg_type_boolean); +} static cfg_type_t cfg_type_dialuptype = { - "dialuptype", parse_dialup_type, cfg_print_ustring, doc_enum_or_other, + "dialuptype", parse_dialup_type, cfg_print_ustring, doc_dialup_type, &cfg_rep_string, dialup_enums }; @@ -2199,18 +2234,28 @@ static isc_result_t parse_notify_type(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { return (parse_enum_or_other(pctx, type, &cfg_type_boolean, ret)); } +static void +doc_notify_type(cfg_printer_t *pctx, const cfg_type_t *type) { + doc_enum_or_other(pctx, type, &cfg_type_boolean); +} static cfg_type_t cfg_type_notifytype = { - "notifytype", parse_notify_type, cfg_print_ustring, doc_enum_or_other, + "notifytype", parse_notify_type, cfg_print_ustring, doc_notify_type, &cfg_rep_string, notify_enums, }; static const char *ixfrdiff_enums[] = { "master", "slave", NULL }; static isc_result_t -parse_ixfrdiff_type(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { +parse_ixfrdiff_type(cfg_parser_t *pctx, const cfg_type_t *type, + cfg_obj_t **ret) +{ return (parse_enum_or_other(pctx, type, &cfg_type_boolean, ret)); } +static void +doc_ixfrdiff_type(cfg_printer_t *pctx, const cfg_type_t *type) { + doc_enum_or_other(pctx, type, &cfg_type_boolean); +} static cfg_type_t cfg_type_ixfrdifftype = { - "ixfrdiff", parse_ixfrdiff_type, cfg_print_ustring, doc_enum_or_other, + "ixfrdiff", parse_ixfrdiff_type, cfg_print_ustring, doc_ixfrdiff_type, &cfg_rep_string, ixfrdiff_enums, }; @@ -2220,9 +2265,13 @@ parse_filter_aaaa(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { return (parse_enum_or_other(pctx, type, &cfg_type_boolean, ret)); } +static void +doc_filter_aaaa(cfg_printer_t *pctx, const cfg_type_t *type) { + doc_enum_or_other(pctx, type, &cfg_type_boolean); +} static cfg_type_t cfg_type_filter_aaaa = { "filter_aaaa", parse_filter_aaaa, cfg_print_ustring, - doc_enum_or_other, &cfg_rep_string, filter_aaaa_enums, + doc_filter_aaaa, &cfg_rep_string, filter_aaaa_enums, }; static keyword_type_t key_kw = { "key", &cfg_type_astring }; @@ -2845,8 +2894,13 @@ parse_logversions(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { return (parse_enum_or_other(pctx, type, &cfg_type_uint32, ret)); } +static void +doc_logversions(cfg_printer_t *pctx, const cfg_type_t *type) { + doc_enum_or_other(pctx, type, &cfg_type_uint32); +} + static cfg_type_t cfg_type_logversions = { - "logversions", parse_logversions, cfg_print_ustring, cfg_doc_terminal, + "logversions", parse_logversions, cfg_print_ustring, doc_logversions, &cfg_rep_string, logversions_enums }; @@ -3270,11 +3324,16 @@ parse_maxttl(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { return (parse_enum_or_other(pctx, type, &cfg_type_ttlval, ret)); } +static void +doc_maxttl(cfg_printer_t *pctx, const cfg_type_t *type) { + doc_enum_or_other(pctx, type, &cfg_type_ttlval); +} + /*% * A size or "unlimited", but not "default". */ static const char *maxttl_enums[] = { "unlimited", NULL }; static cfg_type_t cfg_type_maxttl = { - "maxttl_no_default", parse_maxttl, cfg_print_ustring, cfg_doc_terminal, + "maxttl_no_default", parse_maxttl, cfg_print_ustring, doc_maxttl, &cfg_rep_string, maxttl_enums };