]> 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 10:26:46 +0000 (12:26 +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
(cherry picked from commit cf722d18b35771e4d7bb52a3b87e80815d9766d0)

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 147eee88c8a0bc7525f82740095479fed9386947..5370ba32a6ea4d20e247d2d606b5ad9cc093cfce 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
                        callback was being called earlier than send_done().
                        [GL #3278]
 
+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]
 
 5874.  [bug]           keymgr didn't work with python 3.11. [GL !6157]
index e42f21c0fd467ca7a3003de9a448ec513ed9129e..4e643625e2a748c83b92ff3805ed088853b2585e 100644 (file)
@@ -329,6 +329,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 3f6cccb7d3ac354c76972e5cacfd8b22587095d2..e6293ef4568432e9814c388ff1d255a4cca98914 100644 (file)
@@ -28,6 +28,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 816aeae7a0edf3b619ace24c8220106da414de26..ee790b96ca351a0c8df7ccc8c5bd9f296b1beaae 100644 (file)
@@ -23,7 +23,7 @@
 /*
  * Commandline arguments for named; also referenced in win32/ntservice.c
  */
-#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:"
 
 ISC_PLATFORM_NORETURN_PRE void
 named_main_earlyfatal(const char *format, ...)
index 534ba41f95a3001e3e50c1b9d6200c3a09025e2c..2a39d95e81fef5937ee983ee610dc148c2311de9 100644 (file)
@@ -352,7 +352,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
@@ -774,6 +774,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 39c445f5f95f298bc2096cc53f7598eed706d04d..a08e93aa357bf56bae51794ab0755156959e2f8f 100644 (file)
@@ -19,7 +19,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**] [**-S** #max-socks] [**-t** directory] [**-U** #listeners] [**-u** user] [**-v**] [**-V**] [**-X** lock-file] [**-x** cache-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**] [**-S** #max-socks] [**-t** directory] [**-U** #listeners] [**-u** user] [**-v**] [**-V**] [**-X** lock-file] [**-x** cache-file]
 
 Description
 ~~~~~~~~~~~
@@ -50,6 +50,14 @@ Options
    due to to a possible ``directory`` option in the configuration file,
    ``config-file`` should be an absolute pathname.
 
+``-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.
+
 ``-d debug-level``
    This option sets the daemon's debug level to ``debug-level``. Debugging traces from
    ``named`` become more verbose as the debug level increases.
index 04abc1930e9e01270866bdf36f3ae48c33221e17..1430e9ce80cb81031c1b4df62d07f4c685a5c5fa 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\-S\fP #max\-socks] [\fB\-t\fP directory] [\fB\-U\fP #listeners] [\fB\-u\fP user] [\fB\-v\fP] [\fB\-V\fP] [\fB\-X\fP lock\-file] [\fB\-x\fP cache\-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\-S\fP #max\-socks] [\fB\-t\fP directory] [\fB\-U\fP #listeners] [\fB\-u\fP user] [\fB\-v\fP] [\fB\-V\fP] [\fB\-X\fP lock\-file] [\fB\-x\fP cache\-file]
 .SH DESCRIPTION
 .sp
 \fBnamed\fP is a Domain Name System (DNS) server, part of the BIND 9
@@ -59,6 +59,19 @@ This option tells \fBnamed\fP to use \fBconfig\-file\fP as its configuration fil
 can be reloaded after the server has changed its working directory
 due to to a possible \fBdirectory\fP option in the configuration file,
 \fBconfig\-file\fP should be an absolute pathname.
+.UNINDENT
+.sp
+\fB\-C\fP
+.INDENT 0.0
+.INDENT 3.5
+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 \fBnamed\fP
+at runtime.
+.UNINDENT
+.UNINDENT
+.INDENT 0.0
 .TP
 .B \fB\-d debug\-level\fP
 This option sets the daemon\(aqs debug level to \fBdebug\-level\fP\&. Debugging traces from