2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-22 18:19:42 +00:00

Export built-in default configuration for named binary

It might be useful to display built-in configuration with all its
values. It should make it easier to test what default values has changed
in a new release.

Related: #1326
This commit is contained in:
Petr Menšík 2022-03-23 12:52:33 +01:00 committed by Petr Špaček
parent 177626c551
commit cf722d18b3
No known key found for this signature in database
GPG Key ID: ABD587CDF06581AE
7 changed files with 37 additions and 4 deletions

View File

@ -1,3 +1,6 @@
5880. [func] Add new named command-line option -C to print built-in
defaults. [GL #1326]
5879. [contrib] dlz: Add FALLTHROUGH and UNREACHABLE macros. [GL #3306] 5879. [contrib] dlz: Add FALLTHROUGH and UNREACHABLE macros. [GL #3306]
5878. [func] Check the algorithm name or OID embedded at the start 5878. [func] Check the algorithm name or OID embedded at the start

View File

@ -334,6 +334,11 @@ named_config_parsedefaults(cfg_parser_t *parser, cfg_obj_t **conf) {
CFG_PCTX_NODEPRECATED, conf)); CFG_PCTX_NODEPRECATED, conf));
} }
const char *
named_config_getdefault() {
return (defaultconf);
}
isc_result_t isc_result_t
named_config_get(cfg_obj_t const *const *maps, const char *name, named_config_get(cfg_obj_t const *const *maps, const char *name,
const cfg_obj_t **obj) { const cfg_obj_t **obj) {

View File

@ -27,6 +27,9 @@
isc_result_t isc_result_t
named_config_parsedefaults(cfg_parser_t *parser, cfg_obj_t **conf); named_config_parsedefaults(cfg_parser_t *parser, cfg_obj_t **conf);
const char *
named_config_getdefault(void);
isc_result_t isc_result_t
named_config_get(cfg_obj_t const *const *maps, const char *name, named_config_get(cfg_obj_t const *const *maps, const char *name,
const cfg_obj_t **obj); const cfg_obj_t **obj);

View File

@ -24,7 +24,7 @@
/* /*
* Commandline arguments for named; * Commandline arguments for named;
*/ */
#define NAMED_MAIN_ARGS "46A:c:d:D:E:fFgL:M:m:n:N:p:sS:t:T:U:u:vVx:X:" #define NAMED_MAIN_ARGS "46A:c:Cd:D:E:fFgL:M:m:n:N:p:sS:t:T:U:u:vVx:X:"
noreturn void noreturn void
named_main_earlyfatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); named_main_earlyfatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);

View File

@ -316,7 +316,7 @@ usage(void) {
" [-X lockfile] [-m " " [-X lockfile] [-m "
"{usage|trace|record|size|mctx}]\n" "{usage|trace|record|size|mctx}]\n"
" [-M fill|nofill]\n" " [-M fill|nofill]\n"
"usage: named [-v|-V]\n"); "usage: named [-v|-V|-C]\n");
} }
static void static void
@ -778,6 +778,11 @@ parse_command_line(int argc, char *argv[]) {
named_g_conffile = isc_commandline_argument; named_g_conffile = isc_commandline_argument;
named_g_conffileset = true; named_g_conffileset = true;
break; break;
case 'C':
printf("# Built-in default values. "
"This is NOT the run-time configuration!\n");
printf("%s", named_config_getdefault());
exit(0);
case 'd': case 'd':
named_g_debuglevel = parse_int(isc_commandline_argument, named_g_debuglevel = parse_int(isc_commandline_argument,
"debug " "debug "

View File

@ -21,7 +21,7 @@ named - Internet domain name server
Synopsis Synopsis
~~~~~~~~ ~~~~~~~~
:program:`named` [ [**-4**] | [**-6**] ] [**-c** config-file] [**-d** debug-level] [**-D** string] [**-E** engine-name] [**-f**] [**-g**] [**-L** logfile] [**-M** option] [**-m** flag] [**-n** #cpus] [**-p** port] [**-s**] [**-t** directory] [**-U** #listeners] [**-u** user] [**-v**] [**-V**] [**-X** lock-file] :program:`named` [ [**-4**] | [**-6**] ] [**-c** config-file] [**-C**] [**-d** debug-level] [**-D** string] [**-E** engine-name] [**-f**] [**-g**] [**-L** logfile] [**-M** option] [**-m** flag] [**-n** #cpus] [**-p** port] [**-s**] [**-t** directory] [**-U** #listeners] [**-u** user] [**-v**] [**-V**] [**-X** lock-file]
Description Description
~~~~~~~~~~~ ~~~~~~~~~~~
@ -55,6 +55,14 @@ Options
due to to a possible ``directory`` option in the configuration file, due to to a possible ``directory`` option in the configuration file,
``config-file`` should be an absolute pathname. ``config-file`` should be an absolute pathname.
.. option:: -C
This option prints out the default built-in configuration and exits.
NOTE: This is for debugging purposes only and is not an
accurate representation of the actual configuration used by :iscman:`named`
at runtime.
.. option:: -d debug-level .. option:: -d debug-level
This option sets the daemon's debug level to ``debug-level``. Debugging traces from This option sets the daemon's debug level to ``debug-level``. Debugging traces from

View File

@ -32,7 +32,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
named \- Internet domain name server named \- Internet domain name server
.SH SYNOPSIS .SH SYNOPSIS
.sp .sp
\fBnamed\fP [ [\fB\-4\fP] | [\fB\-6\fP] ] [\fB\-c\fP config\-file] [\fB\-d\fP debug\-level] [\fB\-D\fP string] [\fB\-E\fP engine\-name] [\fB\-f\fP] [\fB\-g\fP] [\fB\-L\fP logfile] [\fB\-M\fP option] [\fB\-m\fP flag] [\fB\-n\fP #cpus] [\fB\-p\fP port] [\fB\-s\fP] [\fB\-t\fP directory] [\fB\-U\fP #listeners] [\fB\-u\fP user] [\fB\-v\fP] [\fB\-V\fP] [\fB\-X\fP lock\-file] \fBnamed\fP [ [\fB\-4\fP] | [\fB\-6\fP] ] [\fB\-c\fP config\-file] [\fB\-C\fP] [\fB\-d\fP debug\-level] [\fB\-D\fP string] [\fB\-E\fP engine\-name] [\fB\-f\fP] [\fB\-g\fP] [\fB\-L\fP logfile] [\fB\-M\fP option] [\fB\-m\fP flag] [\fB\-n\fP #cpus] [\fB\-p\fP port] [\fB\-s\fP] [\fB\-t\fP directory] [\fB\-U\fP #listeners] [\fB\-u\fP user] [\fB\-v\fP] [\fB\-V\fP] [\fB\-X\fP lock\-file]
.SH DESCRIPTION .SH DESCRIPTION
.sp .sp
\fBnamed\fP is a Domain Name System (DNS) server, part of the BIND 9 \fBnamed\fP is a Domain Name System (DNS) server, part of the BIND 9
@ -66,6 +66,15 @@ due to to a possible \fBdirectory\fP option in the configuration file,
.UNINDENT .UNINDENT
.INDENT 0.0 .INDENT 0.0
.TP .TP
.B \-C
This option prints out the default built\-in configuration and exits.
.sp
NOTE: This is for debugging purposes only and is not an
accurate representation of the actual configuration used by \fI\%named\fP
at runtime.
.UNINDENT
.INDENT 0.0
.TP
.B \-d debug\-level .B \-d debug\-level
This option sets the daemon\(aqs debug level to \fBdebug\-level\fP\&. Debugging traces from This option sets the daemon\(aqs debug level to \fBdebug\-level\fP\&. Debugging traces from
\fBnamed\fP become more verbose as the debug level increases. \fBnamed\fP become more verbose as the debug level increases.