Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
25f53937b4 | ||
|
|
06427720f7 | ||
|
|
d0a59277fb |
@@ -13,7 +13,6 @@ AM_CPPFLAGS += \
|
||||
$(MAXMINDDB_CFLAGS) \
|
||||
$(DNSTAP_CFLAGS) \
|
||||
$(LIBUV_CFLAGS) \
|
||||
$(LIBSYSTEMD_CFLAGS) \
|
||||
$(ZLIB_CFLAGS)
|
||||
|
||||
if HAVE_JSON_C
|
||||
@@ -108,7 +107,6 @@ named_LDADD = \
|
||||
$(MAXMINDDB_LIBS) \
|
||||
$(DNSTAP_LIBS) \
|
||||
$(LIBUV_LIBS) \
|
||||
$(LIBSYSTEMD_LIBS) \
|
||||
$(ZLIB_LIBS)
|
||||
|
||||
if HAVE_JSON_C
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <pwd.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <isc/formatcheck.h>
|
||||
#include <isc/types.h>
|
||||
|
||||
void
|
||||
@@ -73,3 +74,15 @@ named_os_started(void);
|
||||
|
||||
const char *
|
||||
named_os_uname(void);
|
||||
|
||||
#ifdef __linux__
|
||||
void
|
||||
named_os_notify_systemd(const char *restrict format, ...)
|
||||
ISC_FORMAT_PRINTF(1, 2);
|
||||
|
||||
void
|
||||
named_os_notify_close(void);
|
||||
#else /* __linux__ */
|
||||
#define named_os_notify_systemd(...)
|
||||
#define named_os_notify_close(...)
|
||||
#endif /* __linux__ */
|
||||
|
||||
+123
@@ -36,6 +36,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/errno.h>
|
||||
#include <isc/file.h>
|
||||
#include <isc/result.h>
|
||||
#include <isc/strerr.h>
|
||||
@@ -60,6 +61,7 @@ static int devnullfd = -1;
|
||||
static struct passwd *runas_pw = NULL;
|
||||
static bool done_setuid = false;
|
||||
static int dfd[2] = { -1, -1 };
|
||||
static int notify_fd = -1;
|
||||
|
||||
static uid_t saved_uid = (uid_t)-1;
|
||||
static gid_t saved_gid = (gid_t)-1;
|
||||
@@ -273,6 +275,80 @@ setperms(uid_t uid, gid_t gid) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
static isc_result_t
|
||||
connect_systemd_notify_unix(char *path) {
|
||||
struct sockaddr_un addr = { .sun_family = AF_UNIX };
|
||||
size_t len;
|
||||
|
||||
addr = (struct sockaddr_un){
|
||||
.sun_family = AF_UNIX,
|
||||
};
|
||||
|
||||
len = strlcpy(addr.sun_path, path, sizeof(addr.sun_path));
|
||||
if (len >= sizeof(addr.sun_path)) {
|
||||
return ISC_R_NOSPACE;
|
||||
}
|
||||
|
||||
/* Convert abstract unix sockets */
|
||||
if (addr.sun_path[0] == '@') {
|
||||
addr.sun_path[0] = '\0';
|
||||
}
|
||||
|
||||
notify_fd = socket(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0);
|
||||
if (notify_fd < 0) {
|
||||
return isc_errno_toresult(errno);
|
||||
}
|
||||
|
||||
if (connect(notify_fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
|
||||
close(notify_fd);
|
||||
notify_fd = -1;
|
||||
return isc_errno_toresult(errno);
|
||||
}
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
setup_systemd_notify(void) {
|
||||
isc_result_t result;
|
||||
char *path;
|
||||
|
||||
REQUIRE(notify_fd == -1);
|
||||
|
||||
path = getenv("NOTIFY_SOCKET");
|
||||
|
||||
/* systemd notification is not set, oh well. */
|
||||
if (path == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (path[0] == '/' || path[0] == '@') {
|
||||
result = connect_systemd_notify_unix(path);
|
||||
} else if (strncmp(path, "vsock", 5) == 0) {
|
||||
result = ISC_R_FAMILYNOSUPPORT;
|
||||
} else {
|
||||
result = ISC_R_INVALIDPROTO;
|
||||
}
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
RUNTIME_CHECK(notify_fd == -1);
|
||||
isc_log_write(
|
||||
NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_WARNING,
|
||||
"failed to connect to notification socket '%s': %s",
|
||||
path, isc_result_totext(result));
|
||||
} else {
|
||||
RUNTIME_CHECK(notify_fd != -1);
|
||||
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_INFO,
|
||||
"connected to notification socket '%s'", path);
|
||||
}
|
||||
}
|
||||
#else /* __linux__ */
|
||||
#define setup_systemd_notify(...)
|
||||
#endif /* __linux__ */
|
||||
|
||||
static void
|
||||
setup_syslog(const char *progname) {
|
||||
int options;
|
||||
@@ -287,6 +363,7 @@ setup_syslog(const char *progname) {
|
||||
void
|
||||
named_os_init(const char *progname) {
|
||||
setup_syslog(progname);
|
||||
setup_systemd_notify();
|
||||
#if HAVE_LIBCAP
|
||||
linux_initialprivs();
|
||||
#endif /* HAVE_LIBCAP */
|
||||
@@ -362,6 +439,13 @@ named_os_daemonize(void) {
|
||||
(void)dup2(devnullfd, STDERR_FILENO);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Will be closed from SOCK_CLOEXEC but should be set to -1 again before
|
||||
* reconnecting to the notification socket.
|
||||
*/
|
||||
notify_fd = -1;
|
||||
setup_systemd_notify();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -865,3 +949,42 @@ named_os_uname(void) {
|
||||
}
|
||||
return unamep;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
void
|
||||
named_os_notify_systemd(const char *restrict format, ...) {
|
||||
char buffer[512];
|
||||
va_list ap;
|
||||
int len;
|
||||
|
||||
if (notify_fd == -1 || format == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
va_start(ap, format);
|
||||
len = vsnprintf(NULL, 0, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
/* Be very loud if notification is too long */
|
||||
RUNTIME_CHECK(len >= 0);
|
||||
|
||||
va_start(ap, format);
|
||||
len = vsnprintf(buffer, sizeof(buffer), format, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (write(notify_fd, buffer, len) == -1) {
|
||||
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_ERROR,
|
||||
"failed writing to notification socket '%s'",
|
||||
isc_result_totext(isc_errno_toresult(errno)));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
named_os_notify_close(void) {
|
||||
if (notify_fd != -1) {
|
||||
close(notify_fd);
|
||||
notify_fd = -1;
|
||||
}
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
|
||||
+24
-48
@@ -28,10 +28,6 @@
|
||||
#include <fstrm.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBSYSTEMD
|
||||
#include <systemd/sd-daemon.h>
|
||||
#endif
|
||||
|
||||
#include <isc/async.h>
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/base64.h>
|
||||
@@ -9389,13 +9385,10 @@ view_loaded(void *arg) {
|
||||
ISC_LOG_NOTICE, "FIPS mode is %s",
|
||||
isc_crypto_fips_mode() ? "enabled" : "disabled");
|
||||
|
||||
#if HAVE_LIBSYSTEMD
|
||||
sd_notifyf(0,
|
||||
"READY=1\n"
|
||||
"STATUS=running\n"
|
||||
"MAINPID=%" PRId64 "\n",
|
||||
(int64_t)getpid());
|
||||
#endif /* HAVE_LIBSYSTEMD */
|
||||
named_os_notify_systemd("READY=1\n"
|
||||
"STATUS=running\n"
|
||||
"MAINPID=%" PRId64 "\n",
|
||||
(int64_t)getpid());
|
||||
|
||||
atomic_store(&server->reload_status, NAMED_RELOAD_DONE);
|
||||
|
||||
@@ -9534,9 +9527,8 @@ shutdown_server(void *arg) {
|
||||
bool flush = server->flushonshutdown;
|
||||
named_cache_t *nsc = NULL;
|
||||
|
||||
#if HAVE_LIBSYSTEMD
|
||||
sd_notify(0, "STOPPING=1\n");
|
||||
#endif /* HAVE_LIBSYSTEMD */
|
||||
named_os_notify_systemd("STOPPING=1\n");
|
||||
named_os_notify_close();
|
||||
|
||||
isc_signal_stop(server->sighup);
|
||||
isc_signal_destroy(&server->sighup);
|
||||
@@ -10028,17 +10020,11 @@ reload(named_server_t *server) {
|
||||
isc_result_t result;
|
||||
|
||||
atomic_store(&server->reload_status, NAMED_RELOAD_IN_PROGRESS);
|
||||
#if HAVE_LIBSYSTEMD
|
||||
char buf[512];
|
||||
int n = snprintf(buf, sizeof(buf),
|
||||
"RELOADING=1\n"
|
||||
"MONOTONIC_USEC=%" PRIu64 "\n"
|
||||
"STATUS=reload command received\n",
|
||||
(uint64_t)isc_time_monotonic() / NS_PER_US);
|
||||
if (n > 0 && (size_t)n < sizeof(buf)) {
|
||||
sd_notify(0, buf);
|
||||
}
|
||||
#endif /* HAVE_LIBSYSTEMD */
|
||||
|
||||
named_os_notify_systemd("RELOADING=1\n"
|
||||
"MONOTONIC_USEC=%" PRIu64 "\n"
|
||||
"STATUS=reload command received\n",
|
||||
(uint64_t)isc_time_monotonic() / NS_PER_US);
|
||||
|
||||
CHECK(loadconfig(server));
|
||||
|
||||
@@ -10053,12 +10039,10 @@ reload(named_server_t *server) {
|
||||
atomic_store(&server->reload_status, NAMED_RELOAD_FAILED);
|
||||
}
|
||||
cleanup:
|
||||
#if HAVE_LIBSYSTEMD
|
||||
sd_notifyf(0,
|
||||
"READY=1\n"
|
||||
"STATUS=reload command finished: %s\n",
|
||||
isc_result_totext(result));
|
||||
#endif /* HAVE_LIBSYSTEMD */
|
||||
named_os_notify_systemd("READY=1\n"
|
||||
"STATUS=reload command finished: %s\n",
|
||||
isc_result_totext(result));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -10481,17 +10465,11 @@ isc_result_t
|
||||
named_server_reconfigcommand(named_server_t *server) {
|
||||
isc_result_t result;
|
||||
atomic_store(&server->reload_status, NAMED_RELOAD_IN_PROGRESS);
|
||||
#if HAVE_LIBSYSTEMD
|
||||
char buf[512];
|
||||
int n = snprintf(buf, sizeof(buf),
|
||||
"RELOADING=1\n"
|
||||
"MONOTONIC_USEC=%" PRIu64 "\n"
|
||||
"STATUS=reconfig command received\n",
|
||||
(uint64_t)isc_time_monotonic() / NS_PER_US);
|
||||
if (n > 0 && (size_t)n < sizeof(buf)) {
|
||||
sd_notify(0, buf);
|
||||
}
|
||||
#endif /* HAVE_LIBSYSTEMD */
|
||||
|
||||
named_os_notify_systemd("RELOADING=1\n"
|
||||
"MONOTONIC_USEC=%" PRIu64 "\n"
|
||||
"STATUS=reconfig command received\n",
|
||||
(uint64_t)isc_time_monotonic() / NS_PER_US);
|
||||
|
||||
CHECK(loadconfig(server));
|
||||
|
||||
@@ -10506,12 +10484,10 @@ named_server_reconfigcommand(named_server_t *server) {
|
||||
atomic_store(&server->reload_status, NAMED_RELOAD_FAILED);
|
||||
}
|
||||
cleanup:
|
||||
#if HAVE_LIBSYSTEMD
|
||||
sd_notifyf(0,
|
||||
"READY=1\n"
|
||||
"STATUS=reconfig command finished: %s\n",
|
||||
isc_result_totext(result));
|
||||
#endif /* HAVE_LIBSYSTEMD */
|
||||
named_os_notify_systemd("READY=1\n"
|
||||
"STATUS=reconfig command finished: %s\n",
|
||||
isc_result_totext(result));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1603,7 +1603,7 @@ xfrin_xmlrender(dns_zone_t *zone, void *arg) {
|
||||
isc_sockaddr_format(addrp, addr_buf, sizeof(addr_buf));
|
||||
TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR addr_buf));
|
||||
} else if (is_presoa) {
|
||||
addr = dns_zone_getsourceaddr(zone);
|
||||
dns_zone_getsourceaddr(zone, &addr);
|
||||
isc_sockaddr_format(&addr, addr_buf, sizeof(addr_buf));
|
||||
TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR addr_buf));
|
||||
} else {
|
||||
@@ -2660,7 +2660,7 @@ xfrin_jsonrender(dns_zone_t *zone, void *arg) {
|
||||
json_object_object_add(xfrinobj, "localaddr",
|
||||
json_object_new_string(addr_buf));
|
||||
} else if (is_presoa) {
|
||||
addr = dns_zone_getsourceaddr(zone);
|
||||
dns_zone_getsourceaddr(zone, &addr);
|
||||
isc_sockaddr_format(&addr, addr_buf, sizeof(addr_buf));
|
||||
json_object_object_add(xfrinobj, "localaddr",
|
||||
json_object_new_string(addr_buf));
|
||||
|
||||
@@ -1279,22 +1279,22 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
||||
obj = NULL;
|
||||
result = named_config_get(maps, "parental-source", &obj);
|
||||
INSIST(result == ISC_R_SUCCESS && obj != NULL);
|
||||
CHECK(dns_zone_setparentalsrc4(zone, cfg_obj_assockaddr(obj)));
|
||||
dns_zone_setparentalsrc4(zone, cfg_obj_assockaddr(obj));
|
||||
|
||||
obj = NULL;
|
||||
result = named_config_get(maps, "parental-source-v6", &obj);
|
||||
INSIST(result == ISC_R_SUCCESS && obj != NULL);
|
||||
CHECK(dns_zone_setparentalsrc6(zone, cfg_obj_assockaddr(obj)));
|
||||
dns_zone_setparentalsrc6(zone, cfg_obj_assockaddr(obj));
|
||||
|
||||
obj = NULL;
|
||||
result = named_config_get(maps, "notify-source", &obj);
|
||||
INSIST(result == ISC_R_SUCCESS && obj != NULL);
|
||||
CHECK(dns_zone_setnotifysrc4(zone, cfg_obj_assockaddr(obj)));
|
||||
dns_zone_setnotifysrc4(zone, cfg_obj_assockaddr(obj));
|
||||
|
||||
obj = NULL;
|
||||
result = named_config_get(maps, "notify-source-v6", &obj);
|
||||
INSIST(result == ISC_R_SUCCESS && obj != NULL);
|
||||
CHECK(dns_zone_setnotifysrc6(zone, cfg_obj_assockaddr(obj)));
|
||||
dns_zone_setnotifysrc6(zone, cfg_obj_assockaddr(obj));
|
||||
|
||||
obj = NULL;
|
||||
result = named_config_get(maps, "notify-to-soa", &obj);
|
||||
@@ -1938,14 +1938,12 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
|
||||
obj = NULL;
|
||||
result = named_config_get(maps, "transfer-source", &obj);
|
||||
INSIST(result == ISC_R_SUCCESS && obj != NULL);
|
||||
CHECK(dns_zone_setxfrsource4(mayberaw,
|
||||
cfg_obj_assockaddr(obj)));
|
||||
dns_zone_setxfrsource4(mayberaw, cfg_obj_assockaddr(obj));
|
||||
|
||||
obj = NULL;
|
||||
result = named_config_get(maps, "transfer-source-v6", &obj);
|
||||
INSIST(result == ISC_R_SUCCESS && obj != NULL);
|
||||
CHECK(dns_zone_setxfrsource6(mayberaw,
|
||||
cfg_obj_assockaddr(obj)));
|
||||
dns_zone_setxfrsource6(mayberaw, cfg_obj_assockaddr(obj));
|
||||
|
||||
obj = NULL;
|
||||
(void)named_config_get(maps, "try-tcp-refresh", &obj);
|
||||
|
||||
@@ -859,26 +859,6 @@ AS_CASE([$with_zlib],
|
||||
AC_SUBST([ZLIB_CFLAGS])
|
||||
AC_SUBST([ZLIB_LIBS])
|
||||
|
||||
#
|
||||
# was --with-libsystemd specified?
|
||||
#
|
||||
# [pairwise: --with-libsystemd=auto, --with-libsystemd=yes, --without-libsystemd]
|
||||
AC_ARG_WITH([libsystemd],
|
||||
[AS_HELP_STRING([--with-libsystemd],
|
||||
[build with libsystemd integration [default=auto]])],
|
||||
[], [with_libsystemd=auto])
|
||||
|
||||
AS_CASE([$with_libsystemd],
|
||||
[no],[],
|
||||
[auto],[PKG_CHECK_MODULES([LIBSYSTEMD], [libsystemd],
|
||||
[AC_DEFINE([HAVE_LIBSYSTEMD], [1], [Use libsystemd library])],
|
||||
[:])],
|
||||
[yes],[PKG_CHECK_MODULES([LIBSYSTEMD], [libsystemd],
|
||||
[AC_DEFINE([HAVE_LIBSYSTEMD], [1], [Use libsystemd library])])],
|
||||
[AC_MSG_ERROR([Specifying libsystemd installation path is not supported, adjust PKG_CONFIG_PATH instead])])
|
||||
AC_SUBST([LIBSYSTEMD_CFLAGS])
|
||||
AC_SUBST([LIBSYSTEMD_LIBS])
|
||||
|
||||
#
|
||||
# Check if the system supports glibc-compatible backtrace() function.
|
||||
#
|
||||
|
||||
+30
-41
@@ -818,7 +818,7 @@ dns_zone_setmaxretrytime(dns_zone_t *zone, uint32_t val);
|
||||
* val > 0.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
dns_zone_setxfrsource4(dns_zone_t *zone, const isc_sockaddr_t *xfrsource);
|
||||
/*%<
|
||||
* Set the source address to be used in IPv4 zone transfers.
|
||||
@@ -826,22 +826,20 @@ dns_zone_setxfrsource4(dns_zone_t *zone, const isc_sockaddr_t *xfrsource);
|
||||
* Require:
|
||||
*\li 'zone' to be a valid zone.
|
||||
*\li 'xfrsource' to contain the address.
|
||||
*
|
||||
* Returns:
|
||||
*\li #ISC_R_SUCCESS
|
||||
*/
|
||||
|
||||
isc_sockaddr_t *
|
||||
dns_zone_getxfrsource4(dns_zone_t *zone);
|
||||
void
|
||||
dns_zone_getxfrsource4(dns_zone_t *zone, isc_sockaddr_t *xfrsource);
|
||||
/*%<
|
||||
* Returns the source address set by a previous dns_zone_setxfrsource4
|
||||
* call, or the default of inaddr_any, port 0.
|
||||
*
|
||||
* Require:
|
||||
*\li 'zone' to be a valid zone.
|
||||
*\li 'xfrsource' to not be NULL
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
dns_zone_setxfrsource6(dns_zone_t *zone, const isc_sockaddr_t *xfrsource);
|
||||
/*%<
|
||||
* Set the source address to be used in IPv6 zone transfers.
|
||||
@@ -849,22 +847,20 @@ dns_zone_setxfrsource6(dns_zone_t *zone, const isc_sockaddr_t *xfrsource);
|
||||
* Require:
|
||||
*\li 'zone' to be a valid zone.
|
||||
*\li 'xfrsource' to contain the address.
|
||||
*
|
||||
* Returns:
|
||||
*\li #ISC_R_SUCCESS
|
||||
*/
|
||||
|
||||
isc_sockaddr_t *
|
||||
dns_zone_getxfrsource6(dns_zone_t *zone);
|
||||
void
|
||||
dns_zone_getxfrsource6(dns_zone_t *zone, isc_sockaddr_t *xfrsource);
|
||||
/*%<
|
||||
* Returns the source address set by a previous dns_zone_setxfrsource6
|
||||
* call, or the default of in6addr_any, port 0.
|
||||
*
|
||||
* Require:
|
||||
*\li 'zone' to be a valid zone.
|
||||
*\li 'xfrsource' to not be NULL
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
dns_zone_setparentalsrc4(dns_zone_t *zone, const isc_sockaddr_t *parentalsrc);
|
||||
/*%<
|
||||
* Set the source address to be used with IPv4 parental DS queries.
|
||||
@@ -872,22 +868,20 @@ dns_zone_setparentalsrc4(dns_zone_t *zone, const isc_sockaddr_t *parentalsrc);
|
||||
* Require:
|
||||
*\li 'zone' to be a valid zone.
|
||||
*\li 'parentalsrc' to contain the address.
|
||||
*
|
||||
* Returns:
|
||||
*\li #ISC_R_SUCCESS
|
||||
*/
|
||||
|
||||
isc_sockaddr_t *
|
||||
dns_zone_getparentalsrc4(dns_zone_t *zone);
|
||||
void
|
||||
dns_zone_getparentalsrc4(dns_zone_t *zone, isc_sockaddr_t *parentalsrc);
|
||||
/*%<
|
||||
* Returns the source address set by a previous dns_zone_setparentalsrc4
|
||||
* call, or the default of inaddr_any, port 0.
|
||||
*
|
||||
* Require:
|
||||
*\li 'zone' to be a valid zone.
|
||||
*\li 'parentalsrc' to be non NULL.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
dns_zone_setparentalsrc6(dns_zone_t *zone, const isc_sockaddr_t *parentalsrc);
|
||||
/*%<
|
||||
* Set the source address to be used with IPv6 parental DS queries.
|
||||
@@ -895,22 +889,20 @@ dns_zone_setparentalsrc6(dns_zone_t *zone, const isc_sockaddr_t *parentalsrc);
|
||||
* Require:
|
||||
*\li 'zone' to be a valid zone.
|
||||
*\li 'parentalsrc' to contain the address.
|
||||
*
|
||||
* Returns:
|
||||
*\li #ISC_R_SUCCESS
|
||||
*/
|
||||
|
||||
isc_sockaddr_t *
|
||||
dns_zone_getparentalsrc6(dns_zone_t *zone);
|
||||
void
|
||||
dns_zone_getparentalsrc6(dns_zone_t *zone, isc_sockaddr_t *parentalsrc);
|
||||
/*%<
|
||||
* Returns the source address set by a previous dns_zone_setparentalsrc6
|
||||
* call, or the default of in6addr_any, port 0.
|
||||
*
|
||||
* Require:
|
||||
*\li 'zone' to be a valid zone.
|
||||
*\li 'parentalsrc' to be non NULL.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
dns_zone_setnotifysrc4(dns_zone_t *zone, const isc_sockaddr_t *notifysrc);
|
||||
/*%<
|
||||
* Set the source address to be used with IPv4 NOTIFY messages.
|
||||
@@ -918,22 +910,20 @@ dns_zone_setnotifysrc4(dns_zone_t *zone, const isc_sockaddr_t *notifysrc);
|
||||
* Require:
|
||||
*\li 'zone' to be a valid zone.
|
||||
*\li 'notifysrc' to contain the address.
|
||||
*
|
||||
* Returns:
|
||||
*\li #ISC_R_SUCCESS
|
||||
*/
|
||||
|
||||
isc_sockaddr_t *
|
||||
dns_zone_getnotifysrc4(dns_zone_t *zone);
|
||||
void
|
||||
dns_zone_getnotifysrc4(dns_zone_t *zone, isc_sockaddr_t *notifysrc);
|
||||
/*%<
|
||||
* Returns the source address set by a previous dns_zone_setnotifysrc4
|
||||
* call, or the default of inaddr_any, port 0.
|
||||
*
|
||||
* Require:
|
||||
*\li 'zone' to be a valid zone.
|
||||
*\li 'notifysrc' to be non NULL.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
dns_zone_setnotifysrc6(dns_zone_t *zone, const isc_sockaddr_t *notifysrc);
|
||||
/*%<
|
||||
* Set the source address to be used with IPv6 NOTIFY messages.
|
||||
@@ -941,19 +931,17 @@ dns_zone_setnotifysrc6(dns_zone_t *zone, const isc_sockaddr_t *notifysrc);
|
||||
* Require:
|
||||
*\li 'zone' to be a valid zone.
|
||||
*\li 'notifysrc' to contain the address.
|
||||
*
|
||||
* Returns:
|
||||
*\li #ISC_R_SUCCESS
|
||||
*/
|
||||
|
||||
isc_sockaddr_t *
|
||||
dns_zone_getnotifysrc6(dns_zone_t *zone);
|
||||
void
|
||||
dns_zone_getnotifysrc6(dns_zone_t *zone, isc_sockaddr_t *notifysrc);
|
||||
/*%<
|
||||
* Returns the source address set by a previous dns_zone_setnotifysrc6
|
||||
* call, or the default of in6addr_any, port 0.
|
||||
*
|
||||
* Require:
|
||||
*\li 'zone' to be a valid zone.
|
||||
*\li 'notifysrc' to be non NULL.
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -1528,8 +1516,8 @@ dns_zone_getsigresigninginterval(dns_zone_t *zone);
|
||||
* \li 'zone' to be a valid zone.
|
||||
*/
|
||||
|
||||
isc_sockaddr_t
|
||||
dns_zone_getsourceaddr(dns_zone_t *zone);
|
||||
void
|
||||
dns_zone_getsourceaddr(dns_zone_t *zone, isc_sockaddr_t *sourceaddr);
|
||||
/*%<
|
||||
* Get the zone's source address from which it has last contacted the current
|
||||
* primary server.
|
||||
@@ -1537,17 +1525,18 @@ dns_zone_getsourceaddr(dns_zone_t *zone);
|
||||
* Requires:
|
||||
* \li 'zone' to be a valid zone.
|
||||
* \li 'zone' has a non-empty primaries list.
|
||||
* \li 'sourceaddr' to be non-NULL.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
dns_zone_getprimaryaddr(dns_zone_t *zone, isc_sockaddr_t *dest);
|
||||
dns_zone_getprimaryaddr(dns_zone_t *zone, isc_sockaddr_t *primaryaddr);
|
||||
/*%<
|
||||
* Get the zone's current primary server into '*dest'.
|
||||
* Get the zone's current primary server into '*primaryaddr'.
|
||||
*
|
||||
* Requires:
|
||||
* \li 'zone' to be a valid zone.
|
||||
* \li 'zone' has a non-empty primaries list.
|
||||
* \li 'dest' != NULL.
|
||||
* \li 'primaryaddr' to be non-NULL.
|
||||
*
|
||||
* Returns:
|
||||
*\li #ISC_R_SUCCESS if the current primary server was found
|
||||
|
||||
+60
-46
@@ -5998,106 +5998,123 @@ dns_zone_getkeyopts(dns_zone_t *zone) {
|
||||
return atomic_load_relaxed(&zone->keyopts);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
dns_zone_setxfrsource4(dns_zone_t *zone, const isc_sockaddr_t *xfrsource) {
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
REQUIRE(xfrsource != NULL);
|
||||
|
||||
LOCK_ZONE(zone);
|
||||
zone->xfrsource4 = *xfrsource;
|
||||
UNLOCK_ZONE(zone);
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
isc_sockaddr_t *
|
||||
dns_zone_getxfrsource4(dns_zone_t *zone) {
|
||||
void
|
||||
dns_zone_getxfrsource4(dns_zone_t *zone, isc_sockaddr_t *xfrsource) {
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
return &zone->xfrsource4;
|
||||
REQUIRE(xfrsource != NULL);
|
||||
|
||||
LOCK_ZONE(zone);
|
||||
*xfrsource = zone->xfrsource4;
|
||||
UNLOCK_ZONE(zone);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
dns_zone_setxfrsource6(dns_zone_t *zone, const isc_sockaddr_t *xfrsource) {
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
REQUIRE(xfrsource != NULL);
|
||||
|
||||
LOCK_ZONE(zone);
|
||||
zone->xfrsource6 = *xfrsource;
|
||||
UNLOCK_ZONE(zone);
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
isc_sockaddr_t *
|
||||
dns_zone_getxfrsource6(dns_zone_t *zone) {
|
||||
void
|
||||
dns_zone_getxfrsource6(dns_zone_t *zone, isc_sockaddr_t *xfrsource) {
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
return &zone->xfrsource6;
|
||||
REQUIRE(xfrsource != NULL);
|
||||
|
||||
LOCK_ZONE(zone);
|
||||
*xfrsource = zone->xfrsource6;
|
||||
UNLOCK_ZONE(zone);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
dns_zone_setparentalsrc4(dns_zone_t *zone, const isc_sockaddr_t *parentalsrc) {
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
REQUIRE(parentalsrc != NULL);
|
||||
|
||||
LOCK_ZONE(zone);
|
||||
zone->parentalsrc4 = *parentalsrc;
|
||||
UNLOCK_ZONE(zone);
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
isc_sockaddr_t *
|
||||
dns_zone_getparentalsrc4(dns_zone_t *zone) {
|
||||
void
|
||||
dns_zone_getparentalsrc4(dns_zone_t *zone, isc_sockaddr_t *parentalsrc) {
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
return &zone->parentalsrc4;
|
||||
REQUIRE(parentalsrc != NULL);
|
||||
|
||||
LOCK_ZONE(zone);
|
||||
*parentalsrc = zone->parentalsrc4;
|
||||
UNLOCK_ZONE(zone);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
dns_zone_setparentalsrc6(dns_zone_t *zone, const isc_sockaddr_t *parentalsrc) {
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
|
||||
LOCK_ZONE(zone);
|
||||
zone->parentalsrc6 = *parentalsrc;
|
||||
UNLOCK_ZONE(zone);
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
isc_sockaddr_t *
|
||||
dns_zone_getparentalsrc6(dns_zone_t *zone) {
|
||||
void
|
||||
dns_zone_getparentalsrc6(dns_zone_t *zone, isc_sockaddr_t *parentalsrc) {
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
return &zone->parentalsrc6;
|
||||
REQUIRE(parentalsrc != NULL);
|
||||
|
||||
LOCK_ZONE(zone);
|
||||
*parentalsrc = zone->parentalsrc6;
|
||||
UNLOCK_ZONE(zone);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
dns_zone_setnotifysrc4(dns_zone_t *zone, const isc_sockaddr_t *notifysrc) {
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
REQUIRE(notifysrc != NULL);
|
||||
|
||||
LOCK_ZONE(zone);
|
||||
zone->notifysrc4 = *notifysrc;
|
||||
UNLOCK_ZONE(zone);
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
isc_sockaddr_t *
|
||||
dns_zone_getnotifysrc4(dns_zone_t *zone) {
|
||||
void
|
||||
dns_zone_getnotifysrc4(dns_zone_t *zone, isc_sockaddr_t *notifysrc) {
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
return &zone->notifysrc4;
|
||||
REQUIRE(notifysrc != NULL);
|
||||
|
||||
LOCK_ZONE(zone);
|
||||
*notifysrc = zone->notifysrc4;
|
||||
UNLOCK_ZONE(zone);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
dns_zone_setnotifysrc6(dns_zone_t *zone, const isc_sockaddr_t *notifysrc) {
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
REQUIRE(notifysrc != NULL);
|
||||
|
||||
LOCK_ZONE(zone);
|
||||
zone->notifysrc6 = *notifysrc;
|
||||
UNLOCK_ZONE(zone);
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
isc_sockaddr_t *
|
||||
dns_zone_getnotifysrc6(dns_zone_t *zone) {
|
||||
void
|
||||
dns_zone_getnotifysrc6(dns_zone_t *zone, isc_sockaddr_t *notifysrc) {
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
return &zone->notifysrc6;
|
||||
REQUIRE(notifysrc != NULL);
|
||||
|
||||
LOCK_ZONE(zone);
|
||||
*notifysrc = zone->notifysrc6;
|
||||
UNLOCK_ZONE(zone);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -18371,31 +18388,28 @@ dns_zone_getsigresigninginterval(dns_zone_t *zone) {
|
||||
return zone->sigresigninginterval;
|
||||
}
|
||||
|
||||
isc_sockaddr_t
|
||||
dns_zone_getsourceaddr(dns_zone_t *zone) {
|
||||
isc_sockaddr_t sourceaddr;
|
||||
|
||||
void
|
||||
dns_zone_getsourceaddr(dns_zone_t *zone, isc_sockaddr_t *sourceaddr) {
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
REQUIRE(sourceaddr != NULL);
|
||||
|
||||
LOCK_ZONE(zone);
|
||||
INSIST(dns_remote_count(&zone->primaries) > 0);
|
||||
sourceaddr = zone->sourceaddr;
|
||||
*sourceaddr = zone->sourceaddr;
|
||||
UNLOCK_ZONE(zone);
|
||||
|
||||
return sourceaddr;
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_zone_getprimaryaddr(dns_zone_t *zone, isc_sockaddr_t *dest) {
|
||||
dns_zone_getprimaryaddr(dns_zone_t *zone, isc_sockaddr_t *primaryaddr) {
|
||||
isc_result_t result = ISC_R_NOMORE;
|
||||
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
REQUIRE(dest != NULL);
|
||||
REQUIRE(primaryaddr != NULL);
|
||||
|
||||
LOCK_ZONE(zone);
|
||||
INSIST(dns_remote_count(&zone->primaries) > 0);
|
||||
if (!dns_remote_done(&zone->primaries)) {
|
||||
*dest = dns_remote_curraddr(&zone->primaries);
|
||||
*primaryaddr = dns_remote_curraddr(&zone->primaries);
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
UNLOCK_ZONE(zone);
|
||||
|
||||
Reference in New Issue
Block a user