creating new zones on bind 9.1.0

Joseph S D Yao jsdy at cospo.osis.gov
Fri Feb 16 18:30:37 UTC 2001


On Fri, Feb 16, 2001 at 08:12:45AM +0200, Steven Sporen wrote:
> Does a SIGHUP perform the same task as an rndc reload? 

Good question.  After all, we have been warned that the signal(3)
interface to 'named' was going away.

Let's first look at the 'named' manual entry in 9.1.0.  It says,
"Sending the name server a SIGHUP signal forces a reload of the
server."  If we believe this, we're done.

Going to .../bind-9.1.0/bin/named, we do a 'grep' for signal-handling
routines.  None found!  If we believe this, we're done, with the
opposite answer.  But BIND 9 is built with portability in mind, so we
plug on a bit.

Looking in main.c, we find as part of main() the following:
	do {
		result = isc_app_run();

		if (result == ISC_R_RELOAD) {
			ns_server_reloadwanted(ns_g_server);
		} else ...
		}
	} while (result != ISC_R_SUCCESS);

But the isc_app_* subroutines are not in this directory.  So they must
be in a library.  Move to .../bind-9.1.0/lib/isc.  Greps for both the
signal handlers and isc_app_run FAIL.  But in a subdirectory "unix",
one hits pay dirt with the file "app.c".

This is a source code file with lots of #ifdef's.  Unfortunately, the
Unix signal-handling API is one of the more ... ummm ... diversified
parts of Unix code.  Because of an early rift, different Unices
"really" do it different ways.  But various parts show:

#ifndef HAVE_SIGWAIT
...
static void
reload_action(int arg) {
        UNUSED(arg);
	want_reload = ISC_TRUE;
}
#endif
...
#ifndef ISC_PLATFORM_USETHREADS
/*
 * Event loop for nonthreaded programs.
 */
static isc_result_t
evloop() {
...
		if (want_reload) {
			want_reload = ISC_FALSE;
			return (ISC_R_RELOAD);
		}
...
}
...
#endif /* ISC_PLATFORM_USETHREADS */

isc_result_t
isc_app_run(void) {
...
		if (want_reload) {
			want_reload = ISC_FALSE;
			return (ISC_R_RELOAD);
		}
...
}

And all sorts of code to set and catch the signals.

Now, wasn't that fun?  All along, I could have just hit my running
'named' with a SIGHUP and seen what would happen.  In fact, I'd advise
you to do that anyway, just to verify that it's working right on your
platform.  But now we have a better idea how BIND 9's 'named' is
structured.  ;-)

-- 
Joe Yao				jsdy at cospo.osis.gov - Joseph S. D. Yao
COSPO/OSIS Computer Support					EMT-B
-----------------------------------------------------------------------
This message is not an official statement of COSPO policies.


More information about the bind-users mailing list