See "server-id" for how to configure.
+1417. [func] ID.SERVER/CHAOS is now a built in zone.
+ See "server-id" for how to configure.
+
1416. [bug] Empty node should return NOERROR NODATA, not NXDOMAIN.
[RT #4715]
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: builtin.c,v 1.3 2002/02/20 03:33:06 marka Exp $ */
+/* $Id: builtin.c,v 1.4 2003/01/20 05:46:09 marka Exp $ */
/*
- * The built-in "version", "hostname", and "authors" databases.
+ * The built-in "version", "hostname", "id" and "authors" databases.
*/
#include <config.h>
static isc_result_t do_version_lookup(dns_sdblookup_t *lookup);
static isc_result_t do_hostname_lookup(dns_sdblookup_t *lookup);
static isc_result_t do_authors_lookup(dns_sdblookup_t *lookup);
+static isc_result_t do_id_lookup(dns_sdblookup_t *lookup);
/*
* We can't use function pointers as the db_data directly
static builtin_t version_builtin = { do_version_lookup };
static builtin_t hostname_builtin = { do_hostname_lookup };
static builtin_t authors_builtin = { do_authors_lookup };
+static builtin_t id_builtin = { do_id_lookup };
static dns_sdbimplementation_t *builtin_impl;
return (ISC_R_SUCCESS);
}
+static isc_result_t
+do_id_lookup(dns_sdblookup_t *lookup) {
+
+ if (ns_g_server->server_usehostname) {
+ char buf[256];
+ isc_result_t result = ns_os_gethostname(buf, sizeof(buf));
+ if (result != ISC_R_SUCCESS)
+ return (result);
+ return (put_txt(lookup, buf));
+ }
+
+ if (ns_g_server->server_id == NULL)
+ return (ISC_R_SUCCESS);
+ else
+ return (put_txt(lookup, ns_g_server->server_id));
+}
+
static isc_result_t
builtin_authority(const char *zone, void *dbdata, dns_sdblookup_t *lookup) {
isc_result_t result;
*dbdata = &hostname_builtin;
else if (strcmp(argv[0], "authors") == 0)
*dbdata = &authors_builtin;
+ else if (strcmp(argv[0], "id") == 0)
+ *dbdata = &id_builtin;
else
return (ISC_R_NOTIMPLEMENTED);
return (ISC_R_SUCCESS);
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: config.c,v 1.34 2002/11/27 09:52:45 marka Exp $ */
+/* $Id: config.c,v 1.35 2003/01/20 05:46:09 marka Exp $ */
#include <config.h>
rrset-order {order cyclic;};\n\
serial-queries 20;\n\
serial-query-rate 20;\n\
+ server-id none;\n\
stacksize default;\n\
statistics-file \"named.stats\";\n\
statistics-interval 60;\n\
type master;\n\
database \"_builtin authors\";\n\
};\n\
+ zone \"id.server\" chaos {\n\
+ type master;\n\
+ database \"_builtin id\";\n\
+ };\n\
};\n\
";
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: server.h,v 1.70 2002/09/10 04:45:54 marka Exp $ */
+/* $Id: server.h,v 1.71 2003/01/20 05:46:10 marka Exp $ */
#ifndef NAMED_SERVER_H
#define NAMED_SERVER_H 1
char * version; /* User-specified version */
isc_boolean_t hostname_set; /* User has set hostname */
char * hostname; /* User-specified hostname */
+ /* Use hostname for server id */
+ isc_boolean_t server_usehostname;
+ char * server_id; /* User-specified server id */
/*
* Current ACL environment. This defines the
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: server.c,v 1.392 2003/01/16 03:59:23 marka Exp $ */
+/* $Id: server.c,v 1.393 2003/01/20 05:46:09 marka Exp $ */
#include <config.h>
server->hostname_set = ISC_FALSE;
}
+ obj = NULL;
+ result = ns_config_get(maps, "server-id", &obj);
+ server->server_usehostname = ISC_FALSE;
+ if (result == ISC_R_SUCCESS && cfg_obj_isboolean(obj)) {
+ server->server_usehostname = ISC_TRUE;
+ } else if (result == ISC_R_SUCCESS) {
+ CHECKM(setoptstring(server, &server->server_id, obj), "strdup");
+ } else {
+ result = setoptstring(server, &server->server_id, NULL);
+ RUNTIME_CHECK(result == ISC_R_SUCCESS);
+ }
+
obj = NULL;
result = ns_config_get(maps, "flush-zones-on-shutdown", &obj);
if (result == ISC_R_SUCCESS) {
server->hostname = NULL;
server->version_set = ISC_FALSE;
server->version = NULL;
+ server->server_usehostname = ISC_FALSE;
+ server->server_id = NULL;
CHECKFATAL(dns_stats_alloccounters(ns_g_mctx, &server->querystats),
"dns_stats_alloccounters");
isc_mem_free(server->mctx, server->version);
if (server->hostname != NULL)
isc_mem_free(server->mctx, server->hostname);
+ if (server->server_id != NULL)
+ isc_mem_free(server->mctx, server->server_id);
dns_zonemgr_detach(&server->zonemgr);
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.0//EN"
"http://www.oasis-open.org/docbook/xml/4.0/docbookx.dtd">
-<!-- File: $Id: Bv9ARM-book.xml,v 1.212 2003/01/16 03:59:24 marka Exp $ -->
+<!-- File: $Id: Bv9ARM-book.xml,v 1.213 2003/01/20 05:46:10 marka Exp $ -->
<book>
<title>BIND 9 Administrator Reference Manual</title>
<programlisting>options {
<optional> version <replaceable>version_string</replaceable>; </optional>
<optional> hostname <replaceable>hostname_string</replaceable>; </optional>
+ <optional> server-id <replaceable>server_id_string</replaceable>; </optional>
<optional> directory <replaceable>path_name</replaceable>; </optional>
<optional> key-directory <replaceable>path_name</replaceable>; </optional>
<optional> named-xfer <replaceable>path_name</replaceable>; </optional>
This defaults to the hostname of the machine hosting the name server as
found by gethostname(). The primary purpose of such queries is to
identify which of a group of anycast servers is actually
-answering your queries. Specifying <command>hostname none</command>
+answering your queries. Specifying <command>hostname none;</command>
disables processing of the queries.</para>
</listitem></varlistentry>
+<varlistentry><term><command>server-id</command></term>
+<listitem><para>The ID of the server should report via a query of
+the name <filename>ID.SERVER</filename>
+with type <command>TXT</command>, class <command>CHAOS</command>.
+The primary purpose of such queries is to
+identify which of a group of anycast servers is actually
+answering your queries. Specifying <command>server-id none;</command>
+disables processing of the queries.
+Specifying <command>server-id hostname;</command> will cause named to
+use the hostname as found by gethostname().
+The default <command>server-id</command> is <command>none</command>.
+</para>
+</listitem></varlistentry>
+
</variablelist>
</sect3>
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: namedconf.c,v 1.12 2003/01/16 03:59:28 marka Exp $ */
+/* $Id: namedconf.c,v 1.13 2003/01/20 05:46:11 marka Exp $ */
#include <config.h>
static cfg_type_t cfg_type_qstringornone = {
"qstringornone", parse_qstringornone, NULL, doc_qstringornone, NULL, NULL };
+/*
+ * keyword hostname
+ */
+
+static void
+print_hostname(cfg_printer_t *pctx, cfg_obj_t *obj) {
+ UNUSED(obj);
+ cfg_print_chars(pctx, "hostname", 4);
+}
+
+static cfg_type_t cfg_type_hostname = {
+ "hostname", NULL, print_hostname, NULL, &cfg_rep_boolean, NULL
+};
+
+/*
+ * "server-id" arguement.
+ */
+
+static isc_result_t
+parse_serverid(cfg_parser_t *pctx, const cfg_type_t *type,
+ cfg_obj_t **ret)
+{
+ isc_result_t result;
+ CHECK(cfg_gettoken(pctx, CFG_LEXOPT_QSTRING));
+ if (pctx->token.type == isc_tokentype_string &&
+ strcasecmp(TOKEN_STRING(pctx), "none") == 0)
+ return (cfg_create_obj(pctx, &cfg_type_none, ret));
+ if (pctx->token.type == isc_tokentype_string &&
+ strcasecmp(TOKEN_STRING(pctx), "hostname") == 0) {
+ return (cfg_create_obj(pctx, &cfg_type_hostname, ret));
+ }
+ cfg_ungettoken(pctx);
+ return (cfg_parse_qstring(pctx, type, ret));
+ cleanup:
+ return (result);
+}
+
+static void
+doc_serverid(cfg_printer_t *pctx, const cfg_type_t *type) {
+ UNUSED(type);
+ cfg_print_chars(pctx, "( <quoted_string> | none | hostname )", 26);
+}
+
+static cfg_type_t cfg_type_serverid = {
+ "serverid", parse_serverid, NULL, doc_serverid, NULL, NULL };
+
/*
* Clauses that can be found within the top level of the named.conf
* file only.
{ "recursive-clients", &cfg_type_uint32, 0 },
{ "serial-queries", &cfg_type_uint32, CFG_CLAUSEFLAG_OBSOLETE },
{ "serial-query-rate", &cfg_type_uint32, 0 },
+ { "server-id", &cfg_type_serverid, 0 },
{ "stacksize", &cfg_type_size, 0 },
{ "statistics-file", &cfg_type_qstring, 0 },
{ "statistics-interval", &cfg_type_uint32, CFG_CLAUSEFLAG_NYI },