diff options
Diffstat (limited to 'usr.sbin/bind/lib/isc/unix')
| -rw-r--r-- | usr.sbin/bind/lib/isc/unix/app.c | 26 | ||||
| -rw-r--r-- | usr.sbin/bind/lib/isc/unix/net.c | 49 | ||||
| -rw-r--r-- | usr.sbin/bind/lib/isc/unix/socket.c | 54 |
3 files changed, 1 insertions, 128 deletions
diff --git a/usr.sbin/bind/lib/isc/unix/app.c b/usr.sbin/bind/lib/isc/unix/app.c index 2b1b885b9ee..287e5625776 100644 --- a/usr.sbin/bind/lib/isc/unix/app.c +++ b/usr.sbin/bind/lib/isc/unix/app.c @@ -139,19 +139,11 @@ static struct { (void *)isc__app_unblock }; -#ifndef HAVE_SIGWAIT -static void -exit_action(int arg) { - UNUSED(arg); - isc_g_appctx.want_shutdown = ISC_TRUE; -} - static void reload_action(int arg) { UNUSED(arg); isc_g_appctx.want_reload = ISC_TRUE; } -#endif static isc_result_t handle_signal(int sig, void (*handler)(int)) { @@ -194,22 +186,6 @@ isc__app_ctxstart(isc_appctx_t *ctx0) { ctx->want_reload = ISC_FALSE; ctx->blocked = ISC_FALSE; -#ifndef HAVE_SIGWAIT - /* - * Install do-nothing handlers for SIGINT and SIGTERM. - * - * We install them now because BSDI 3.1 won't block - * the default actions, regardless of what we do with - * pthread_sigmask(). - */ - result = handle_signal(SIGINT, exit_action); - if (result != ISC_R_SUCCESS) - goto cleanup; - result = handle_signal(SIGTERM, exit_action); - if (result != ISC_R_SUCCESS) - goto cleanup; -#endif - /* * Always ignore SIGPIPE. */ @@ -230,14 +206,12 @@ isc__app_ctxstart(isc_appctx_t *ctx0) { if (result != ISC_R_SUCCESS) goto cleanup; -#ifdef HAVE_SIGWAIT result = handle_signal(SIGTERM, SIG_DFL); if (result != ISC_R_SUCCESS) goto cleanup; result = handle_signal(SIGINT, SIG_DFL); if (result != ISC_R_SUCCESS) goto cleanup; -#endif /* * Unblock SIGHUP, SIGINT, SIGTERM. diff --git a/usr.sbin/bind/lib/isc/unix/net.c b/usr.sbin/bind/lib/isc/unix/net.c index 7afd89f6017..f579098aab9 100644 --- a/usr.sbin/bind/lib/isc/unix/net.c +++ b/usr.sbin/bind/lib/isc/unix/net.c @@ -14,18 +14,14 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: net.c,v 1.13 2020/01/22 12:56:14 florian Exp $ */ +/* $Id: net.c,v 1.14 2020/01/22 12:58:35 florian Exp $ */ #include <config.h> #include <sys/types.h> -#if defined(HAVE_SYS_SYSCTL_H) -#if defined(HAVE_SYS_PARAM_H) #include <sys/param.h> -#endif #include <sys/sysctl.h> -#endif #include <sys/uio.h> #include <errno.h> @@ -58,29 +54,6 @@ #define ISC_NET_PORTRANGEHIGH 65535 #endif /* ISC_NET_PORTRANGEHIGH */ -#ifdef HAVE_SYSCTLBYNAME - -/*% - * sysctl variants - */ -#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__) -#define USE_SYSCTL_PORTRANGE -#define SYSCTL_V4PORTRANGE_LOW "net.inet.ip.portrange.hifirst" -#define SYSCTL_V4PORTRANGE_HIGH "net.inet.ip.portrange.hilast" -#define SYSCTL_V6PORTRANGE_LOW "net.inet.ip.portrange.hifirst" -#define SYSCTL_V6PORTRANGE_HIGH "net.inet.ip.portrange.hilast" -#endif - -#ifdef __NetBSD__ -#define USE_SYSCTL_PORTRANGE -#define SYSCTL_V4PORTRANGE_LOW "net.inet.ip.anonportmin" -#define SYSCTL_V4PORTRANGE_HIGH "net.inet.ip.anonportmax" -#define SYSCTL_V6PORTRANGE_LOW "net.inet6.ip6.anonportmin" -#define SYSCTL_V6PORTRANGE_HIGH "net.inet6.ip6.anonportmax" -#endif - -#else /* !HAVE_SYSCTLBYNAME */ - #ifdef __OpenBSD__ #define USE_SYSCTL_PORTRANGE #define SYSCTL_V4PORTRANGE_LOW { CTL_NET, PF_INET, IPPROTO_IP, \ @@ -92,13 +65,9 @@ #define SYSCTL_V6PORTRANGE_HIGH SYSCTL_V4PORTRANGE_HIGH #endif -#endif /* HAVE_SYSCTLBYNAME */ - -# if defined(WANT_IPV6) static isc_once_t once_ipv6only = ISC_ONCE_INIT; static isc_once_t once_ipv6pktinfo = ISC_ONCE_INIT; -# endif /* WANT_IPV6 */ #ifndef ISC_CMSG_IP_TOS #ifdef __APPLE__ @@ -150,7 +119,6 @@ try_proto(int domain) { } } -#ifdef WANT_IPV6 if (domain == PF_INET6) { struct sockaddr_in6 sin6; unsigned int len; @@ -188,7 +156,6 @@ try_proto(int domain) { } } } -#endif (void)close(s); @@ -198,9 +165,7 @@ try_proto(int domain) { static void initialize_action(void) { ipv4_result = try_proto(PF_INET); -#ifdef WANT_IPV6 ipv6_result = try_proto(PF_INET6); -#endif } static void @@ -226,7 +191,6 @@ isc_net_probeunix(void) { return (unix_result); } -#ifdef WANT_IPV6 static void try_ipv6only(void) { #ifdef IPV6_V6ONLY @@ -292,9 +256,7 @@ initialize_ipv6only(void) { RUNTIME_CHECK(isc_once_do(&once_ipv6only, try_ipv6only) == ISC_R_SUCCESS); } -#endif /* WANT_IPV6 */ -#ifdef WANT_IPV6 static void try_ipv6pktinfo(void) { int s, on; @@ -341,25 +303,16 @@ initialize_ipv6pktinfo(void) { RUNTIME_CHECK(isc_once_do(&once_ipv6pktinfo, try_ipv6pktinfo) == ISC_R_SUCCESS); } -#endif /* WANT_IPV6 */ isc_result_t isc_net_probe_ipv6only(void) { -#ifdef WANT_IPV6 initialize_ipv6only(); -#else - ipv6only_result = ISC_R_NOTFOUND; -#endif return (ipv6only_result); } isc_result_t isc_net_probe_ipv6pktinfo(void) { -#ifdef WANT_IPV6 initialize_ipv6pktinfo(); -#else - ipv6pktinfo_result = ISC_R_NOTFOUND; -#endif return (ipv6pktinfo_result); } diff --git a/usr.sbin/bind/lib/isc/unix/socket.c b/usr.sbin/bind/lib/isc/unix/socket.c index 6e9a491ba69..4ab1098049b 100644 --- a/usr.sbin/bind/lib/isc/unix/socket.c +++ b/usr.sbin/bind/lib/isc/unix/socket.c @@ -31,9 +31,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#ifdef HAVE_INTTYPES_H #include <inttypes.h> /* uintptr_t */ -#endif #include <isc/buffer.h> #include <isc/bufferlist.h> @@ -159,15 +157,7 @@ typedef isc_event_t intev_t; /*% * The size to raise the receive buffer to (from BIND 8). */ -#ifdef TUNE_LARGE -#ifdef sun -#define RCVBUFSIZE (1*1024*1024) -#else -#define RCVBUFSIZE (16*1024*1024) -#endif -#else #define RCVBUFSIZE (32*1024) -#endif /* TUNE_LARGE */ /*% * Instead of calculating the cmsgbuf lengths every time we take @@ -624,28 +614,16 @@ static isc_result_t make_nonblock(int fd) { int ret; char strbuf[ISC_STRERRORSIZE]; -#ifdef USE_FIONBIO_IOCTL - int on = 1; -#else int flags; -#endif -#ifdef USE_FIONBIO_IOCTL - ret = ioctl(fd, FIONBIO, (char *)&on); -#else flags = fcntl(fd, F_GETFL, 0); flags |= O_NONBLOCK; ret = fcntl(fd, F_SETFL, flags); -#endif if (ret == -1) { isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, -#ifdef USE_FIONBIO_IOCTL - "ioctl(%d, FIONBIO, &on): %s", fd, -#else "fcntl(%d, F_SETFL, %d): %s", fd, flags, -#endif strbuf); return (ISC_R_UNEXPECTED); @@ -1027,24 +1005,8 @@ build_msghdr_recv(isc__socket_t *sock, char *cmsgbuf, isc_socketevent_t *dev, if (sock->type == isc_sockettype_udp) { memset(&dev->address, 0, sizeof(dev->address)); -#ifdef BROKEN_RECVMSG - if (sock->pf == AF_INET) { - msg->msg_name = (void *)&dev->address.type.sin; - msg->msg_namelen = sizeof(dev->address.type.sin6); - } else if (sock->pf == AF_INET6) { - msg->msg_name = (void *)&dev->address.type.sin6; - msg->msg_namelen = sizeof(dev->address.type.sin6); - } else if (sock->pf == AF_UNIX) { - msg->msg_name = (void *)&dev->address.type.sunix; - msg->msg_namelen = sizeof(dev->address.type.sunix); - } else { - msg->msg_name = (void *)&dev->address.type.sa; - msg->msg_namelen = sizeof(dev->address.type); - } -#else msg->msg_name = (void *)&dev->address.type.sa; msg->msg_namelen = sizeof(dev->address.type); -#endif } else { /* TCP */ msg->msg_name = NULL; msg->msg_namelen = 0; @@ -3751,27 +3713,11 @@ isc__socket_permunix(isc_sockaddr_t *sockaddr, uint32_t perm, isc_result_t result = ISC_R_SUCCESS; char strbuf[ISC_STRERRORSIZE]; char path[sizeof(sockaddr->type.sunix.sun_path)]; -#ifdef NEED_SECURE_DIRECTORY - char *slash; -#endif REQUIRE(sockaddr->type.sa.sa_family == AF_UNIX); INSIST(strlen(sockaddr->type.sunix.sun_path) < sizeof(path)); strlcpy(path, sockaddr->type.sunix.sun_path, sizeof(path)); -#ifdef NEED_SECURE_DIRECTORY - slash = strrchr(path, '/'); - if (slash != NULL) { - if (slash != path) { - *slash = '\0'; - } else { - strlcpy(path, "/", sizeof(path)); - } - } else { - strlcpy(path, ".", sizeof(path)); - } -#endif - if (chmod(path, perm) < 0) { isc__strerror(errno, strbuf, sizeof(strbuf)); isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, |
