]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Print built-in hints via named -H
authorPetr Menšík <pemensik@redhat.com>
Thu, 16 Oct 2025 19:42:28 +0000 (21:42 +0200)
committerMartin Basti <mbasti@isc.org>
Tue, 14 Jul 2026 11:44:24 +0000 (13:44 +0200)
Built-ins from libdns were not easily accessible from command line.

bin/named/include/named/main.h
bin/named/main.c
bin/named/named.rst
lib/dns/include/dns/rootns.h
lib/dns/rootns.c

index 7cf35e0a212b9f718ee5dcb51a9a878745c11695..71ef4c14e42cd6d360de3c036f46a450b018707a 100644 (file)
@@ -24,7 +24,7 @@
 /*
  * Commandline arguments for named;
  */
-#define NAMED_MAIN_ARGS "46A:c:Cd:D:E:fFgL:M:m:n:N:p:sS:t:T:U:u:vVx:X:"
+#define NAMED_MAIN_ARGS "46A:c:Cd:D:E:fFgHL:M:m:n:N:p:sS:t:T:U:u:vVx:X:"
 
 ISC_NORETURN void
 named_main_earlyfatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
index 37b77bc2ed27d4d4cd68eb96d893eac21660d180..1bd04a0ccf4f247a452de8328a5b325b758748f5 100644 (file)
@@ -52,6 +52,7 @@
 #include <dns/lib.h>
 #include <dns/name.h>
 #include <dns/resolver.h>
+#include <dns/rootns.h>
 #include <dns/view.h>
 
 #include <dlz/dlz_dlopen_driver.h>
@@ -866,6 +867,9 @@ parse_command_line(int argc, char *argv[]) {
                        named_g_logflags = ISC_LOG_PRINTTIME | ISC_LOG_ISO8601 |
                                           ISC_LOG_TZINFO;
                        break;
+               case 'H':
+                       printf("%s", dns_rootns_gethints());
+                       exit(EXIT_SUCCESS);
                case 'L':
                        named_g_logfile = isc_commandline_argument;
                        break;
index 8b71a388259cc504ededd97f183d5ac97729a86f..f84270dd1242721e8e07a8c2a46e3f112fadd028 100644 (file)
@@ -87,6 +87,10 @@ Options
 
    This option runs the server in the foreground and forces all logging to ``stderr``.
 
+.. option:: -H
+
+   This option prints built-in root servers hints and exits.
+
 .. option:: -L logfile
 
    This option sets the log to the file ``logfile`` by default, instead of the system log.
index 574dfe11bf3475dbd768305548b91ce7001e6a7c..622bc727f11eb0958842d78e6e7f973cae52f779 100644 (file)
@@ -20,3 +20,9 @@
 isc_result_t
 dns_rootns_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
                  const char *filename, dns_db_t **target);
+
+const char *
+dns_rootns_gethints(void);
+/*%
+ * Get built-in root NS hints
+ */
index 88d853fff45e2946b2d8c845b20b47cb148284da..c8ba7f6e0b2edb50e7c3d9e6b1560d19159d943a 100644 (file)
@@ -230,3 +230,8 @@ cleanup:
 
        return result;
 }
+
+const char *
+dns_rootns_gethints(void) {
+       return root_ns;
+}