* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: client.c,v 1.118 2000/10/11 17:44:04 mws Exp $ */
+/* $Id: client.c,v 1.119 2000/10/12 21:51:42 mws Exp $ */
#include <config.h>
#include <dns/dispatch.h>
#include <dns/events.h>
#include <dns/message.h>
+#include <dns/opt.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: client.h,v 1.44 2000/10/11 17:44:07 mws Exp $ */
+/* $Id: client.h,v 1.45 2000/10/12 21:51:48 mws Exp $ */
#ifndef NAMED_CLIENT_H
#define NAMED_CLIENT_H 1
#include <dns/name.h>
#include <dns/types.h>
#include <dns/tcpmsg.h>
-#ifdef DNS_OPT_NEWCODES
#include <dns/fixedname.h>
#include <dns/opt.h>
-#endif /* DNS_OPT_NEWCODES */
#include <named/types.h>
#include <named/query.h>
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: omapi.h,v 1.11 2000/10/05 10:42:38 marka Exp $ */
+/* $Id: omapi.h,v 1.12 2000/10/12 21:51:49 mws Exp $ */
#ifndef NAMED_OMAPI_H
#define NAMED_OMAPI_H 1
#define NS_OMAPI_COMMAND_RELOAD "reload"
#define NS_OMAPI_COMMAND_RELOADCONFIG "reload-config"
#define NS_OMAPI_COMMAND_RELOADZONES "reload-zones"
+#define NS_OMAPI_COMMAND_REFRESH "refresh"
isc_result_t
ns_omapi_init(void);
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: server.h,v 1.39 2000/10/05 23:48:49 marka Exp $ */
+/* $Id: server.h,v 1.40 2000/10/12 21:51:50 mws Exp $ */
#ifndef NAMED_SERVER_H
#define NAMED_SERVER_H 1
* Inform the server that the zones should be flushed to disk on shutdown.
*/
+isc_result_t
+ns_server_reloadzone(ns_server_t *server, char *args);
+
+isc_result_t
+ns_server_refreshzone(ns_server_t *server, char *args);
+
#endif /* NAMED_SERVER_H */
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: omapi.c,v 1.19 2000/10/11 21:21:46 marka Exp $ */
+/* $Id: omapi.c,v 1.20 2000/10/12 21:51:43 mws Exp $ */
/*
* Principal Author: DCL
*/
if (omapi_string_strcmp(name, NS_OMAPI_COMMAND_RELOAD) == 0) {
result = ISC_R_SUCCESS;
- args = omapi_data_strdup(ns_g_mctx, value);
- if (args == NULL)
- result = ISC_R_NOMEMORY;
- else if (strcmp(args, NS_OMAPI_COMMAND_RELOAD) == 0)
+ if (value != NULL) {
+ args = omapi_data_strdup(ns_g_mctx, value);
+ if (args == NULL)
+ result = ISC_R_NOMEMORY;
+ else if (strcmp(args, NS_OMAPI_COMMAND_RELOAD) == 0)
+ ns_server_reloadwanted(ns_g_server);
+ /* XXX Can the previous case ever happen??? */
+ else
+ result = ns_server_reloadzone(ns_g_server,
+ args);
+ if (args != NULL)
+ isc_mem_free(ns_g_mctx, args);
+ } else {
ns_server_reloadwanted(ns_g_server);
- else
- ns_server_reloadzone(ns_g_server, args);
- if (args != NULL)
- isc_mem_free(ns_g_mctx, args);
-
+ }
+ } else if (omapi_string_strcmp(name, NS_OMAPI_COMMAND_REFRESH) == 0) {
+ result = ISC_R_SUCCESS;
+ if (value != NULL) {
+ args = omapi_data_strdup(ns_g_mctx, value);
+ if (args == NULL)
+ result = ISC_R_NOMEMORY;
+ else if (strcmp(args, NS_OMAPI_COMMAND_RELOAD) != 0)
+ result = ns_server_refreshzone(ns_g_server,
+ args);
+ if (args != NULL)
+ isc_mem_free(ns_g_mctx, args);
+ }
} else if (omapi_string_strcmp(name,NS_OMAPI_COMMAND_HALT) == 0) {
ns_server_flushonshutdown(ns_g_server, ISC_FALSE);
isc_app_shutdown();
"control_setvalue: '%.*s' not yet implemented",
REGION_FMT(®ion));
result = ISC_R_NOTIMPLEMENTED;
-
} else {
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_OMAPI, ISC_LOG_WARNING,
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: query.c,v 1.136 2000/10/11 18:00:08 mws Exp $ */
+/* $Id: query.c,v 1.137 2000/10/12 21:51:45 mws Exp $ */
#include <config.h>
#include <dns/db.h>
#include <dns/events.h>
#include <dns/message.h>
+#include <dns/opt.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
dns_namereln_t namereln;
int order;
isc_buffer_t *dbuf;
- isc_region_t r;
isc_buffer_t b;
isc_result_t result, eresult;
dns_fixedname_t fixed;
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: server.c,v 1.227 2000/10/11 21:21:47 marka Exp $ */
+/* $Id: server.c,v 1.228 2000/10/12 21:51:46 mws Exp $ */
#include <config.h>
#include <dns/view.h>
#include <dns/zone.h>
#include <dns/zoneconf.h>
+#include <dns/zt.h>
#include <dst/dst.h>
}
+
/*
* Create the zone that handles queries for
* "version.bind. CH". The version string returned is that
UNLOCK(&server->reload_event_lock);
}
-void
-ns_server_reloadzone(ns_server_t *server, char *args) {
+static char *
+next_token(char **stringp, const char *delim) {
+ char *res;
+ do {
+ res = strsep(stringp, delim);
+ if (res == NULL)
+ break;
+ } while (*res == '\0');
+ return (res);
+}
+
+static isc_result_t
+zone_from_args(char *args, dns_zone_t **zone) {
+ char *input, *ptr;
+ const char *zonetxt = NULL, *viewtxt = NULL;
+ dns_fixedname_t name;
+ isc_result_t result;
+ isc_buffer_t buf;
+ dns_view_t *view;
+
+ input = args;
+ ptr = next_token(&input, " \t");
+ while (ptr != NULL) {
+ switch (ptr[0]) {
+ case 'Z':
+ zonetxt = ptr+1;
+ break;
+ case 'V':
+ viewtxt = ptr+1;
+ break;
+ }
+ ptr = next_token(&input, " \t");
+ }
+ if (zonetxt == NULL)
+ return DNS_R_BADZONE; /* Nothing to do! */
+ isc_buffer_init(&buf, zonetxt, strlen(zonetxt));
+ isc_buffer_add(&buf, strlen(zonetxt));
+ dns_fixedname_init(&name);
+ result = dns_name_fromtext(&(name.name), &buf, dns_rootname,
+ ISC_FALSE, NULL);
+ if (result != ISC_R_SUCCESS)
+ goto fail1;
+ if (viewtxt == NULL)
+ viewtxt = "_default";
+ result = dns_viewlist_find(&ns_g_server->viewlist, viewtxt,
+ dns_rdataclass_in, &view);
+ if (result != ISC_R_SUCCESS)
+ goto fail1;
+ result = dns_zt_find(view->zonetable, &(name.name), 0, NULL,
+ zone);
+ if (result != ISC_R_SUCCESS)
+ goto fail2;
+ fail2:
+ dns_view_detach(&view);
+ fail1:
+ isc_buffer_invalidate(&buf);
+ return (result);
}
+isc_result_t
+ns_server_reloadzone(ns_server_t *server, char *args) {
+ isc_result_t result;
+ dns_zone_t *zone = NULL;
+
+ UNUSED(server);
+ result = zone_from_args(args, &zone);
+ if (result != ISC_R_SUCCESS)
+ return (result);
+ if (zone != NULL) {
+ dns_zone_forcereload(zone);
+ dns_zone_detach(&zone);
+ }
+ return (ISC_R_SUCCESS);
+}
+
+isc_result_t
+ns_server_refreshzone(ns_server_t *server, char *args) {
+ isc_result_t result;
+ dns_zone_t *zone = NULL;
+
+ UNUSED(server);
+ result = zone_from_args(args, &zone);
+ if (result != ISC_R_SUCCESS)
+ return (result);
+ if (zone != NULL) {
+ dns_zone_refresh(zone);
+ dns_zone_detach(&zone);
+ }
+ return (ISC_R_SUCCESS);
+}
+
static isc_result_t
ns_listenlist_fromconfig(dns_c_lstnlist_t *clist, dns_c_ctx_t *cctx,
dns_aclconfctx_t *actx,
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rndc.c,v 1.26 2000/10/11 21:22:29 marka Exp $ */
+/* $Id: rndc.c,v 1.27 2000/10/12 21:51:51 mws Exp $ */
/*
* Principal Author: DCL
isc_result_t result;
char *message;
*/
+ UNUSED(value);
INSIST(handle == (omapi_object_t *)&ndc_g_ndc);
unsigned int algorithm;
int ch;
int len;
+ char *zonename = NULL;
+ char *viewname = NULL;
progname = strrchr(*argv, '/');
if (progname != NULL)
else
progname = *argv;
- while ((ch = isc_commandline_parse(argc, argv, "c:Mmp:s:vy:")) != -1) {
+ while ((ch = isc_commandline_parse(argc, argv, "c:Mmp:s:Vv:y:z:"))
+ != -1) {
switch (ch) {
case 'c':
conffile = isc_commandline_argument;
case 's':
servername = isc_commandline_argument;
break;
-
- case 'v':
- /*
- * Undocumented, for testing.
- */
+ case 'V':
verbose = ISC_TRUE;
break;
-
+ case 'v':
+ viewname = isc_commandline_argument;
+ break;
case 'y':
keyname = isc_commandline_argument;
break;
-
+ case 'z':
+ zonename = isc_commandline_argument;
+ break;
case '?':
usage();
exit(1);
result = ISC_R_NOTIMPLEMENTED;
} else if (strcmp(command, "reload") == 0) {
- result = send_command(omapimgr, command, args);
-
+ char omapiargs[DNS_NAME_MAXTEXT];
+ omapiargs[0]=0;
+ if (zonename != NULL) {
+ strncat(omapiargs, "Z", 1);
+ omapiargs[DNS_NAME_MAXTEXT-1] = 0;
+ strncat(omapiargs, zonename,
+ DNS_NAME_MAXTEXT);
+ omapiargs[DNS_NAME_MAXTEXT-1] = 0;
+ }
+ if (zonename != NULL && viewname != NULL) {
+ strncat(omapiargs, " ",
+ DNS_NAME_MAXTEXT);
+ omapiargs[DNS_NAME_MAXTEXT-1] = 0;
+ }
+ if (viewname != NULL) {
+ strncat(omapiargs, "V", 1);
+ omapiargs[DNS_NAME_MAXTEXT-1] = 0;
+ strncat(omapiargs, viewname,
+ DNS_NAME_MAXTEXT);
+ omapiargs[DNS_NAME_MAXTEXT-1] = 0;
+ }
+ result = send_command(omapimgr, command, omapiargs);
+ } else if (strcmp(command, "refresh") == 0) {
+ char omapiargs[DNS_NAME_MAXTEXT];
+ omapiargs[0]=0;
+ if (zonename != NULL) {
+ strncat(omapiargs, "Z", 1);
+ omapiargs[DNS_NAME_MAXTEXT-1] = 0;
+ strncat(omapiargs, zonename,
+ DNS_NAME_MAXTEXT);
+ omapiargs[DNS_NAME_MAXTEXT-1] = 0;
+ }
+ if (zonename != NULL && viewname != NULL) {
+ strncat(omapiargs, " ",
+ DNS_NAME_MAXTEXT);
+ omapiargs[DNS_NAME_MAXTEXT-1] = 0;
+ }
+ if (viewname != NULL) {
+ strncat(omapiargs, "V", 1);
+ omapiargs[DNS_NAME_MAXTEXT-1] = 0;
+ strncat(omapiargs, viewname,
+ DNS_NAME_MAXTEXT);
+ omapiargs[DNS_NAME_MAXTEXT-1] = 0;
+ }
+ result = send_command(omapimgr, command, omapiargs);
} else if (strcmp(command, "restart") == 0) {
result = ISC_R_NOTIMPLEMENTED;
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: opt.h,v 1.1 2000/10/11 17:44:18 mws Exp $ */
+/* $Id: opt.h,v 1.2 2000/10/12 21:51:57 mws Exp $ */
#ifndef DNS_OPT_H
#define DNS_OPT_H 1
#include <dns/rdataset.h>
#include <dns/message.h>
+#ifndef NOMINUM_PUBLIC
+/*
+ * XXX For GNS, We're enabling the new option codes. This is
+ * internal use only.
+ */
+#define DNS_OPT_NEWCODES
+#endif /* NOMINUM_PUBLIC */
+
/*
* XXX WARNING XXX These codes have not yet been assigned by IANA.
* These are here as placekeepers ONLY.
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zone.h,v 1.78 2000/10/05 06:39:25 marka Exp $ */
+/* $Id: zone.h,v 1.79 2000/10/12 21:51:58 mws Exp $ */
#ifndef DNS_ZONE_H
#define DNS_ZONE_H 1
* 'zmgr' to be a valid zone manager.
*/
+void
+dns_zone_forcereload(dns_zone_t *zone);
+/*
+ * Force a reload of specified zone.
+ *
+ * Requires:
+ * 'zone' to be a valid zone.
+ */
+
+isc_boolean_t
+dns_zone_isforced(dns_zone_t *zone);
+/*
+ * Check if the zone is waiting a forced reload.
+ *
+ * Requires:
+ * 'zone' to be a valid zone.
+ */
ISC_LANG_ENDDECLS
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: xfrin.c,v 1.100 2000/10/12 03:32:14 marka Exp $ */
+/* $Id: xfrin.c,v 1.101 2000/10/12 21:51:53 mws Exp $ */
#include <config.h>
case XFRST_SOAQUERY:
xfr->end_serial = dns_soa_getserial(rdata);
if (!DNS_SERIAL_GT(xfr->end_serial,
- xfr->ixfr.request_serial)) {
+ xfr->ixfr.request_serial) &&
+ !dns_zone_isforced(xfr->zone)) {
xfrin_log(xfr, ISC_LOG_DEBUG(3),
"requested serial %u, "
"master has %u, not updating",
*/
xfr->end_serial = dns_soa_getserial(rdata);
if (xfr->reqtype == dns_rdatatype_ixfr &&
- ! DNS_SERIAL_GT(xfr->end_serial, xfr->ixfr.request_serial))
+ ! DNS_SERIAL_GT(xfr->end_serial, xfr->ixfr.request_serial)
+ && !dns_zone_isforced(xfr->zone))
{
/*
* This must be the single SOA record that is
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zone.c,v 1.229 2000/10/10 22:00:12 bwelling Exp $ */
+/* $Id: zone.c,v 1.230 2000/10/12 21:51:55 mws Exp $ */
#include <config.h>
#define DNS_ZONEFLG_NOMASTERS 0x00001000U /* an attempt to refresh a
* zone with no masters
* occured */
-#define DNS_ZONEFLG_LOADING 0x00002000U /* load from disk in progress */
-#define DNS_ZONEFLG_HAVETIMERS 0x00004000U /* timer values have been set from
- SOA (if not set, we are still using
- default timer values) */
+#define DNS_ZONEFLG_LOADING 0x00002000U /* load from disk in progress*/
+#define DNS_ZONEFLG_HAVETIMERS 0x00004000U /* timer values have been set
+ * from SOA (if not set, we
+ * are still using
+ * default timer values) */
+#define DNS_ZONEFLG_FORCELOAD 0x00008000U /* Force a reload */
#define DNS_ZONE_OPTION(z,o) (((z)->options & (o)) != 0)
zone_log(zone, me, ISC_LOG_DEBUG(1), "Serial: new %u, old %u",
serial, zone->serial);
if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_LOADED) ||
+#ifndef NOMINUM_PUBLIC
+ DNS_ZONE_FLAG(zone, DNS_ZONEFLG_FORCELOAD) ||
+#endif /* NOMINUM_PUBLIC */
isc_serial_gt(serial, zone->serial)) {
tcp_transfer:
isc_event_free(&event);
zone->flags |= DNS_ZONEFLG_NEEDNOTIFY;
/*FALLTHROUGH*/
case DNS_R_UPTODATE:
+ zone->flags &= ~DNS_ZONEFLG_FORCELOAD;
/*
* Has the zone expired underneath us?
*/
"no database exists yet, requesting AXFR of "
"initial version from %s", mastertext);
xfrtype = dns_rdatatype_axfr;
+ } else if (dns_zone_isforced(zone)) {
+ zone_log(zone, me, ISC_LOG_DEBUG(3),
+ "forced reload, requesting AXFR of "
+ "initial version from %s", mastertext);
+ xfrtype = dns_rdatatype_axfr;
} else {
isc_boolean_t use_ixfr = ISC_TRUE;
if (peer != NULL &&
"database (%p) destroyed", (void*) db);
}
#endif
+
+void
+dns_zone_forcereload(dns_zone_t *zone) {
+ REQUIRE(DNS_ZONE_VALID(zone));
+
+ zone->flags |= DNS_ZONEFLG_FORCELOAD;
+ dns_zone_refresh(zone);
+}
+
+isc_boolean_t
+dns_zone_isforced(dns_zone_t *zone) {
+ REQUIRE(DNS_ZONE_VALID(zone));
+
+ return (DNS_ZONE_FLAG(zone,DNS_ZONEFLG_FORCELOAD));
+}
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# $Id: sanitize_all.sh,v 1.7 2000/09/29 21:31:02 mws Exp $
+# $Id: sanitize_all.sh,v 1.8 2000/10/12 21:52:00 mws Exp $
PERL=perl5
# sanitize all of the files in that tree.
find . -name '*.[ch]' | xargs $PERL util/sanitize.pl -kNOMINUM_PUBLIC \
- -kISC_PLATFORM_USETHREADS $*
+ -kISC_PLATFORM_USETHREADS -iNOMINUM_GNS $*
find . -name '*.in' | xargs $PERL util/sanitize.pl -kNOMINUM_PUBLIC \
- -kISC_PLATFORM_USETHREADS $*
+ -kISC_PLATFORM_USETHREADS -iNOMINUM_GNS $*
for file in `find . -name '*.dirty'`
do
clean=`echo $file | sed 's/\.dirty$//'`