]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Export built-in default configuration for named binary
authorPetr Menšík <pemensik@redhat.com>
Wed, 23 Mar 2022 11:52:33 +0000 (12:52 +0100)
committerPetr Špaček <pspacek@isc.org>
Fri, 29 Apr 2022 07:52:35 +0000 (09:52 +0200)
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

CHANGES
bin/named/config.c
bin/named/include/named/config.h
bin/named/include/named/main.h
bin/named/main.c
bin/named/named.rst
doc/man/named.8in

diff --git a/CHANGES b/CHANGES
index 16c041563ab066870ad9050a0a79b834f219f186..35af6a82ed43e01951f01a43ff8094d1dac60fe6 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -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]
 
 5878.  [func]          Check the algorithm name or OID embedded at the start
index 7bf312261713674f8f3b69abf591f00b009fecdc..8c64c1ff2af2c23f1cbf74b2bf3241085a72cd63 100644 (file)
@@ -334,6 +334,11 @@ named_config_parsedefaults(cfg_parser_t *parser, cfg_obj_t **conf) {
                                 CFG_PCTX_NODEPRECATED, conf));
 }
 
+const char *
+named_config_getdefault() {
+       return (defaultconf);
+}
+
 isc_result_t
 named_config_get(cfg_obj_t const *const *maps, const char *name,
                 const cfg_obj_t **obj) {
index e9aef21f47b6c7f684dc3f8b011733676b4ac413..834c53f6e7fe1605a5de2a80053d3c7623c4f7e7 100644 (file)
@@ -27,6 +27,9 @@
 isc_result_t
 named_config_parsedefaults(cfg_parser_t *parser, cfg_obj_t **conf);
 
+const char *
+named_config_getdefault(void);
+
 isc_result_t
 named_config_get(cfg_obj_t const *const *maps, const char *name,
                 const cfg_obj_t **obj);
index 7d01851b9bd3a8f33593958b3323f5524f891c31..42fd138314dcbdf7c9d25fdac70058f7e6e86ccd 100644 (file)
@@ -24,7 +24,7 @@
 /*
  * 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
 named_main_earlyfatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
index 67c16304d99e0016cfb6015de8c65a9b3f43a89c..33421faeaa4f5f647ff5063e5285e8063ac93403 100644 (file)
@@ -316,7 +316,7 @@ usage(void) {
                        "             [-X lockfile] [-m "
                        "{usage|trace|record|size|mctx}]\n"
                        "             [-M fill|nofill]\n"
-                       "usage: named [-v|-V]\n");
+                       "usage: named [-v|-V|-C]\n");
 }
 
 static void
@@ -778,6 +778,11 @@ parse_command_line(int argc, char *argv[]) {
                        named_g_conffile = isc_commandline_argument;
                        named_g_conffileset = true;
                        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':
                        named_g_debuglevel = parse_int(isc_commandline_argument,
                                                       "debug "
index 21a82c4dbd319544543104a63fc4de20b5a7ae69..d6a239c2822a5cc99bf22892bb3a2493e28cdc3c 100644 (file)
@@ -21,7 +21,7 @@ named - Internet domain name server
 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
 ~~~~~~~~~~~
@@ -55,6 +55,14 @@ Options
    due to to a possible ``directory`` option in the configuration file,
    ``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
 
    This option sets the daemon's debug level to ``debug-level``. Debugging traces from
index 0fd8c74f1d24e06cb2744d4e1c238ec66adaadca..2927a6f38aa804d8a814109a917afbed7ee8a48c 100644 (file)
@@ -32,7 +32,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
 named \- Internet domain name server
 .SH SYNOPSIS
 .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
 .sp
 \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
 .INDENT 0.0
 .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
 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.