Commit 2b3d9824 authored by James Brister's avatar James Brister
Browse files

Support many new values in a view statement.

parent 3e3cdbc5
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: confview.c,v 1.17 2000/04/05 15:18:42 brister Exp $ */
/* $Id: confview.c,v 1.18 2000/04/06 09:46:53 brister Exp $ */
#include <config.h>
......@@ -54,6 +54,11 @@
#define GETINT32(FUNC, FIELD) GETBYTYPE(isc_int32_t, FUNC, FIELD)
#define UNSETINT32(FUNC, FIELD) UNSETBYTYPE(isc_int32_t, FUNC, FIELD)
#define SETSOCKADDR(FUNC, FIELD) SETBYTYPE(isc_sockaddr_t, FUNC, FIELD)
#define GETSOCKADDR(FUNC, FIELD) GETBYTYPE(isc_sockaddr_t, FUNC, FIELD)
#define UNSETSOCKADDR(FUNC, FIELD) UNSETBYTYPE(isc_sockaddr_t, FUNC, FIELD)
#ifdef PVT_CONCAT
#undef PVT_CONCAT
......@@ -353,6 +358,77 @@ dns_c_viewtable_rmviewbyname(dns_c_viewtable_t *viewtable,
}
isc_result_t
dns_c_viewtable_checkviews(dns_c_viewtable_t *viewtable)
{
dns_c_view_t *elem;
isc_boolean_t bbval;
isc_int32_t bival;
isc_result_t result = ISC_R_SUCCESS;
dns_c_rrsolist_t *boval;
REQUIRE(DNS_C_VIEWTABLE_VALID(viewtable));
elem = ISC_LIST_HEAD(viewtable->views);
while (elem != NULL) {
if (dns_c_view_getfetchglue(elem, &bbval) != ISC_R_NOTFOUND)
isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING,
"view `fetch-glue' is not yet "
"implemented.");
if (dns_c_view_getnotify(elem, &bbval) != ISC_R_NOTFOUND)
isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING,
"view `notify' is not yet "
"implemented.");
if (dns_c_view_getrfc2308type1(elem, &bbval) != ISC_R_NOTFOUND)
isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING,
"view `rfc2308-type1' is not yet "
"implemented.");
if (dns_c_view_getrfc2308type1(elem, &bbval) != ISC_R_NOTFOUND)
isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING,
"view `rfc2308-type1' is not yet "
"implemented.");
if (dns_c_view_getmaxncachettl(elem, &bival) != ISC_R_NOTFOUND)
isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING,
"view `max-ncache-ttl' is not yet "
"implemented.");
if (dns_c_view_getlamettl(elem, &bival) != ISC_R_NOTFOUND)
isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING,
"view `lame-ttl' is not yet "
"implemented.");
if (dns_c_view_getminroots(elem, &bival) != ISC_R_NOTFOUND)
isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING,
"view `min-roots' is not yet "
"implemented.");
if (dns_c_view_getordering(elem, &boval) != ISC_R_NOTFOUND)
isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING,
"view `rrset-order' is not yet "
"implemented.");
elem = ISC_LIST_NEXT(elem, next);
}
return (result);
}
/* ***************************************************************** */
/* ***************************************************************** */
......@@ -394,7 +470,6 @@ dns_c_view_new(isc_mem_t *mem, const char *name, dns_c_view_t **newview)
view->allowupdateforwarding = NULL;
view->transferacl = NULL;
view->recursionacl = NULL;
view->blackhole = NULL;
view->sortlist = NULL;
view->topology = NULL;
view->matchclients = NULL;
......@@ -406,32 +481,33 @@ dns_c_view_new(isc_mem_t *mem, const char *name, dns_c_view_t **newview)
view->check_names[dns_trans_response] = NULL;
view->auth_nx_domain = NULL;
view->dialup = NULL;
view->fetch_glue = NULL;
view->has_old_clients = NULL;
view->host_statistics = NULL;
view->multiple_cnames = NULL;
view->notify = NULL;
view->recursion = NULL;
view->rfc2308_type1 = NULL;
view->use_id_pool = NULL;
view->fake_iquery = NULL;
view->use_ixfr = NULL;
view->provide_ixfr = NULL;
view->request_ixfr = NULL;
view->fetch_glue = NULL;
view->notify = NULL;
view->rfc2308_type1 = NULL;
view->transfer_source = NULL;
view->transfer_source_v6 = NULL;
view->query_source = NULL;
view->query_source_v6 = NULL;
view->max_transfer_time_out = NULL;
view->max_transfer_idle_out = NULL;
view->clean_interval = NULL;
view->min_roots = NULL;
view->lamettl = NULL;
view->max_log_size_ixfr = NULL;
view->max_ncache_ttl = NULL;
view->transfer_format = NULL;
#if 0
view->max_transfer_time_in = NULL;
view->max_transfer_time_out = NULL;
view->max_transfer_idle_in = NULL;
view->max_transfer_idle_out = NULL;
view->stats_interval = NULL;
view->transfers_in = NULL;
view->transfers_out = NULL;
view->transfers_per_ns = NULL;
view->serial_queries = NULL;
#endif
ISC_LINK_INIT(view, next);
......@@ -445,12 +521,38 @@ void
dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view)
{
dns_severity_t nameseverity;
in_port_t port;
REQUIRE(DNS_C_VIEW_VALID(view));
dns_c_printtabs(fp, indent);
fprintf(fp, "view \"%s\" {\n", view->name);
#define PRINT_IPANDPORT(FIELD, NAME) \
if (view->FIELD != NULL) { \
port = isc_sockaddr_getport(view->FIELD); \
\
dns_c_printtabs(fp, indent + 1); \
fprintf(fp, NAME " address "); \
\
dns_c_print_ipaddr(fp, view->FIELD); \
\
if (port == 0) { \
fprintf(fp, " port *"); \
} else { \
fprintf(fp, " port %d", port); \
} \
fprintf(fp, " ;\n"); \
}
#define PRINT_IP(FIELD, NAME) \
if (view->FIELD != NULL) { \
dns_c_printtabs(fp, indent + 1); \
fprintf(fp, NAME " "); \
dns_c_print_ipaddr(fp, view->FIELD); \
fprintf(fp, ";\n"); \
}
#define PRINT_IPMLIST(FIELD, NAME) \
if (view->FIELD != NULL) { \
dns_c_printtabs(fp, indent + 1); \
......@@ -471,20 +573,17 @@ dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view)
#define PRINT_INT32(FIELD, NAME) \
if (view->FIELD != NULL) { \
dns_c_printtabs(fp, indent + 1); \
fprintf(fp, "%s %d;\n",NAME,(int)view->FIELD); \
fprintf(fp, "%s %d;\n",NAME,(int)*view->FIELD); \
}
PRINT_IPMLIST(allowquery, "allow-query");
PRINT_IPMLIST(transferacl, "alllow-transfer");
PRINT_IPMLIST(recursionacl, "allow-recursion");
PRINT_IPMLIST(allowupdateforwarding, "allow-update-forwarding");
PRINT_IPMLIST(blackhole, "backhole");
PRINT_IPMLIST(sortlist, "sortlist");
PRINT_IPMLIST(topology, "topology");
PRINT_IPMLIST(matchclients, "match-clients");
fprintf(fp, "\n");
#define PRINT_AS_MINUTES(FIELD, NAME) \
if (view->FIELD != NULL) { \
dns_c_printtabs(fp, indent + 1); \
fprintf(fp, "%s %lu;\n",NAME, \
(unsigned long)(*view->FIELD / 60)); \
}
/* XXX print forward field */
if (view->forwarders != NULL) {
dns_c_printtabs(fp, indent + 1);
fprintf(fp, "forwarders ");
......@@ -493,6 +592,16 @@ dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view)
fprintf(fp, ";\n");
}
PRINT_IPMLIST(allowquery, "allow-query");
PRINT_IPMLIST(allowupdateforwarding, "allow-update-forwarding");
PRINT_IPMLIST(transferacl, "alllow-transfer");
PRINT_IPMLIST(recursionacl, "allow-recursion");
PRINT_IPMLIST(sortlist, "sortlist");
PRINT_IPMLIST(topology, "topology");
PRINT_IPMLIST(matchclients, "match-clients");
fprintf(fp, "\n");
if (view->ordering != NULL) {
dns_c_rrsolist_print(fp, indent + 1, view->ordering);
}
......@@ -523,33 +632,42 @@ dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view)
PRINT_AS_BOOLEAN(auth_nx_domain, "auth-nxdomain");
PRINT_AS_BOOLEAN(dialup, "dialup");
PRINT_AS_BOOLEAN(fetch_glue, "fetch-glue");
PRINT_AS_BOOLEAN(has_old_clients, "has-old-clients");
PRINT_AS_BOOLEAN(host_statistics, "host-statistics");
PRINT_AS_BOOLEAN(multiple_cnames, "multiple-cnames");
PRINT_AS_BOOLEAN(notify, "notify");
PRINT_AS_BOOLEAN(recursion, "recursion");
PRINT_AS_BOOLEAN(rfc2308_type1, "rfc2308-type1");
PRINT_AS_BOOLEAN(use_id_pool, "use-id-pool");
PRINT_AS_BOOLEAN(fake_iquery, "fake-iquery");
PRINT_AS_BOOLEAN(use_ixfr, "use-ixfr");
PRINT_AS_BOOLEAN(provide_ixfr, "provide-ixfr");
PRINT_AS_BOOLEAN(request_ixfr, "request-ixfr");
PRINT_AS_BOOLEAN(fetch_glue, "fetch-glue");
PRINT_AS_BOOLEAN(notify, "notify");
PRINT_AS_BOOLEAN(rfc2308_type1, "rfc2308-type1");
PRINT_IP(transfer_source, "transfer-source");
PRINT_IP(transfer_source_v6, "transfer-source-v6");
PRINT_IPANDPORT(query_source, "query-source");
PRINT_IPANDPORT(query_source_v6, "query-source-v6");
PRINT_AS_MINUTES(max_transfer_time_out, "max-transfer-time-out");
PRINT_AS_MINUTES(max_transfer_idle_out, "max-transfer-idle-out");
PRINT_AS_MINUTES(clean_interval, "cleaning-interval");
PRINT_INT32(clean_interval, "cleaning-interval");
PRINT_INT32(lamettl, "lamettl");
PRINT_INT32(max_log_size_ixfr, "max_log_size_ixfr");
PRINT_INT32(min_roots, "min-roots");
PRINT_INT32(lamettl, "lame-ttl");
PRINT_INT32(max_ncache_ttl, "max-ncache-ttl");
if (view->transfer_format != NULL) {
dns_c_printtabs(fp, indent + 1);
fprintf(fp, "transfer-format %s;\n",
dns_c_transformat2string(*view->transfer_format,
ISC_TRUE));
}
#if 0
PRINT_INT32(max_transfer_time_in, "max-transfer-time-in");
PRINT_INT32(max_transfer_time_out, "max-transfer-time-out");
PRINT_INT32(max_transfer_idle_in, "max-transfer-idle-in");
PRINT_INT32(max_transfer_idle_out, "max-transfer-idle-out");
PRINT_INT32(stats_interval, "statistics-interval");
PRINT_INT32(transfers_in, "transfers-in");
PRINT_INT32(transfers_out, "transfers-out");
PRINT_INT32(transfers_per_ns, "transfers-per-ns");
PRINT_INT32(serialqueries, "serial-queries");
#endif
fprintf(fp, "\n");
......@@ -563,6 +681,8 @@ dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view)
#undef PRINT_IPMLIST
#undef PRINT_AS_BOOLEAN
#undef PRINT_INT32
#undef PRINT_IP
#undef PRINT_IPANDPORT
}
......@@ -582,7 +702,7 @@ dns_c_view_delete(dns_c_view_t **viewptr)
#define FREEFIELD(FIELD) \
do { if (view->FIELD != NULL) { \
isc_mem_put(view->mem, view->FIELD, sizeof (view->FIELD)); \
isc_mem_put(view->mem, view->FIELD, sizeof (*view->FIELD)); \
view->FIELD = NULL; \
} } while (0)
......@@ -607,7 +727,6 @@ dns_c_view_delete(dns_c_view_t **viewptr)
FREEIPMLIST(allowupdateforwarding);
FREEIPMLIST(transferacl);
FREEIPMLIST(recursionacl);
FREEIPMLIST(blackhole);
FREEIPMLIST(sortlist);
FREEIPMLIST(topology);
FREEIPMLIST(matchclients);
......@@ -622,32 +741,34 @@ dns_c_view_delete(dns_c_view_t **viewptr)
FREEFIELD(check_names[dns_trans_response]);
FREEFIELD(auth_nx_domain);
FREEFIELD(dialup);
FREEFIELD(fetch_glue);
FREEFIELD(has_old_clients);
FREEFIELD(host_statistics);
FREEFIELD(multiple_cnames);
FREEFIELD(notify);
FREEFIELD(recursion);
FREEFIELD(rfc2308_type1);
FREEFIELD(use_id_pool);
FREEFIELD(fake_iquery);
FREEFIELD(use_ixfr);
FREEFIELD(provide_ixfr);
FREEFIELD(request_ixfr);
FREEFIELD(fetch_glue);
FREEFIELD(notify);
FREEFIELD(rfc2308_type1);
FREEFIELD(transfer_source);
FREEFIELD(transfer_source_v6);
FREEFIELD(query_source);
FREEFIELD(query_source_v6);
FREEFIELD(max_transfer_time_out);
FREEFIELD(max_transfer_idle_out);
FREEFIELD(clean_interval);
FREEFIELD(min_roots);
FREEFIELD(lamettl);
FREEFIELD(max_log_size_ixfr);
FREEFIELD(max_ncache_ttl);
FREEFIELD(transfer_format);
#if 0
FREEFIELD(max_transfer_time_in);
FREEFIELD(max_transfer_time_out);
FREEFIELD(max_transfer_idle_in);
FREEFIELD(max_transfer_idle_out);
FREEFIELD(stats_interval);
FREEFIELD(transfers_in);
FREEFIELD(transfers_out);
FREEFIELD(transfers_per_ns);
FREEFIELD(serial_queries);
#endif
view->magic = 0;
isc_mem_put(view->mem, view, sizeof *view);
......@@ -854,9 +975,7 @@ dns_c_view_getordering(dns_c_view_t *view,
REQUIRE(DNS_C_VIEW_VALID(view));
REQUIRE(olist != NULL);
if (view->ordering != NULL) {
*olist = view->ordering;
}
*olist = view->ordering;
return (*olist == NULL ? ISC_R_NOTFOUND : ISC_R_SUCCESS);
}
......@@ -994,9 +1113,9 @@ GETIPMLIST(allowupdateforwarding, allowupdateforwarding)
SETIPMLIST(allowupdateforwarding, allowupdateforwarding)
UNSETIPMLIST(allowupdateforwarding, allowupdateforwarding)
GETIPMLIST(blackhole, blackhole)
SETIPMLIST(blackhole, blackhole)
UNSETIPMLIST(blackhole, blackhole)
GETIPMLIST(transferacl, transferacl)
SETIPMLIST(transferacl, transferacl)
UNSETIPMLIST(transferacl, transferacl)
GETIPMLIST(recursionacl, recursionacl)
SETIPMLIST(recursionacl, recursionacl)
......@@ -1014,111 +1133,110 @@ GETIPMLIST(matchclients, matchclients)
SETIPMLIST(matchclients, matchclients)
UNSETIPMLIST(matchclients, matchclients)
GETIPMLIST(transferacl, transferacl)
SETIPMLIST(transferacl, transferacl)
UNSETIPMLIST(transferacl, transferacl)
GETBOOL(authnxdomain, auth_nx_domain)
SETBOOL(authnxdomain, auth_nx_domain)
GETBOOL(authnxdomain, auth_nx_domain)
UNSETBOOL(authnxdomain, auth_nx_domain)
GETBOOL(dialup, dialup)
SETBOOL(dialup, dialup)
UNSETBOOL(dialup, dialup)
SETBOOL(recursion, recursion)
GETBOOL(recursion, recursion)
UNSETBOOL(recursion, recursion)
GETBOOL(fakeiquery, fake_iquery)
SETBOOL(fakeiquery, fake_iquery)
UNSETBOOL(fakeiquery, fake_iquery)
SETBOOL(provideixfr, provide_ixfr)
GETBOOL(provideixfr, provide_ixfr)
UNSETBOOL(provideixfr, provide_ixfr)
SETBOOL(requestixfr, request_ixfr)
GETBOOL(requestixfr, request_ixfr)
UNSETBOOL(requestixfr, request_ixfr)
GETBOOL(fetchglue, fetch_glue)
SETBOOL(fetchglue, fetch_glue)
GETBOOL(fetchglue, fetch_glue)
UNSETBOOL(fetchglue, fetch_glue)
GETBOOL(hasoldclients, has_old_clients)
SETBOOL(hasoldclients, has_old_clients)
UNSETBOOL(hasoldclients, has_old_clients)
GETBOOL(hoststatistics, host_statistics)
SETBOOL(hoststatistics, host_statistics)
UNSETBOOL(hoststatistics, host_statistics)
GETBOOL(multiplecnames, multiple_cnames)
SETBOOL(multiplecnames, multiple_cnames)
UNSETBOOL(multiplecnames, multiple_cnames)
GETBOOL(notify, notify)
SETBOOL(notify, notify)
GETBOOL(notify, notify)
UNSETBOOL(notify, notify)
GETBOOL(provideixfr, provide_ixfr)
SETBOOL(provideixfr, provide_ixfr)
UNSETBOOL(provideixfr, provide_ixfr)
SETBOOL(rfc2308type1, rfc2308_type1)
GETBOOL(rfc2308type1, rfc2308_type1)
UNSETBOOL(rfc2308type1, rfc2308_type1)
GETBOOL(recursion, recursion)
SETBOOL(recursion, recursion)
UNSETBOOL(recursion, recursion)
GETSOCKADDR(transfersource, transfer_source)
SETSOCKADDR(transfersource, transfer_source)
UNSETSOCKADDR(transfersource, transfer_source)
GETBOOL(requestixfr, request_ixfr)
SETBOOL(requestixfr, request_ixfr)
UNSETBOOL(requestixfr, request_ixfr)
GETSOCKADDR(transfersourcev6, transfer_source_v6)
SETSOCKADDR(transfersourcev6, transfer_source_v6)
UNSETSOCKADDR(transfersourcev6, transfer_source_v6)
GETBOOL(rfc2308type1, rfc2308_type1)
SETBOOL(rfc2308type1, rfc2308_type1)
UNSETBOOL(rfc2308type1, rfc2308_type1)
GETSOCKADDR(querysource, query_source)
SETSOCKADDR(querysource, query_source)
UNSETSOCKADDR(querysource, query_source)
GETBOOL(useidpool, use_id_pool)
SETBOOL(useidpool, use_id_pool)
UNSETBOOL(useidpool, use_id_pool)
GETSOCKADDR(querysourcev6, query_source_v6)
SETSOCKADDR(querysourcev6, query_source_v6)
UNSETSOCKADDR(querysourcev6, query_source_v6)
SETINT32(maxtransfertimeout, max_transfer_time_out)
GETINT32(maxtransfertimeout, max_transfer_time_out)
UNSETINT32(maxtransfertimeout, max_transfer_time_out)
GETBOOL(useixfr, use_ixfr)
SETBOOL(useixfr, use_ixfr)
UNSETBOOL(useixfr, use_ixfr)
SETINT32(maxtransferidleout, max_transfer_idle_out)
GETINT32(maxtransferidleout, max_transfer_idle_out)
UNSETINT32(maxtransferidleout, max_transfer_idle_out)
GETINT32(cleaninterval, clean_interval)
SETINT32(cleaninterval, clean_interval)
GETINT32(cleaninterval, clean_interval)
UNSETINT32(cleaninterval, clean_interval)
GETINT32(lamettl, lamettl)
SETINT32(minroots, min_roots)
GETINT32(minroots, min_roots)
UNSETINT32(minroots, min_roots)
SETINT32(lamettl, lamettl)
GETINT32(lamettl, lamettl)
UNSETINT32(lamettl, lamettl)
GETINT32(maxlogsizeixfr, max_log_size_ixfr)
SETINT32(maxlogsizeixfr, max_log_size_ixfr)
UNSETINT32(maxlogsizeixfr, max_log_size_ixfr)
GETINT32(maxncachettl, max_ncache_ttl)
SETINT32(maxncachettl, max_ncache_ttl)
GETINT32(maxncachettl, max_ncache_ttl)
UNSETINT32(maxncachettl, max_ncache_ttl)
GETINT32(maxtransferidlein, max_transfer_idle_in)
SETINT32(maxtransferidlein, max_transfer_idle_in)
UNSETINT32(maxtransferidlein, max_transfer_idle_in)
GETINT32(maxtransferidleout, max_transfer_idle_out)
SETINT32(maxtransferidleout, max_transfer_idle_out)
UNSETINT32(maxtransferidleout, max_transfer_idle_out)
GETBYTYPE(dns_transfer_format_t, transferformat, transfer_format)
SETBYTYPE(dns_transfer_format_t, transferformat, transfer_format)
UNSETBYTYPE(dns_transfer_format_t, transferformat, transfer_format)
GETINT32(maxtransfertimein, max_transfer_time_in)
#if 0
/*
* XXX waiting for implementation in server to turn these on.
*/
SETINT32(maxtransfertimein, max_transfer_time_in)
GETINT32(maxtransfertimein, max_transfer_time_in)
UNSETINT32(maxtransfertimein, max_transfer_time_in)
GETINT32(maxtransfertimeout, max_transfer_time_out)
SETINT32(maxtransfertimeout, max_transfer_time_out)
UNSETINT32(maxtransfertimeout, max_transfer_time_out)
SETINT32(maxtransferidlein, max_transfer_idle_in)
GETINT32(maxtransferidlein, max_transfer_idle_in)
UNSETINT32(maxtransferidlein, max_transfer_idle_in)
SETINT32(transfersperns, transfers_per_ns)
GETINT32(transfersperns, transfers_per_ns)
UNSETINT32(transfersperns, transfers_per_ns)
SETINT32(serialqueries, serial_queries)
GETINT32(serialqueries, serial_queries)
UNSETINT32(serialqueries, serial_queries)
#endif
GETINT32(statsinterval, stats_interval)
SETINT32(statsinterval, stats_interval)
UNSETINT32(statsinterval, stats_interval)
GETINT32(transfersin, transfers_in)
SETINT32(transfersin, transfers_in)
UNSETINT32(transfersin, transfers_in)
GETINT32(transfersout, transfers_out)
SETINT32(transfersout, transfers_out)
UNSETINT32(transfersout, transfers_out)
GETINT32(transfersperns, transfers_per_ns)
SETINT32(transfersperns, transfers_per_ns)
UNSETINT32(transfersperns, transfers_per_ns)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment