controlconf.c revision dafcb997e390efa4423883dafd100c975c4095d6
bd911976d51f102751848568ccf56592fd5f6d77Tinderbox User * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * Copyright (C) 2001-2003 Internet Software Consortium.
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Permission to use, copy, modify, and distribute this software for any
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * purpose with or without fee is hereby granted, provided that the above
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graff * copyright notice and this permission notice appear in all copies.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graff * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graff * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
ed019cabc1cc75d4412010c331876e4ae5080a4dDavid Lawrence * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
4a979d35776321abc952346ba128d1a3cef730ceAutomatic Updater * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graff * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graff * PERFORMANCE OF THIS SOFTWARE.
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graff/* $Id: controlconf.c,v 1.40 2004/03/05 04:57:46 marka Exp $ */
da4920783eb676fcacf6d3a17c3c751a1652c680Bob Halley * Note: Listeners and connections are not locked. All event handlers are
c810fcbf6c7d628e71aaaefafeccc74a3a443ca2Michael Graff * executed by the server task, and all callers of exported routines must
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graff * be running under the server task.
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Grafftypedef ISC_LIST(controlkey_t) controlkeylist_t;
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Grafftypedef struct controlconnection controlconnection_t;
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Grafftypedef ISC_LIST(controlconnection_t) controlconnectionlist_t;
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Grafftypedef struct controllistener controllistener_t;
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austeintypedef ISC_LIST(controllistener_t) controllistenerlist_t;
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graffstatic void control_newconn(isc_task_t *task, isc_event_t *event);
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graffstatic void control_recvmessage(isc_task_t *task, isc_event_t *event);
91cd0f93ad34d23e8b09dca337120f64fbe8f0a1Andreas Gustafssonfree_controlkey(controlkey_t *key, isc_mem_t *mctx) {
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graff isc_mem_put(mctx, key->secret.base, key->secret.length);
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Grafffree_controlkeylist(controlkeylist_t *keylist, isc_mem_t *mctx) {
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graff INSIST(ISC_LIST_EMPTY(listener->connections));
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graff free_controlkeylist(&listener->keys, listener->mctx);
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graff isc_mem_put(listener->mctx, listener, sizeof(*listener));
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graffmaybe_free_listener(controllistener_t *listener) {
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graffmaybe_free_connection(controlconnection_t *conn) {
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graff ISC_LIST_UNLINK(listener->connections, conn, link);
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graff isc_mem_put(listener->mctx, conn, sizeof(*conn));
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graffshutdown_listener(controllistener_t *listener) {
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graff ISC_LIST_UNLINK(listener->controls->listeners, listener, link);
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graff isc_sockaddr_format(&listener->address, socktext,
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graff isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
c810fcbf6c7d628e71aaaefafeccc74a3a443ca2Michael Graff for (conn = ISC_LIST_HEAD(listener->connections);
static isc_boolean_t
int match;
return (ISC_FALSE);
return (ISC_TRUE);
static isc_result_t
return (result);
static isc_result_t
return (result);
isc_buffer_t b;
isc_region_t r;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
static isc_result_t
return (ISC_R_NOMEMORY);
goto cleanup;
goto cleanup;
return (ISC_R_SUCCESS);
return (result);
goto cleanup;
goto restart;
socktext);
goto restart;
goto restart;
static isc_result_t
const char *str;
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
static isc_result_t
const char *str;
goto cleanup;
goto cleanup;
return (ISC_R_SUCCESS);
return (ISC_R_NOMEMORY);
isc_buffer_t b;
#define CHECK(x) \
result = (x); \
goto cleanup; \
static isc_result_t
isc_buffer_t b;
goto cleanup;
return (result);
* in place of the named.conf configuration.
* Get the list of named.conf 'controls' statements.
sizeof(socktext));
socktext);
socktext);
&in6addr_loopback, 0);
return (ISC_R_SUCCESS);
return (ISC_R_NOMEMORY);
return (result);
return (ISC_R_SUCCESS);