Integrate named with libnmserver library.

Signed-off-by: Adam Tkac <atkac@redhat.com>
This commit is contained in:
Adam Tkac 2011-02-22 17:04:57 +01:00
parent 333f89f44e
commit 3e86a6bcba
3 changed files with 349 additions and 20 deletions

View File

@ -1,6 +1,6 @@
diff -up bind-9.8.0rc1/bin/Makefile.in.sdb bind-9.8.0rc1/bin/Makefile.in diff -up bind-9.8.0rc1/bin/Makefile.in.sdb bind-9.8.0rc1/bin/Makefile.in
--- bind-9.8.0rc1/bin/Makefile.in.sdb 2009-10-05 14:07:08.000000000 +0200 --- bind-9.8.0rc1/bin/Makefile.in.sdb 2009-10-05 14:07:08.000000000 +0200
+++ bind-9.8.0rc1/bin/Makefile.in 2011-02-21 16:28:51.678648382 +0100 +++ bind-9.8.0rc1/bin/Makefile.in 2011-02-22 16:02:56.029259468 +0100
@@ -19,8 +19,8 @@ srcdir = @srcdir@ @@ -19,8 +19,8 @@ srcdir = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
@ -13,14 +13,14 @@ diff -up bind-9.8.0rc1/bin/Makefile.in.sdb bind-9.8.0rc1/bin/Makefile.in
@BIND9_MAKE_RULES@ @BIND9_MAKE_RULES@
diff -up bind-9.8.0rc1/bin/named/Makefile.in.sdb bind-9.8.0rc1/bin/named/Makefile.in diff -up bind-9.8.0rc1/bin/named/Makefile.in.sdb bind-9.8.0rc1/bin/named/Makefile.in
--- bind-9.8.0rc1/bin/named/Makefile.in.sdb 2011-02-21 16:28:51.618648508 +0100 --- bind-9.8.0rc1/bin/named/Makefile.in.sdb 2011-02-22 16:02:55.899255772 +0100
+++ bind-9.8.0rc1/bin/named/Makefile.in 2011-02-21 16:29:11.808606048 +0100 +++ bind-9.8.0rc1/bin/named/Makefile.in 2011-02-22 16:03:32.580297210 +0100
@@ -45,7 +45,7 @@ CINCLUDES = -I${srcdir}/include -I${srcd @@ -45,7 +45,7 @@ CINCLUDES = -I${srcdir}/include -I${srcd
${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \ ${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES} @DST_OPENSSL_INC@ ${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES} @DST_OPENSSL_INC@
-CDEFINES = @USE_DLZ@ @USE_PKCS11@ @USE_OPENSSL@ -CDEFINES = @USE_DLZ@ @USE_PKCS11@ @USE_OPENSSL@ @LIBNMSERVER_CPPFLAGS@
+CDEFINES = @USE_PKCS11@ @USE_OPENSSL@ +CDEFINES = @USE_PKCS11@ @USE_OPENSSL@ @LIBNMSERVER_CPPFLAGS@
CWARNINGS = CWARNINGS =
@ -28,13 +28,13 @@ diff -up bind-9.8.0rc1/bin/named/Makefile.in.sdb bind-9.8.0rc1/bin/named/Makefil
LIBS = ${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \ LIBS = ${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \
${ISCCFGLIBS} ${ISCCCLIBS} ${ISCLIBS} \ ${ISCCFGLIBS} ${ISCCCLIBS} ${ISCLIBS} \
- ${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBS@ - ${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBNMSERVER_LIBS@ @LIBS@
+ @LIBS@ + @LIBNMSERVER_LIBS@ @LIBS@
NOSYMLIBS = ${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \ NOSYMLIBS = ${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \
${ISCCFGLIBS} ${ISCCCLIBS} ${ISCNOSYMLIBS} \ ${ISCCFGLIBS} ${ISCCCLIBS} ${ISCNOSYMLIBS} \
- ${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBS@ - ${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBNMSERVER_LIBS@ @LIBS@
+ @LIBS@ + @LIBNMSERVER_LIBS@ @LIBS@
SUBDIRS = unix SUBDIRS = unix
@ -65,8 +65,8 @@ diff -up bind-9.8.0rc1/bin/named/Makefile.in.sdb bind-9.8.0rc1/bin/named/Makefil
- -
-@DLZ_DRIVER_RULES@ -@DLZ_DRIVER_RULES@
diff -up bind-9.8.0rc1/bin/named-sdb/main.c.sdb bind-9.8.0rc1/bin/named-sdb/main.c diff -up bind-9.8.0rc1/bin/named-sdb/main.c.sdb bind-9.8.0rc1/bin/named-sdb/main.c
--- bind-9.8.0rc1/bin/named-sdb/main.c.sdb 2011-02-21 16:28:51.638648466 +0100 --- bind-9.8.0rc1/bin/named-sdb/main.c.sdb 2011-02-22 16:02:55.919256342 +0100
+++ bind-9.8.0rc1/bin/named-sdb/main.c 2011-02-21 16:28:51.678648382 +0100 +++ bind-9.8.0rc1/bin/named-sdb/main.c 2011-02-22 16:02:56.029259468 +0100
@@ -81,6 +81,9 @@ @@ -81,6 +81,9 @@
* Include header files for database drivers here. * Include header files for database drivers here.
*/ */
@ -77,7 +77,7 @@ diff -up bind-9.8.0rc1/bin/named-sdb/main.c.sdb bind-9.8.0rc1/bin/named-sdb/main
/* /*
* Include DLZ drivers if appropriate. * Include DLZ drivers if appropriate.
@@ -784,6 +787,10 @@ setup(void) { @@ -787,6 +790,10 @@ setup(void) {
ns_main_earlyfatal("isc_app_start() failed: %s", ns_main_earlyfatal("isc_app_start() failed: %s",
isc_result_totext(result)); isc_result_totext(result));
@ -88,7 +88,7 @@ diff -up bind-9.8.0rc1/bin/named-sdb/main.c.sdb bind-9.8.0rc1/bin/named-sdb/main
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
ISC_LOG_NOTICE, "starting BIND %s%s", ns_g_version, ISC_LOG_NOTICE, "starting BIND %s%s", ns_g_version,
saved_command_line); saved_command_line);
@@ -867,6 +874,57 @@ setup(void) { @@ -870,6 +877,57 @@ setup(void) {
isc_result_totext(result)); isc_result_totext(result));
#endif #endif
@ -146,7 +146,7 @@ diff -up bind-9.8.0rc1/bin/named-sdb/main.c.sdb bind-9.8.0rc1/bin/named-sdb/main
ns_server_create(ns_g_mctx, &ns_g_server); ns_server_create(ns_g_mctx, &ns_g_server);
} }
@@ -894,6 +952,10 @@ cleanup(void) { @@ -897,6 +955,10 @@ cleanup(void) {
dns_name_destroy(); dns_name_destroy();
@ -158,8 +158,8 @@ diff -up bind-9.8.0rc1/bin/named-sdb/main.c.sdb bind-9.8.0rc1/bin/named-sdb/main
ISC_LOG_NOTICE, "exiting"); ISC_LOG_NOTICE, "exiting");
ns_log_shutdown(); ns_log_shutdown();
diff -up bind-9.8.0rc1/bin/named-sdb/Makefile.in.sdb bind-9.8.0rc1/bin/named-sdb/Makefile.in diff -up bind-9.8.0rc1/bin/named-sdb/Makefile.in.sdb bind-9.8.0rc1/bin/named-sdb/Makefile.in
--- bind-9.8.0rc1/bin/named-sdb/Makefile.in.sdb 2011-02-21 16:28:51.628648487 +0100 --- bind-9.8.0rc1/bin/named-sdb/Makefile.in.sdb 2011-02-22 16:02:55.909256065 +0100
+++ bind-9.8.0rc1/bin/named-sdb/Makefile.in 2011-02-21 16:28:51.678648382 +0100 +++ bind-9.8.0rc1/bin/named-sdb/Makefile.in 2011-02-22 16:02:56.029259468 +0100
@@ -28,10 +28,10 @@ top_srcdir = @top_srcdir@ @@ -28,10 +28,10 @@ top_srcdir = @top_srcdir@
# #
# Add database drivers here. # Add database drivers here.
@ -210,9 +210,9 @@ diff -up bind-9.8.0rc1/bin/named-sdb/Makefile.in.sdb bind-9.8.0rc1/bin/named-sdb
@DLZ_DRIVER_RULES@ @DLZ_DRIVER_RULES@
diff -up bind-9.8.0rc1/configure.in.sdb bind-9.8.0rc1/configure.in diff -up bind-9.8.0rc1/configure.in.sdb bind-9.8.0rc1/configure.in
--- bind-9.8.0rc1/configure.in.sdb 2011-02-03 06:50:05.000000000 +0100 --- bind-9.8.0rc1/configure.in.sdb 2011-02-22 16:02:55.899255772 +0100
+++ bind-9.8.0rc1/configure.in 2011-02-21 16:30:15.788470563 +0100 +++ bind-9.8.0rc1/configure.in 2011-02-22 16:02:56.029259468 +0100
@@ -3285,9 +3285,12 @@ AC_CONFIG_FILES([ @@ -3308,9 +3308,12 @@ AC_CONFIG_FILES([
bin/dnssec/Makefile bin/dnssec/Makefile
bin/named/Makefile bin/named/Makefile
bin/named/unix/Makefile bin/named/unix/Makefile

View File

@ -22,7 +22,7 @@ Summary: The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) serv
Name: bind Name: bind
License: ISC License: ISC
Version: 9.8.0 Version: 9.8.0
Release: 0.2.%{PREVER}%{?dist} Release: 0.3.%{PREVER}%{?dist}
Epoch: 32 Epoch: 32
Url: http://www.isc.org/products/BIND/ Url: http://www.isc.org/products/BIND/
Buildroot:%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Buildroot:%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -65,6 +65,7 @@ Patch113:bind97-rh674334.patch
Patch114:bind97-rh665971.patch Patch114:bind97-rh665971.patch
Patch115:bind97-cleanup.patch Patch115:bind97-cleanup.patch
Patch116:bind98-includes.patch Patch116:bind98-includes.patch
Patch117:bind98-libnm.patch
# SDB patches # SDB patches
Patch11: bind-9.3.2b2-sdbsrc.patch Patch11: bind-9.3.2b2-sdbsrc.patch
@ -248,6 +249,7 @@ Based on the code from Jan "Yenya" Kasprzak <kas@fi.muni.cz>
%patch10 -p1 -b .PIE %patch10 -p1 -b .PIE
%patch16 -p1 -b .redhat_doc %patch16 -p1 -b .redhat_doc
%patch104 -p1 -b .dyndb %patch104 -p1 -b .dyndb
%patch117 -p1 -b .libnm
%if %{SDB} %if %{SDB}
%patch101 -p1 -b .old-api %patch101 -p1 -b .old-api
mkdir bin/named-sdb mkdir bin/named-sdb
@ -350,6 +352,7 @@ libtoolize -c -f; aclocal -I m4 --force; autoconf -f
--with-gssapi=yes \ --with-gssapi=yes \
--disable-isc-spnego \ --disable-isc-spnego \
%endif %endif
--with-libnmserver=yes \
; ;
make %{?_smp_mflags} make %{?_smp_mflags}
@ -772,6 +775,9 @@ rm -rf ${RPM_BUILD_ROOT}
%endif %endif
%changelog %changelog
* Tue Feb 22 2011 Adam Tkac <atkac redhat com> 32:9.8.0-0.3.rc1
- integrate named with libnmserver library
* Tue Feb 22 2011 Adam Tkac <atkac redhat com> 32:9.8.0-0.2.rc1 * Tue Feb 22 2011 Adam Tkac <atkac redhat com> 32:9.8.0-0.2.rc1
- include dns/rpz.h in -devel subpkg - include dns/rpz.h in -devel subpkg

323
bind98-libnm.patch Normal file
View File

@ -0,0 +1,323 @@
diff -up bind-9.8.0rc1/bin/named/include/named/globals.h.libnm bind-9.8.0rc1/bin/named/include/named/globals.h
--- bind-9.8.0rc1/bin/named/include/named/globals.h.libnm 2011-02-22 16:08:19.538575568 +0100
+++ bind-9.8.0rc1/bin/named/include/named/globals.h 2011-02-22 16:08:37.779101415 +0100
@@ -151,6 +151,7 @@ EXTERN isc_boolean_t ns_g_memstatistics
EXTERN isc_boolean_t ns_g_clienttest INIT(ISC_FALSE);
EXTERN isc_boolean_t ns_g_nosoa INIT(ISC_FALSE);
EXTERN isc_boolean_t ns_g_noaa INIT(ISC_FALSE);
+EXTERN isc_boolean_t ns_g_libnm INIT(ISC_FALSE);
#undef EXTERN
#undef INIT
diff -up bind-9.8.0rc1/bin/named/include/named/server.h.libnm bind-9.8.0rc1/bin/named/include/named/server.h
--- bind-9.8.0rc1/bin/named/include/named/server.h.libnm 2011-02-22 16:09:03.039788866 +0100
+++ bind-9.8.0rc1/bin/named/include/named/server.h 2011-02-22 16:10:40.552722679 +0100
@@ -34,9 +34,12 @@
#include <named/types.h>
+#include <libnmserver/libnmserver.h>
+
#define NS_EVENTCLASS ISC_EVENTCLASS(0x4E43)
#define NS_EVENT_RELOAD (NS_EVENTCLASS + 0)
#define NS_EVENT_CLIENTCONTROL (NS_EVENTCLASS + 1)
+#define NS_EVENT_NSEVENT (NS_EVENTCLASS + 2)
/*%
* Name server state. Better here than in lots of separate global variables.
@@ -114,6 +117,8 @@ struct ns_server {
dns_name_t *session_keyname;
unsigned int session_keyalg;
isc_uint16_t session_keybits;
+
+ nmserver_control_t *nmcontrol;
};
#define NS_SERVER_MAGIC ISC_MAGIC('S','V','E','R')
diff -up bind-9.8.0rc1/bin/named/main.c.libnm bind-9.8.0rc1/bin/named/main.c
--- bind-9.8.0rc1/bin/named/main.c.libnm 2011-02-22 16:06:25.835268500 +0100
+++ bind-9.8.0rc1/bin/named/main.c 2011-02-22 16:06:25.845268792 +0100
@@ -416,7 +416,7 @@ parse_command_line(int argc, char *argv[
isc_commandline_errprint = ISC_FALSE;
while ((ch = isc_commandline_parse(argc, argv,
- "46c:C:d:E:fFgi:lm:n:N:p:P:"
+ "46c:C:d:DE:fFgi:lm:n:N:p:P:"
"sS:t:T:u:vVx:")) != -1) {
switch (ch) {
case '4':
@@ -448,6 +448,9 @@ parse_command_line(int argc, char *argv[
ns_main_earlyfatal("cannot specify -c and -C");
lwresd_g_useresolvconf = ISC_TRUE;
break;
+ case 'D':
+ ns_g_libnm = ISC_TRUE;
+ break;
case 'd':
ns_g_debuglevel = parse_int(isc_commandline_argument,
"debug level");
diff -up bind-9.8.0rc1/bin/named/Makefile.in.libnm bind-9.8.0rc1/bin/named/Makefile.in
--- bind-9.8.0rc1/bin/named/Makefile.in.libnm 2011-02-22 16:06:25.835268500 +0100
+++ bind-9.8.0rc1/bin/named/Makefile.in 2011-02-22 16:06:25.945271687 +0100
@@ -45,7 +45,7 @@ CINCLUDES = -I${srcdir}/include -I${srcd
${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES} @DST_OPENSSL_INC@
-CDEFINES = @USE_DLZ@ @USE_PKCS11@ @USE_OPENSSL@
+CDEFINES = @USE_DLZ@ @USE_PKCS11@ @USE_OPENSSL@ @LIBNMSERVER_CPPFLAGS@
CWARNINGS =
@@ -69,11 +69,11 @@ DEPLIBS = ${LWRESDEPLIBS} ${DNSDEPLIBS}
LIBS = ${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \
${ISCCFGLIBS} ${ISCCCLIBS} ${ISCLIBS} \
- ${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBS@
+ ${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBNMSERVER_LIBS@ @LIBS@
NOSYMLIBS = ${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \
${ISCCFGLIBS} ${ISCCCLIBS} ${ISCNOSYMLIBS} \
- ${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBS@
+ ${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBNMSERVER_LIBS@ @LIBS@
SUBDIRS = unix
diff -up bind-9.8.0rc1/bin/named/server.c.libnm bind-9.8.0rc1/bin/named/server.c
--- bind-9.8.0rc1/bin/named/server.c.libnm 2011-02-22 16:06:25.845268792 +0100
+++ bind-9.8.0rc1/bin/named/server.c 2011-02-22 16:06:26.065275159 +0100
@@ -111,6 +111,8 @@
#include <stdlib.h>
#endif
+#include <libnmserver/libnmserver.h>
+
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
@@ -216,6 +218,12 @@ struct cfg_context {
cfg_aclconfctx_t actx;
};
+typedef struct nmserver_nsevent {
+ ISC_EVENT_COMMON(struct nmserver_nsevent);
+ ns_server_t *server;
+ isc_sockaddrlist_t *fwds;
+} nmserver_nsevent_t;
+
/*
* These zones should not leak onto the Internet.
*/
@@ -2366,9 +2372,15 @@ configure_view(dns_view_t *view, cfg_par
forwarders = NULL;
(void)ns_config_get(maps, "forward", &forwardtype);
(void)ns_config_get(maps, "forwarders", &forwarders);
- if (forwarders != NULL)
+ if (forwarders != NULL) {
+ if (ns_g_libnm)
+ fatal("Cannot use \"forwarders\" directive and "
+ "\"-D\" parameter simultaneously",
+ ISC_R_FAILURE);
+
CHECK(configure_forward(config, view, dns_rootname,
forwarders, forwardtype));
+ }
/*
* Dual Stack Servers.
@@ -5161,6 +5173,126 @@ load_new_zones(ns_server_t *server, isc_
}
static void
+nmserver_errcallback(nmserver_result_t result) {
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
+ ISC_LOG_ERROR, "got error from libnmserver: %d", result);
+}
+
+static void
+update_forwarders(isc_task_t *task, isc_event_t *event) {
+ isc_result_t result;
+ dns_view_t *view;
+ isc_sockaddr_t *sa;
+ nmserver_nsevent_t *nsevent = (nmserver_nsevent_t *)event;
+ ns_server_t *server = nsevent->server;
+ isc_sockaddrlist_t *salist = nsevent->fwds;
+
+ INSIST(task = server->task);
+
+ result = isc_task_beginexclusive(server->task);
+ RUNTIME_CHECK(result == ISC_R_SUCCESS);
+
+ /* Update forwarders in all views */
+ for (view = ISC_LIST_HEAD(server->viewlist);
+ view != NULL;
+ view = ISC_LIST_NEXT(view, link)) {
+ (void) dns_fwdtable_delete(view->fwdtable, dns_rootname);
+
+ CHECKFATAL(dns_fwdtable_add(view->fwdtable, dns_rootname,
+ salist, dns_fwdpolicy_only),
+ "adding forwarders from libnmserver");
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
+ ISC_LOG_ERROR, "forwarder added");
+ }
+
+ isc_task_endexclusive(server->task);
+
+ while (!ISC_LIST_EMPTY(*salist)) {
+ sa = ISC_LIST_HEAD(*salist);
+ ISC_LIST_UNLINK(*salist, sa, link);
+ isc_mem_put(server->mctx, sa, sizeof(*sa));
+ }
+ isc_mem_put(server->mctx, salist, sizeof(*salist));
+ isc_mem_put(server->mctx, nsevent, sizeof(*nsevent));
+}
+
+static void
+nmserver_nscallback(in_addr_t *servers, void *data) {
+ in_addr_t *ptr;
+ isc_sockaddr_t *sa;
+ isc_sockaddrlist_t *salist;
+ char str[ISC_SOCKADDR_FORMATSIZE];
+ nmserver_nsevent_t *nsevent;
+ isc_result_t result = ISC_R_SUCCESS;
+ ns_server_t *server = (ns_server_t *)data;
+
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
+ ISC_LOG_ERROR, "got servers");
+
+ salist = isc_mem_get(server->mctx, sizeof(*salist));
+ if (salist == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+ ISC_LIST_INIT(*salist);
+
+ for (ptr = servers; *ptr != 0; ptr++) {
+ sa = isc_mem_get(server->mctx, sizeof(*sa));
+ if (sa == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+#if 0
+ in_addr_t asd;
+ asd = htonl(10L << 24 | 34L << 16 | 255L << 8 | 7);
+ isc_sockaddr_fromin(sa, (struct in_addr *) &asd, 53);
+#endif
+ isc_sockaddr_fromin(sa, (struct in_addr *)ptr, 53);
+ isc_sockaddr_format(sa, str, ISC_SOCKADDR_FORMATSIZE);
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
+ ISC_LOG_ERROR, "got forwarder %s", str);
+
+ ISC_LINK_INIT(sa, link);
+ ISC_LIST_APPEND(*salist, sa, link);
+ }
+
+ nsevent = (nmserver_nsevent_t *)
+ isc_event_allocate(ns_g_mctx, server,
+ NS_EVENT_NSEVENT,
+ update_forwarders,
+ NULL,
+ sizeof(*nsevent));
+ if (nsevent == NULL) {
+ result = ISC_R_NOMEMORY;
+ goto cleanup;
+ }
+
+ nsevent->server = server;
+ nsevent->fwds = salist;
+ isc_task_send(server->task, ISC_EVENT_PTR(&nsevent));
+ result = ISC_R_SUCCESS;
+
+cleanup:
+
+ if (result == ISC_R_SUCCESS)
+ return;
+
+ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
+ NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
+ "Failed to obtain forwarders from libnmserver "
+ "library: %s", isc_result_totext(result));
+
+ if (salist != NULL) {
+ while (!ISC_LIST_EMPTY(*salist)) {
+ sa = ISC_LIST_HEAD(*salist);
+ ISC_LIST_UNLINK(*salist, sa, link);
+ isc_mem_put(server->mctx, sa, sizeof(*sa));
+ }
+ isc_mem_put(server->mctx, salist, sizeof(*salist));
+ }
+}
+
+static void
run_server(isc_task_t *task, isc_event_t *event) {
isc_result_t result;
ns_server_t *server = (ns_server_t *)event->ev_arg;
@@ -5212,6 +5344,25 @@ run_server(isc_task_t *task, isc_event_t
CHECKFATAL(load_zones(server, ISC_FALSE), "loading zones");
+ ns_g_server->nmcontrol = NULL;
+ if (ns_g_libnm) {
+ nmserver_control_t *control = NULL;
+ nmserver_result_t result;
+
+ result = nmserver_control_create(&control, server);
+ if (result != NMSERVER_R_OK)
+ fatal("loading libnmserver library", ISC_R_FAILURE);
+
+ nmserver_nscallback_register(control, &nmserver_nscallback);
+ nmserver_errcallback_register(control, &nmserver_errcallback);
+
+ result = nmserver_threaded_run(control);
+ if (result != NMSERVER_R_OK)
+ fatal("starting libnmserver library", ISC_R_FAILURE);
+
+ ns_g_server->nmcontrol = control;
+ }
+
ns_os_started();
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
ISC_LOG_NOTICE, "running");
@@ -5251,6 +5402,9 @@ shutdown_server(isc_task_t *task, isc_ev
cfg_obj_destroy(ns_g_parser, &ns_g_config);
cfg_parser_destroy(&ns_g_parser);
+ if (ns_g_server->nmcontrol)
+ nmserver_control_destroy(&ns_g_server->nmcontrol);
+
for (view = ISC_LIST_HEAD(server->viewlist);
view != NULL;
view = view_next) {
diff -up bind-9.8.0rc1/configure.in.libnm bind-9.8.0rc1/configure.in
--- bind-9.8.0rc1/configure.in.libnm 2011-02-03 06:50:05.000000000 +0100
+++ bind-9.8.0rc1/configure.in 2011-02-22 16:06:26.025274000 +0100
@@ -3251,6 +3258,30 @@ for e in $DNS_CRYPTO_LIBS ; do
done
DNS_CRYPTO_LIBS="$NEWFLAGS"
+LIBNMSERVER_CPPFLAGS=
+LIBNMSERVER_LIBS=
+AC_MSG_CHECKING(for libnmserver support)
+AC_ARG_WITH(libnmserver,
+ [ --with-libnmserver, libnmserver support requires pkg-config],
+ use_libnmserver="$withval", use_libnmserver="no")
+case "$use_libnmserver" in
+ no)
+ AC_MSG_RESULT(no)
+ ;;
+ yes)
+ AC_MSG_RESULT(yes)
+ AC_PATH_PROG(PKGCONFIG, pkg-config)
+ LIBNMSERVER_CPPFLAGS=`$PKGCONFIG libnmserver --cflags`
+ LIBNMSERVER_LIBS=`$PKGCONFIG libnmserver --libs`
+ ;;
+ *)
+ AC_MSG_ERROR(Specify yes or no)
+ ;;
+esac
+
+AC_SUBST(LIBNMSERVER_CPPFLAGS)
+AC_SUBST(LIBNMSERVER_LIBS)
+
AC_SUBST(BUILD_CC)
AC_SUBST(BUILD_CFLAGS)
AC_SUBST(BUILD_CPPFLAGS)