Sun Aug 9 15:20:22 2020 UTC ()
net/bind916: add version 9.16.5 package

Add bind916 version 9.16.5 package (BIND 9.16.5).

BIND, the Berkeley Internet Name Daemon.  This package contains the BIND
9.16 release.

  * New dnssec-policy statement to configure a key and signing policy for
    zones, enabling automatic key regeneration and rollover.
  * New network manager based on libuv.
  * Added support for the new GeoIP2 geolocation API, libmaxminddb.
  * Improved DNSSEC trust anchor configuration using the trust-anchors
    statement, permitting configuration of trust anchors in DS as well as
    DNSKEY format.
  * YAML output for dig, mdig, and delv.


(taca)
diff -r0 -r1.1 pkgsrc/net/bind916/DESCR
diff -r0 -r1.1 pkgsrc/net/bind916/MESSAGE.rcd
diff -r0 -r1.1 pkgsrc/net/bind916/Makefile
diff -r0 -r1.1 pkgsrc/net/bind916/PLIST
diff -r0 -r1.1 pkgsrc/net/bind916/buildlink3.mk
diff -r0 -r1.1 pkgsrc/net/bind916/builtin.mk
diff -r0 -r1.1 pkgsrc/net/bind916/distinfo
diff -r0 -r1.1 pkgsrc/net/bind916/options.mk
diff -r0 -r1.1 pkgsrc/net/bind916/files/named9.sh
diff -r0 -r1.1 pkgsrc/net/bind916/files/smf/manifest.xml
diff -r0 -r1.1 pkgsrc/net/bind916/files/smf/named.sh
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-bin_dig_dighost.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-bin_dig_include_dig_dig.h
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-bin_named_Makefile.in
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-bin_named_main.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-bin_named_server.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-bin_nsupdate_nsupdate.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-bin_pkcs11_pkcs11-keygen.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-bin_tests_system_kasp_tests.sh
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-bin_tests_system_metadata_tests.sh
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-bin_tests_system_rpz_tests.sh
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-bin_tools_arpaname.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-bin_tools_nsec3hash.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-config.guess
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-config.h.in
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-config.sub
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-config.threads.in
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-configure
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-contrib_dlz_config.dlz.in
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-contrib_dlz_modules_wildcard_dlz__wildcard__dynamic.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_dns_byaddr.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_dns_dnsrps.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_dns_gssapi__link.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_dns_include_dns_zone.h
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_dns_lookup.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_dns_peer.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_dns_rbt.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_dns_rbtdb.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_dns_request.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_dns_sdb.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_dns_sdlz.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_dns_spnego.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_dns_validator.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_dns_view.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_dns_zone.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_isc_backtrace.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_isc_hp.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_isc_include_isc_netmgr.h
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_isc_include_isc_socket.h
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_isc_include_isc_types.h
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_isc_netmgr_netmgr.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_isc_netmgr_tcp.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_isc_rwlock.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_isc_siphash.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_isc_stats.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_isc_task.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_isc_unix_include_isc_align.h
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_isc_unix_net.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_isc_unix_socket.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_isc_unix_time.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_ns_Makefile.in
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_ns_client.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_ns_include_ns_client.h
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_ns_include_ns_pfilter.h
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_ns_interfacemgr.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_ns_pfilter.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_ns_query.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_ns_update.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-lib_ns_xfrout.c
diff -r0 -r1.1 pkgsrc/net/bind916/patches/patch-make_rules.in

File Added: pkgsrc/net/bind916/DESCR
BIND, the Berkeley Internet Name Daemon.  This package contains the BIND
9.16 release.

  * New dnssec-policy statement to configure a key and signing policy for
    zones, enabling automatic key regeneration and rollover.
  * New network manager based on libuv.
  * Added support for the new GeoIP2 geolocation API, libmaxminddb.
  * Improved DNSSEC trust anchor configuration using the trust-anchors
    statement, permitting configuration of trust anchors in DS as well as
    DNSKEY format.
  * YAML output for dig, mdig, and delv.

File Added: pkgsrc/net/bind916/MESSAGE.rcd
===========================================================================
$NetBSD: MESSAGE.rcd,v 1.1 2020/08/09 15:20:21 taca Exp $

Please consider running BIND under the pseudo user account "${BIND_USER}"
in a chroot environment for security reasons.

To achieve this, set the variable "named_chrootdir" in /etc/rc.conf to
the directory with the chroot environment e.g. "${BIND_DIR}".

Note: named(8) requires writable directories under "/etc/namedb" which
specified by "directory" in "options" statement:

	cache
	keys
	nta

Make sure to these directories exists with writable by "${BIND_USER}" user.

===========================================================================

File Added: pkgsrc/net/bind916/Makefile
# $NetBSD: Makefile,v 1.1 2020/08/09 15:20:21 taca Exp $

DISTNAME=	bind-${BIND_VERSION}
PKGNAME=	${DISTNAME:S/-P/pl/}
CATEGORIES=	net
MASTER_SITES=	ftp://ftp.isc.org/isc/bind9/${BIND_VERSION}/
EXTRACT_SUFX=	.tar.xz

MAINTAINER=	pkgsrc-users@NetBSD.org
HOMEPAGE=	https://www.isc.org/software/bind/
COMMENT=	Berkeley Internet Name Daemon implementation of DNS, version 9.14
LICENSE=	mpl-2.0

CONFLICTS+=	host-[0-9]*

MAKE_JOBS_SAFE=	no

BIND_VERSION=	9.16.5

.include "../../mk/bsd.prefs.mk"

BUILD_DEFS+=	BIND_DIR VARBASE

.include "options.mk"

USE_TOOLS+=		pax perl pkg-config
USE_LIBTOOL=		yes
GNU_CONFIGURE=		yes
CHECK_FILES_SKIP=	bin/tests/system/system-test-driver.sh
MAKE_ENV+=		WRKDIR=${WRKDIR} PREFIX=${PREFIX}

.if ${OPSYS} == "Linux" && !exists(/usr/include/sys/capability.h)
CONFIGURE_ARGS+=		--disable-linux-caps
.endif

CONFIGURE_ARGS+=		--with-libtool
CONFIGURE_ARGS+=		--sysconfdir=${PKG_SYSCONFDIR}
CONFIGURE_ARGS+=		--localstatedir=${VARBASE}
CONFIGURE_ARGS+=		--with-openssl=${SSLBASE:Q}
CONFIGURE_ARGS+=		--with-python=no
.if !empty(MACHINE_PLATFORM:MNetBSD-*-m68k) || \
    !empty(MACHINE_PLATFORM:MNetBSD-*-mipsel) || \
    !empty(MACHINE_PLATFORM:MNetBSD-*-vax)
CONFIGURE_ARGS+=		--disable-atomic
.endif
CONFIGURE_ARGS.DragonFly+=	--disable-kqueue
CONFIGURE_ARGS.SunOS+=		--disable-epoll

BUILDLINK_TRANSFORM.SunOS+=	rm:-zrelax=transtls

PKG_GROUPS_VARS+=	BIND_GROUP
PKG_USERS_VARS=		BIND_USER

PKG_GROUPS=		${BIND_GROUP}
PKG_USERS=		${BIND_USER}:${BIND_GROUP}

PKG_GECOS.${BIND_USER}=	Named pseudo-user
PKG_HOME.${BIND_USER}=	${BIND_DIR}

DOCS=			CHANGES HISTORY OPTIONS README

FILES_SUBST+=		BIND_GROUP=${BIND_GROUP} \
			BIND_USER=${BIND_USER} PAX=${PAX:Q} \
			SSLBASE=${SSLBASE}
MESSAGE_SUBST+=		BIND_DIR=${BIND_DIR} BIND_USER=${BIND_USER}

DOCDIR=			share/doc/bind9

RCD_SCRIPTS=		named9
SMF_METHODS=		named

INSTALL_MAKE_FLAGS+=	sysconfdir=${PREFIX}/share/examples/bind9
CONF_FILES+=		share/examples/bind9/bind.keys \
			${PKG_SYSCONFDIR}/bind.keys

INSTALLATION_DIRS+=	${DOCDIR}

post-install:
.for f in ${DOCS}
	${INSTALL_DATA} ${WRKSRC}/${f} ${DESTDIR}${PREFIX}/${DOCDIR}
.endfor

.include "../../security/openssl/buildlink3.mk"
.include "../../devel/libuv/buildlink3.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

File Added: pkgsrc/net/bind916/PLIST
@comment $NetBSD: PLIST,v 1.1 2020/08/09 15:20:21 taca Exp $
bin/arpaname
bin/delv
bin/dig
${PLIST.dnstap}bin/dnstap-read
bin/host
bin/mdig
bin/named-rrchecker
bin/nslookup
bin/nsupdate
include/bind9/check.h
include/bind9/getaddresses.h
include/bind9/version.h
include/dns/acl.h
include/dns/adb.h
include/dns/badcache.h
include/dns/bit.h
include/dns/byaddr.h
include/dns/cache.h
include/dns/callbacks.h
include/dns/catz.h
include/dns/cert.h
include/dns/client.h
include/dns/clientinfo.h
include/dns/compress.h
include/dns/db.h
include/dns/dbiterator.h
include/dns/dbtable.h
include/dns/diff.h
include/dns/dispatch.h
include/dns/dlz.h
include/dns/dlz_dlopen.h
include/dns/dns64.h
include/dns/dnsrps.h
include/dns/dnssec.h
include/dns/dnstap.h
include/dns/ds.h
include/dns/dsdigest.h
include/dns/dyndb.h
include/dns/ecdb.h
include/dns/ecs.h
include/dns/edns.h
include/dns/enumclass.h
include/dns/enumtype.h
include/dns/events.h
include/dns/fixedname.h
include/dns/forward.h
include/dns/geoip.h
include/dns/ipkeylist.h
include/dns/iptable.h
include/dns/journal.h
include/dns/kasp.h
include/dns/keydata.h
include/dns/keyflags.h
include/dns/keymgr.h
include/dns/keytable.h
include/dns/keyvalues.h
include/dns/lib.h
include/dns/librpz.h
include/dns/lmdb.h
include/dns/log.h
include/dns/lookup.h
include/dns/master.h
include/dns/masterdump.h
include/dns/message.h
include/dns/name.h
include/dns/ncache.h
include/dns/nsec.h
include/dns/nsec3.h
include/dns/nta.h
include/dns/opcode.h
include/dns/order.h
include/dns/peer.h
include/dns/portlist.h
include/dns/private.h
include/dns/rbt.h
include/dns/rcode.h
include/dns/rdata.h
include/dns/rdataclass.h
include/dns/rdatalist.h
include/dns/rdataset.h
include/dns/rdatasetiter.h
include/dns/rdataslab.h
include/dns/rdatastruct.h
include/dns/rdatatype.h
include/dns/request.h
include/dns/resolver.h
include/dns/result.h
include/dns/rootns.h
include/dns/rpz.h
include/dns/rriterator.h
include/dns/rrl.h
include/dns/sdb.h
include/dns/sdlz.h
include/dns/secalg.h
include/dns/secproto.h
include/dns/soa.h
include/dns/ssu.h
include/dns/stats.h
include/dns/tcpmsg.h
include/dns/time.h
include/dns/timer.h
include/dns/tkey.h
include/dns/tsec.h
include/dns/tsig.h
include/dns/ttl.h
include/dns/types.h
include/dns/update.h
include/dns/validator.h
include/dns/version.h
include/dns/view.h
include/dns/xfrin.h
include/dns/zone.h
include/dns/zonekey.h
include/dns/zoneverify.h
include/dns/zt.h
include/dst/dst.h
include/dst/gssapi.h
include/dst/result.h
include/irs/context.h
include/irs/dnsconf.h
include/irs/netdb.h
include/irs/platform.h
include/irs/resconf.h
include/irs/types.h
include/irs/version.h
include/isc/aes.h
include/isc/align.h
include/isc/app.h
include/isc/assertions.h
include/isc/astack.h
include/isc/atomic.h
include/isc/backtrace.h
include/isc/base32.h
include/isc/base64.h
include/isc/bind9.h
include/isc/buffer.h
include/isc/bufferlist.h
include/isc/commandline.h
include/isc/condition.h
include/isc/counter.h
include/isc/crc64.h
include/isc/deprecated.h
include/isc/dir.h
include/isc/endian.h
include/isc/errno.h
include/isc/error.h
include/isc/event.h
include/isc/eventclass.h
include/isc/file.h
include/isc/formatcheck.h
include/isc/fsaccess.h
include/isc/fuzz.h
include/isc/hash.h
include/isc/heap.h
include/isc/hex.h
include/isc/hmac.h
include/isc/hp.h
include/isc/ht.h
include/isc/httpd.h
include/isc/interfaceiter.h
include/isc/iterated_hash.h
include/isc/lang.h
include/isc/lex.h
include/isc/lfsr.h
include/isc/lib.h
include/isc/likely.h
include/isc/list.h
include/isc/log.h
include/isc/magic.h
include/isc/md.h
include/isc/mem.h
include/isc/meminfo.h
include/isc/mutex.h
include/isc/mutexatomic.h
include/isc/mutexblock.h
include/isc/net.h
include/isc/netaddr.h
include/isc/netdb.h
include/isc/netmgr.h
include/isc/netscope.h
include/isc/nonce.h
include/isc/offset.h
include/isc/once.h
include/isc/os.h
include/isc/parseint.h
include/isc/platform.h
include/isc/pool.h
include/isc/portset.h
include/isc/print.h
include/isc/queue.h
include/isc/quota.h
include/isc/radix.h
include/isc/random.h
include/isc/ratelimiter.h
include/isc/refcount.h
include/isc/regex.h
include/isc/region.h
include/isc/resource.h
include/isc/result.h
include/isc/resultclass.h
include/isc/rwlock.h
include/isc/safe.h
include/isc/serial.h
include/isc/siphash.h
include/isc/sockaddr.h
include/isc/socket.h
include/isc/stat.h
include/isc/stats.h
include/isc/stdatomic.h
include/isc/stdio.h
include/isc/stdtime.h
include/isc/strerr.h
include/isc/string.h
include/isc/symtab.h
include/isc/syslog.h
include/isc/task.h
include/isc/taskpool.h
include/isc/thread.h
include/isc/time.h
include/isc/timer.h
include/isc/tm.h
include/isc/types.h
include/isc/utf8.h
include/isc/util.h
include/isc/version.h
include/isccc/alist.h
include/isccc/base64.h
include/isccc/cc.h
include/isccc/ccmsg.h
include/isccc/events.h
include/isccc/result.h
include/isccc/sexpr.h
include/isccc/symtab.h
include/isccc/symtype.h
include/isccc/types.h
include/isccc/util.h
include/isccc/version.h
include/isccfg/aclconf.h
include/isccfg/cfg.h
include/isccfg/dnsconf.h
include/isccfg/grammar.h
include/isccfg/kaspconf.h
include/isccfg/log.h
include/isccfg/namedconf.h
include/isccfg/version.h
include/ns/client.h
include/ns/hooks.h
include/ns/interfacemgr.h
include/ns/lib.h
include/ns/listenlist.h
include/ns/log.h
include/ns/notify.h
include/ns/query.h
include/ns/server.h
include/ns/sortlist.h
include/ns/stats.h
include/ns/types.h
include/ns/update.h
include/ns/version.h
include/ns/xfrout.h
include/pk11/constants.h
include/pk11/internal.h
include/pk11/pk11.h
include/pk11/result.h
include/pk11/site.h
include/pkcs11/pkcs11.h
lib/libbind9.la
lib/libdns.la
lib/libirs.la
lib/libisc.la
lib/libisccc.la
lib/libisccfg.la
lib/libns.la
lib/named/filter-aaaa.so
man/man1/arpaname.1
man/man1/delv.1
man/man1/dig.1
${PLIST.dnstap}man/man1/dnstap-read.1
man/man1/host.1
man/man1/mdig.1
man/man1/named-rrchecker.1
man/man1/nslookup.1
man/man1/nsupdate.1
man/man5/named.conf.5
man/man5/rndc.conf.5
man/man8/ddns-confgen.8
man/man8/dnssec-cds.8
man/man8/dnssec-checkds.8
man/man8/dnssec-coverage.8
man/man8/dnssec-dsfromkey.8
man/man8/dnssec-importkey.8
man/man8/dnssec-keyfromlabel.8
man/man8/dnssec-keygen.8
man/man8/dnssec-keymgr.8
man/man8/dnssec-revoke.8
man/man8/dnssec-settime.8
man/man8/dnssec-signzone.8
man/man8/dnssec-verify.8
man/man8/filter-aaaa.8
man/man8/named-checkconf.8
man/man8/named-checkzone.8
man/man8/named-compilezone.8
man/man8/named-journalprint.8
man/man8/named-nzd2nzf.8
man/man8/named.8
man/man8/nsec3hash.8
${PLIST.pkcs11}man/man8/pkcs11-destroy.8
${PLIST.pkcs11}man/man8/pkcs11-keygen.8
${PLIST.pkcs11}man/man8/pkcs11-list.8
${PLIST.pkcs11}man/man8/pkcs11-tokens.8
man/man8/rndc-confgen.8
man/man8/rndc.8
man/man8/tsig-keygen.8
sbin/ddns-confgen
sbin/dnssec-cds
sbin/dnssec-dsfromkey
sbin/dnssec-importkey
sbin/dnssec-keyfromlabel
sbin/dnssec-keygen
sbin/dnssec-revoke
sbin/dnssec-settime
sbin/dnssec-signzone
sbin/dnssec-verify
sbin/named
sbin/named-checkconf
sbin/named-checkzone
sbin/named-compilezone
sbin/named-journalprint
${PLIST.lmdb}sbin/named-nzd2nzf
sbin/nsec3hash
${PLIST.pkcs11}sbin/pkcs11-destroy
${PLIST.pkcs11}sbin/pkcs11-keygen
${PLIST.pkcs11}sbin/pkcs11-list
${PLIST.pkcs11}sbin/pkcs11-tokens
sbin/rndc
sbin/rndc-confgen
sbin/tsig-keygen
share/doc/bind9/CHANGES
share/doc/bind9/HISTORY
share/doc/bind9/OPTIONS
share/doc/bind9/README
share/examples/bind9/bind.keys

File Added: pkgsrc/net/bind916/buildlink3.mk
# $NetBSD: buildlink3.mk,v 1.1 2020/08/09 15:20:21 taca Exp $

BUILDLINK_TREE+=	bind

.if !defined(BIND_BUILDLINK3_MK)
BIND_BUILDLINK3_MK:=

BUILDLINK_API_DEPENDS.bind+=	bind>=9.16.0
BUILDLINK_PKGSRCDIR.bind?=	../../net/bind916
.endif # BIND_BUILDLINK3_MK

BUILDLINK_TREE+=	-bind

File Added: pkgsrc/net/bind916/builtin.mk
# $NetBSD: builtin.mk,v 1.1 2020/08/09 15:20:21 taca Exp $

BUILTIN_PKG:=	bind

BUILTIN_FIND_FILES_VAR:=	EXE_NAMED
BUILTIN_FIND_FILES.EXE_NAMED=	/usr/sbin/named
BUILTIN_FIND_LIBS:=		bind

.include "../../mk/buildlink3/bsd.builtin.mk"

###
### Figure out the version of BIND if an ISC BIND named exists on the
### system.
###
.if !defined(BUILTIN_VERSION.bind) && \
    empty(EXE_NAMED:M__nonexistent__) && \
    empty(EXE_NAMED:M${LOCALBASE}/*)
BUILTIN_VERSION.bind!=	\
	${EXE_NAMED} -v 2>/dev/null | ${HEAD} -1 |			\
	${AWK} 'BEGIN { v = "4.9.11"; }					\
		/^BIND / { v = $$2; sub("-.*", "", v); }		\
		/^named / { v = $$2; sub("-.*", "", v); }		\
		END { print v; }'
.endif
MAKEVARS+=	BUILTIN_VERSION.bind

###
### Determine if there is a built-in implementation of the package and
### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
###
.if !defined(IS_BUILTIN.bind)
IS_BUILTIN.bind=	no
.  if defined(BUILTIN_VERSION.bind)
IS_BUILTIN.bind=	yes
.  endif
.endif
MAKEVARS+=		IS_BUILTIN.bind

###
### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
### a package name to represent the built-in package.
###
.if !defined(BUILTIN_PKG.bind) && \
    !empty(IS_BUILTIN.bind:M[yY][eE][sS]) && \
    defined(BUILTIN_VERSION.bind)
BUILTIN_PKG.bind=	bind-${BUILTIN_VERSION.bind}
.endif
MAKEVARS+=		BUILTIN_PKG.bind

###
### Determine whether we should use the built-in implementation if it
### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
###
.if !defined(USE_BUILTIN.bind)
.  if ${PREFER.bind} == "pkgsrc"
USE_BUILTIN.bind=	no
.  else
USE_BUILTIN.bind=	${IS_BUILTIN.bind}
.    if defined(BUILTIN_PKG.bind) && \
        !empty(IS_BUILTIN.bind:M[yY][eE][sS])
USE_BUILTIN.bind=	yes
.      for dep in ${BUILDLINK_API_DEPENDS.bind}
.        if !empty(USE_BUILTIN.bind:M[yY][eE][sS])
USE_BUILTIN.bind!=							\
	if ${PKG_ADMIN} pmatch ${dep:Q} ${BUILTIN_PKG.bind:Q}; then	\
		${ECHO} yes;						\
	else								\
		${ECHO} no;						\
	fi
.        endif
.      endfor
.    endif
.  endif  # PREFER.bind
.endif
MAKEVARS+=		USE_BUILTIN.bind

###
### The section below only applies if we are not including this file
### solely to determine whether a built-in implementation exists.
###
CHECK_BUILTIN.bind?=	no
.if !empty(CHECK_BUILTIN.bind:M[nN][oO])

.  if !empty(USE_BUILTIN.bind:M[yY][eE][sS])
.    if !empty(BUILTIN_LIB_FOUND.bind:M[yY][eE][sS])
BUILDLINK_LDADD.bind?=	-lbind
.    endif
.  elif !empty(USE_BUILTIN.bind:M[nN][oO])
BUILDLINK_LDADD.bind?=	-lbind
.  endif

.endif	# CHECK_BUILTIN.bind

File Added: pkgsrc/net/bind916/distinfo
$NetBSD: distinfo,v 1.1 2020/08/09 15:20:21 taca Exp $

SHA1 (bind-9.16.5.tar.xz) = a5b0fffd3a53c06368772c185688207dd57058f1
RMD160 (bind-9.16.5.tar.xz) = 28228bd5d7531026e9b0cc324235d347e704bf57
SHA512 (bind-9.16.5.tar.xz) = 789fc19f60e81f67ef13ebacd030ea5d8f8cc42cf5f06a01ee2eefe9b7c6d3b10603a3a6a3df85b0e5d770fcf462ce8dddc3a7e5f7f2dab27aa5879ee5380eb7
Size (bind-9.16.5.tar.xz) = 3474044 bytes
SHA1 (patch-bin_dig_dighost.c) = b1073911d80ecd519af98b6678968296ff8c0c98
SHA1 (patch-bin_dig_include_dig_dig.h) = 10166f5bb98b208c7b10d63eb31e8253f704acc8
SHA1 (patch-bin_named_Makefile.in) = f1367da6a226ba44d0ee13acf00b8abeb5b1b7eb
SHA1 (patch-bin_named_main.c) = 408c3f6acd70f20c26801baaa9922091a6a7fe7e
SHA1 (patch-bin_named_server.c) = 6e59d3f637ebb829eec2f76ba7c350fb5cf9be6d
SHA1 (patch-bin_nsupdate_nsupdate.c) = 4ccd0e503a972cf16905e999bcc574f8ee0dd85d
SHA1 (patch-bin_pkcs11_pkcs11-keygen.c) = d953bf48aadcdf7e95975d335167cc50f54ef91e
SHA1 (patch-bin_tests_system_kasp_tests.sh) = 5243413a7b24beae80afc39daf57bf3b22133730
SHA1 (patch-bin_tests_system_metadata_tests.sh) = d01a492d0b7738760bdbff714248e279a78fef28
SHA1 (patch-bin_tests_system_rpz_tests.sh) = 1bc5e0d5c0cc50608e6314c2d2664bd1dc3f6e34
SHA1 (patch-bin_tools_arpaname.c) = 868da4454d06dc823680cf06a764fa40b8474708
SHA1 (patch-bin_tools_nsec3hash.c) = 87c3891db62c45cd8ed2b484b17f7bf2e319bef3
SHA1 (patch-config.guess) = b3edcb0b841ed7251f313af22ca21b5259ab0d04
SHA1 (patch-config.h.in) = 1df3dd99685700144c05775b8594981fb9bb9bc0
SHA1 (patch-config.sub) = 021f252966d9499f76fcbc6e0dd84eb9d5babf5e
SHA1 (patch-config.threads.in) = fc5cc7097d87523a34c0e630cb8dd1d081d859e5
SHA1 (patch-configure) = 619a7b81131e945361756e9d1971be2ff1a79851
SHA1 (patch-contrib_dlz_config.dlz.in) = 6c53d61aaaf1a952a867e4c4da0194db94f511d7
SHA1 (patch-contrib_dlz_modules_wildcard_dlz__wildcard__dynamic.c) = 37ba5f06f4970abaae6d98c4305f6372537a313f
SHA1 (patch-lib_dns_byaddr.c) = 647ddaaaf040233e18d1a87d83bc2bd63d2a20e3
SHA1 (patch-lib_dns_dnsrps.c) = b4c66a808eeb1e859801028afacd7237cd89903a
SHA1 (patch-lib_dns_gssapi__link.c) = acd5f3c975d4edf391e77fd39cfa91810ad17ba2
SHA1 (patch-lib_dns_include_dns_zone.h) = 8abf4c18935629624e68a14361dbeaf00a440c90
SHA1 (patch-lib_dns_lookup.c) = 6c7463aca16abf6bd578aba1733a3217608a39d3
SHA1 (patch-lib_dns_peer.c) = 16cc26fd4e792a23caef6e091f94f974041179e7
SHA1 (patch-lib_dns_rbt.c) = b52d5b965461a39192d4eab598bc82e54254ab80
SHA1 (patch-lib_dns_rbtdb.c) = bb3f829cbed23bce624462766aa6d039a0153afe
SHA1 (patch-lib_dns_request.c) = 82560e819cba0259883da8d47618ffabead22c55
SHA1 (patch-lib_dns_sdb.c) = ed447ec7a134e620765b25ee36124a19dfd9fab0
SHA1 (patch-lib_dns_sdlz.c) = 4fc15a577c64501c10c144eab147e54686e80309
SHA1 (patch-lib_dns_spnego.c) = 56f913c283e3833eab2b8a03c285ab5e6a9f70f1
SHA1 (patch-lib_dns_validator.c) = 03dd60d4c38be7248d1e07f2c29ddd543b5f7454
SHA1 (patch-lib_dns_view.c) = 5b092f0344b92d003f1fe1f28e4cc4c76b2505cf
SHA1 (patch-lib_dns_zone.c) = 900e84e0de403d601df4c30f22758ab26a2a52b5
SHA1 (patch-lib_isc_backtrace.c) = 1b6bca9b3de7f7298882c6c88274b0baf1dad507
SHA1 (patch-lib_isc_hp.c) = 4c9646722297460f0e973bd131439b4ede885588
SHA1 (patch-lib_isc_include_isc_netmgr.h) = 1b59d94e0236922f8fc3118ad775cb8eecf8f033
SHA1 (patch-lib_isc_include_isc_socket.h) = dc6376cd9e8391fa96efd805faee1a5d0647a142
SHA1 (patch-lib_isc_include_isc_types.h) = bc0cdeb762d974b7be6e602b7dc2aac17fa7fe2f
SHA1 (patch-lib_isc_netmgr_netmgr.c) = 63168c8901646e7b2079e1dc3324087508bb1e62
SHA1 (patch-lib_isc_netmgr_tcp.c) = f71556e21a6416af012b8d37a9ffb7c3ed4aa986
SHA1 (patch-lib_isc_rwlock.c) = 1d114248ddee20db7a7429afab446f8b2f0dca82
SHA1 (patch-lib_isc_siphash.c) = 1527f960967148cece7337a453fe868e812fd5f1
SHA1 (patch-lib_isc_stats.c) = 024a372d9919fa751b894f8fc8267691297f00f4
SHA1 (patch-lib_isc_task.c) = 103a23c74888edd3ddee0793ce6531cd2e6b87f3
SHA1 (patch-lib_isc_unix_include_isc_align.h) = 1bbd78f1617a40079d1044175cfe037bbd1d95b2
SHA1 (patch-lib_isc_unix_net.c) = c654f60a1feefdba9bf980dcfa46ce37f46918aa
SHA1 (patch-lib_isc_unix_socket.c) = 48fb35ae552164ce2ce3fb0df76db8df4271d2ee
SHA1 (patch-lib_isc_unix_time.c) = fac9e66754e099f53ba8c499f5f179825a0b0fbd
SHA1 (patch-lib_ns_Makefile.in) = 5626877ffe97261518f976bb8dd827cdb53668ed
SHA1 (patch-lib_ns_client.c) = e0453a7483a4f899023e0c5ab970cda241976b90
SHA1 (patch-lib_ns_include_ns_client.h) = 56009c601d54491ffd16f6438d55206705a5aa23
SHA1 (patch-lib_ns_include_ns_pfilter.h) = cc86752971b4f9f7492283c4ad3ff29bc1bae237
SHA1 (patch-lib_ns_interfacemgr.c) = fc31720734b02155acd7fa9b370a6ebb82022532
SHA1 (patch-lib_ns_pfilter.c) = c2e7c747a7f1faf3c82871581b6eb561a5c31d77
SHA1 (patch-lib_ns_query.c) = fb9ee13205a95a7fc52893406dbeaf3145640ea6
SHA1 (patch-lib_ns_update.c) = 30468795b1d8ea5b81ad799a395a8a37ec7fa2d0
SHA1 (patch-lib_ns_xfrout.c) = 82fe2dd10feaef58a042103b9d417bfeb49d12b7
SHA1 (patch-make_rules.in) = b4e340237b4d444dbd857a8c2a4760182569173d

File Added: pkgsrc/net/bind916/options.mk
# $NetBSD: options.mk,v 1.1 2020/08/09 15:20:21 taca Exp $

PKG_OPTIONS_VAR=	PKG_OPTIONS.bind916
PKG_SUPPORTED_OPTIONS=	bind-dig-sigchase bind-xml-statistics-server
PKG_SUPPORTED_OPTIONS+=	bind-json-statistics-server blacklist
PKG_SUPPORTED_OPTIONS+=	threads readline lmdb mysql pgsql ldap dlz-filesystem
PKG_SUPPORTED_OPTIONS+=	geoip tuning dnstap # pkcs11
PKG_SUGGESTED_OPTIONS+=	readline

PLIST_VARS+=	dnstap lmdb pkcs11

PTHREAD_OPTS+=		native
.include "../../mk/pthread.buildlink3.mk"

.if defined(PTHREAD_TYPE) && (${PTHREAD_TYPE} == "none") || \
	!empty(MACHINE_PLATFORM:MNetBSD-*-vax) || \
	!empty(MACHINE_PLATFORM:MNetBSD-*-sparc) || \
	!empty(MACHINE_PLATFORM:MNetBSD-*-sparc64) || \
	!empty(MACHINE_PLATFORM:MNetBSD-*-m68k)
# don't touch PKG_SUGGESTED_OPTIONS
.else
PKG_SUGGESTED_OPTIONS+=	threads
.endif

.if ${OPSYS} == "NetBSD"
.  if !empty(OS_VERSION:M[8-9].*)
PKG_SUGGESTED_OPTIONS+=	blacklist
.  endif
.endif

.include "../../mk/bsd.options.mk"

###
### The mysql pgsql ldap dlz-filesystem options are all for BIND
### DLZ (Dynamically Loadable Zones) functionality
###
### NOTE: bdb is excluded on purpose as pkgsrc does not contain
###       a bdb v4.1 or 4.2 package which is what BIND needs.
###       The majority of these are compile tested only
###

.if !empty(PKG_OPTIONS:Mlmdb)
.include "../../databases/lmdb/buildlink3.mk"
CONFIGURE_ARGS+=	--with-lmdb=${PREFIX}
PLIST.lmdb=		yes
.endif

.if !empty(PKG_OPTIONS:Mmysql)
.include "../../mk/mysql.buildlink3.mk"
CONFIGURE_ARGS+=	--with-dlz-mysql=${BUILDLINK_PREFIX.mysql-client}
.endif

.if !empty(PKG_OPTIONS:Mpgsql)
.include "../../mk/pgsql.buildlink3.mk"
CONFIGURE_ARGS+=	--with-dlz-postgres=${BUILDLINK_PREFIX.${PGSQL_TYPE}}
CONFIGURE_ENV+=		ac_cv_path_PG_CONFIG=${PREFIX}/bin/pg_config
.endif

.if !empty(PKG_OPTIONS:Mldap)
.include "../../databases/openldap-client/buildlink3.mk"
CONFIGURE_ARGS+=	--with-dlz-ldap=${BUILDLINK_PREFIX.openldap-client}
.endif

.if !empty(PKG_OPTIONS:Mdlz-filesystem)
CONFIGURE_ARGS+=	--with-dlz-filesystem
.endif

.if !empty(PKG_OPTIONS:Mblacklist)
CONFIGURE_ARGS+=	--with-blacklist=yes
.else
CONFIGURE_ARGS+=	--with-blacklist=no
.endif

.if !empty(PKG_OPTIONS:Mgeoip)
CONFIGURE_ARGS+=	--with-geoip=${PREFIX}
LDFLAGS+=		-lGeoIP
.include "../../net/GeoIP/buildlink3.mk"
.endif

#.if !empty(PKG_OPTIONS:Mpkcs11)
#CONFIGURE_ARGS+=	--enable-native-pkcs11
#PLIST.pkcs11=		yes
#.else
#CONFIGURE_ARGS+=	--disable-native-pkcs11
#.endif

.if !empty(PKG_OPTIONS:Mtuning)
CONFIGURE_ARGS+=	--with-tuning=large
.endif

.if !empty(PKG_OPTIONS:Mdnstap)
CONFIGURE_ARGS+=	--enable-dnstap
PLIST.dnstap=		yes
.include "../../net/fstrm/buildlink3.mk"
.include "../../devel/protobuf/buildlink3.mk"
.include "../../devel/protobuf-c/buildlink3.mk"
.endif

###
### The statistics server in bind99 and later needs libxml2
###
.if !empty(PKG_OPTIONS:Mbind-xml-statistics-server)
.include "../../textproc/libxml2/buildlink3.mk"
CONFIGURE_ARGS+=	--with-libxml2
LDFLAGS+=		-lxml2
.else
CONFIGURE_ARGS+=	--without-libxml2
.endif

###
### The statistics server in bind911 and later supports json
###
.if !empty(PKG_OPTIONS:Mbind-json-statistics-server)
.include "../../textproc/json-c/buildlink3.mk"
CONFIGURE_ARGS+=	--with-libjson
.else
CONFIGURE_ARGS+=	--without-libjson
.endif

###
### pthreads support (also see magic above)
###
.if !empty(PKG_OPTIONS:Mthreads)
PTHREAD_AUTO_VARS=	yes
.endif

###
### readline support in dig(1) and nsupdate(1).
###
.if !empty(PKG_OPTIONS:Mreadline)
.include "../../mk/readline.buildlink3.mk"
CONFIGURE_ARGS+=	--with-readline
.else
CONFIGURE_ARGS+=	--without-readline
.endif

###
### dig(1) option +sigchase for DNSSEC signature chasing
###
.if !empty(PKG_OPTIONS:Mbind-dig-sigchase)
# If anything else needs to add entries to STD_CDEFINES, this will need
# to be changed so that the two can cooperate.
CONFIGURE_ENV+=		STD_CDEFINES=-DDIG_SIGCHASE=1
.endif

File Added: pkgsrc/net/bind916/files/named9.sh
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: named9.sh,v 1.1 2020/08/09 15:20:21 taca Exp $
#

# PROVIDE: named
# REQUIRE: NETWORKING mountcritremote syslogd
# BEFORE:  DAEMON
# KEYWORD: chrootdir

. /etc/rc.subr

name="named"
rcvar="${name}9"
command="@PREFIX@/sbin/${name}"
pidfile="@VARBASE@/run/named/${name}.pid"
start_precmd="named_precmd"
extra_commands="reload"
required_dirs="$named_chrootdir"	# if it is set, it must exist

named_precmd()
{
	# Die if $named is also set (i.e. the system's named is not disabled
	if checkyesno named ; then
		warn \
	"disable 'named' when setting 'named9'!"
		return 1
	fi

       	if [ ! -d @VARBASE@/run/named ]; then 
		@MKDIR@ @VARBASE@/run/named 
       	fi      

	if [ -z "$named_chrootdir" ]; then
		return 0;
	fi

	for i in crypto null random urandom
	do
		if [ ! -c "${named_chrootdir}/dev/$i" ]; then
			@RM@ -f "${named_chrootdir}/dev/$i"
			(cd /dev &&
				@PAX@ -rw -pe "$i" "${named_chrootdir}/dev")
		fi
	done

	if [ -f /etc/localtime ]; then
		@CMP@ -s /etc/localtime "${named_chrootdir}/etc/localtime" || \
		    @CP@ -p /etc/localtime "${named_chrootdir}/etc/localtime"
	fi

	if [ -f @SSLBASE@/lib/engines/libgost.so ]; then
		if [ ! -d ${named_chrootdir}@SSLBASE@/lib/engines ]; then
			@MKDIR@ ${named_chrootdir}@SSLBASE@/lib/engines
		fi
		@CMP@ -s @SSLBASE@/lib/engines/libgost.so "${named_chrootdir}@SSLBASE@/lib/engines/libgost.so" || \
		    @CP@ -p @SSLBASE@/lib/engines/libgost.so "${named_chrootdir}@SSLBASE@/lib/engines/libgost.so"
	fi

       	if [ ! -d ${named_chrootdir}@VARBASE@/run/named ]; then 
		@MKDIR@ ${named_chrootdir}@VARBASE@/run/named 
		@CHOWN@ @BIND_USER@ ${named_chrootdir}@VARBASE@/run/named
       	fi      

	@RM@ -f ${pidfile}
	@LN@ -s "${named_chrootdir}${pidfile}" ${pidfile}

	#	Change run_rc_commands()'s internal copy of $named_flags
	#
	rc_flags="-u @BIND_USER@ -t ${named_chrootdir} $rc_flags"
}

load_rc_config "$rcvar"
run_rc_command "$1"

File Added: pkgsrc/net/bind916/files/smf/manifest.xml
<?xml version="1.0"?>
<!--
CDDL HEADER START

The contents of this file are subject to the terms of the
Common Development and Distribution License (the "License").
You may not use this file except in compliance with the License.

You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
or http://www.opensolaris.org/os/licensing.
See the License for the specific language governing permissions
and limitations under the License.

When distributing Covered Code, include this CDDL HEADER in each
file and include the License file at usr/src/OPENSOLARIS.LICENSE.
If applicable, add the following below this CDDL HEADER, with the
fields enclosed by brackets "[]" replaced with your own identifying
information: Portions Copyright [yyyy] [name of copyright owner]

CDDL HEADER END
-->
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
        Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
        Use is subject to license terms.

        ident   "@(#)server.xml 1.8     07/06/19 SMI"
-->
<!-- Portions Copyright 2007 Vedran Bender -->
<service_bundle type='manifest' name='export'>
  <service name='@SMF_PREFIX@/@SMF_NAME@' type='service' version='1'>
    <dependency name='filesystem_minimal' grouping='require_all' restart_on='none' type='service'>
      <service_fmri value='svc:/system/filesystem/local' />
    </dependency>
    <dependency name='loopback' grouping='require_any' restart_on='error' type='service'>
      <service_fmri value='svc:/network/loopback' />
    </dependency>
    <dependency name='network' grouping='optional_all' restart_on='error' type='service'>
      <service_fmri value='svc:/milestone/network' />
    </dependency>
    <dependency name='config-files' grouping='require_any' restart_on='refresh' type='path'>
      <service_fmri value='file://localhost@PKG_SYSCONFDIR@/named.conf' />
    </dependency>
    <!--
        In order to run multiple named(1M) processes with their own
        configuration file or properties each must have a unique
        instance.
    -->
    <instance name='default' enabled='false'>
      <exec_method type='method' name='start' exec='@PREFIX@/@SMF_METHOD_FILE.named@ %m %i' timeout_seconds='60'>
        <method_context>
          <method_credential user='root' group='root' />
        </method_context>
      </exec_method>
      <exec_method type='method' name='stop' exec='@PREFIX@/@SMF_METHOD_FILE.named@ %m %i %{restarter/contract}' timeout_seconds='60'>
        <method_context>
          <method_credential user='root' group='root' />
        </method_context>

      </exec_method>
      <!--
              SIGHUP causes named to reread its configuration file, but not any
              of the properties below.
      -->
      <exec_method type='method' name='refresh' exec=':kill -HUP' timeout_seconds='60'>
        <method_context />
      </exec_method>
      <property_group name='general' type='framework'>
        <!-- manage DNS server state -->
        <propval name='action_authorization' type='astring' value='solaris.smf.manage.bind' />
        <propval name='value_authorization' type='astring' value='solaris.smf.manage.bind' />
      </property_group>
      <!-- Default property settings for named(1M) instance. -->
      <property_group name='options' type='application'>
        <!--
                server: specifies an alternative server command.  If
                not specified the default /usr/sbin/named is used.
        -->
        <propval name='server' type='astring' value='' />
        <!--
                configuration_file: specifies an alternative
                configuration file to be used. The property is similar
                to named(1M) command line option '-c'
        -->
        <propval name='configuration_file' type='astring' value='' />
        <!--
                ip_interfaces: specifies which IP transport BIND will
                transmit on. Possible values are 'IPv4' or 'IPv6'. Any
                other setting assumes 'all', the default.
                Equivalent command line option '-4' or '-6'.
        -->
        <propval name='ip_interfaces' type='astring' value='all' />
        <!--
                listen_on_port: Specifies the default UDP and TCP port
                which will be used to listen for DNS requests.
                Equivalent command line option '-p <integer>'.
        -->
        <propval name='listen_on_port' type='integer' value='0' />
        <!--
                debug_level: Specifies the default debug level.  The
                default is 0; no debugging. The Higher the number the
                more verbose debug information becomes.
                Equivalent command line option '-d <integer>'.
        -->
        <propval name='debug_level' type='integer' value='0' />
        <!--
                threads: Specifies the number of cpu worker threads to
                create.  The default of 0 causes named to try and
                determine the number of CPUs present and create one
                thread per CPU.
                Equivalent command line option '-n <integer>'.
        -->
        <propval name='threads' type='integer' value='0' />
        <!--
                chroot_dir: Change the root directory using chroot(2)
                to directory after processing the command line
                arguments, but before reading the configuration file.
                Equivalent command line option '-t <pathname>'.
        -->
        <propval name='chroot_dir' type='astring' value='' />
	<!--
		user: Change the user id after processing command line
		arguments, but before reading the configuration file.
		Equivalent command line option '-u <user>'.
	-->
        <propval name='user' type='astring' value='named' />
      </property_group>
    </instance>
    <template>
      <common_name>
        <loctext xml:lang='C'>BIND DNS server</loctext>
      </common_name>
      <documentation>
        <manpage title='named' section='1M' manpath='@PREFIX@/@PKGMANDIR@' />
      </documentation>
    </template>
  </service>
</service_bundle>

File Added: pkgsrc/net/bind916/files/smf/named.sh
#!@SMF_METHOD_SHELL@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
#pragma ident	"@(#)dns-server.sh	1.1	07/03/26 SMI"

# smf_method(5) start/stop script required for server DNS

. /lib/svc/share/smf_include.sh

mount_chroot ()
{
    c=$1
    shift
    for f in $*; do
        if [ -z "${f}" -o ! -f "${f}" -o \
             -z "${c}" -o ! -d "${c}" ]; then
             exit ${SMF_EXIT_ERR_CONFIG}
        fi

        umount ${c}/${f} >/dev/null 2>&1
        mkdir -p `dirname ${c}/${f}`
        touch ${c}/${f}
        mount -Flofs ${f} ${c}/${f}
    done
}

umount_chroot ()
{
    c=$1
    shift
    for f in $*; do
        umount ${c}/${f} >/dev/null 2>&1
    done
}

get_config ()
{   
    configuration_file=@PKG_SYSCONFDIR@/named.conf
    rndc_config_file=@PKG_SYSCONFDIR@/rndc.conf
    rndc_key_file=@PKG_SYSCONFDIR@/rndc.key
    rndc_cmd_opts="-a"
    libraries="/usr/pkg/lib/engines/libgost.so"
    cmdopts=""
    checkopts=""
    properties="debug_level ip_interfaces listen_on_port
        threads chroot_dir configuration_file server user"

    for prop in $properties
    do
        value=`/usr/bin/svcprop -p options/${prop} ${SMF_FMRI}`
        if [ -z "${value}" -o "${value}" = '""' ]; then
            continue;
        fi

        case $prop in
        'debug_level')
            if [ ${value} -gt 0 ]; then
                cmdopts="${cmdopts} -d ${value}"
            fi
            ;;
        'ip_interfaces')
            case ${value} in
                'IPv4')
                    cmdopts="${cmdopts} -4";;
                'IPv6')
                    cmdopts="${cmdopts} -6";;
                'all')
                    :   # Default is all, therefore ignore.
                    ;;
                *)  
                    echo "$I: Unrecognised value in service instance property" >&2
                    echo "$I: options/${prop} : ${value}" >&2
                    ;;
            esac
            ;;
        'listen_on_port')
            if [ ${value} -gt 0 ]; then
                cmdopts="${cmdopts} -p ${value}"
            fi
            ;;
        'threads')
            if [ ${value} -gt 0 ]; then
                cmdopts="${cmdopts} -n ${value}"
            fi
            ;;
        'chroot_dir')
            cmdopts="${cmdopts} -t ${value}"
            checkopts="${checkopts} -t ${value}"
            chroot_dir=${value};
            ;;
        'configuration_file')
            cmdopts="${cmdopts} -c ${value}"
            checkopts="${checkopts} ${value}"
            configuration_file=${value};
            ;;
        'server')
            set -- `echo ${value} | /usr/bin/sed -e  's/\\\\//g'`
            server=$@
            ;;
        'user')
            cmdopts="${cmdopts} -u ${value}"
            cmduser=${value};
            ;;
        esac
    done

    configuration_dir=$(sed -n -e 's,^[[:space:]]*directory.*"\(.*\)";,\1,p' \
        ${configuration_file})
    [ "${configuration_dir}" == "" ] && configuration_dir=@PKG_SYSCONFDIR@/namedb

    configuration_files=$(sed -n -e \
        "s,^[[:space:]]*file.*\"\(.*\)\";,${configuration_dir}/\1,p" \
        ${configuration_file} | sort -u)
    configuration_files="${configuration_files} ${configuration_file}"    
}

result=${SMF_EXIT_OK}

# Read command line arguments
method="$1"		# %m
instance="$2" 		# %i
contract="$3"		# %{restarter/contract}

# Set defaults; SMF_FMRI should have been set, but just in case.
if [ -z "$SMF_FMRI" ]; then
    SMF_FMRI="svc:/@SMF_PREFIX@/@SMF_NAME@:${instance}"
fi
server="@PREFIX@/sbin/named"
checkconf="@PREFIX@/sbin/named-checkconf"
I=`/usr/bin/basename $0`

case "$method" in
'start')
    get_config

    # If chroot option is set, note zones(5) are preferred, then
    # configuration file lives under chroot directory.
    if [ "${chroot_dir}" != "" ]; then
        if [ "${chroot_dir}" = "/" ]; then
            msg="$I: chroot_dir must not be /"
            echo ${msg} >&2
            /usr/bin/logger -p daemon.error ${msg}
            # dns-server should be placed in maintenance state.
            exit ${SMF_EXIT_ERR_CONFIG}
        fi

        server="env LD_NOLAZYLOAD=1 ${server}"
        checkconf="env LD_NOLAZYLOAD=1 ${checkconf}"

        mkdir -p ${chroot_dir}

        if [ "${SMF_ZONENAME}" = "global" ]; then
            for dev in crypto log null poll random urandom; do
                rm -f ${chroot_dir}/dev/${dev}
                pax -rw -H -pe /dev/${dev} ${chroot_dir}
            done
        fi

	missing=""
        for dev in crypto null poll random urandom; do
	    if [ ! -e "${chroot_dir}/dev/${dev}" ]; then
		missing="${missing} ${dev}"
	    fi
        done

        if [ ! -z "${missing}" ]; then
            msg="$I: missing device nodes in ${chroot_dir}: ${missing}"
            echo ${msg} >&2
            /usr/bin/logger -p daemon.err ${msg}
            # dns-server should be placed in maintenance state.
            exit ${SMF_EXIT_ERR_CONFIG}
        fi

        mount_chroot ${chroot_dir} ${configuration_files} ${libraries}

        mkdir -p ${chroot_dir}/var/run/named
        chown ${cmduser}:${cmduser} ${chroot_dir}/var/run/named

        configuration_file=${chroot_dir}${configuration_file}
        rndc_config_file=${chroot_dir}${rndc_config_file}
        rndc_key_file=${chroot_dir}${rndc_key_file}
        rndc_cmd_opts="${rndc_cmd_opts} -t ${chroot_dir}"
    else
        mkdir -p 0770 @VARBASE@/run/named
        chown ${cmduser}:${cmduser} @VARBASE@/run/named
    fi

    # Check if the rndc config file exists.
    if [ ! -f ${rndc_config_file} ]; then
        # If not, check if the default rndc key file exists.
        if [ ! -f ${rndc_key_file} ]; then
            echo "$I: Creating default rndc key file: ${rndc_key_file}." >&2
            @PREFIX@/sbin/rndc-confgen ${rndc_cmd_opts}
            if [ $? -ne 0 ]; then
                echo "$I : Warning: rndc configuration failed! Use of 'rndc' to" \
                    "control 'named' may fail and 'named' may report further error" \
                    "messages to the system log. This is not fatal. For more" \
                    "information see rndc(1M) and rndc-confgen(1M)." >&2
            fi
        fi
    fi

    if [ ${result} = ${SMF_EXIT_OK} ]; then
        ${checkconf} -z ${checkopts}
        result=$?
        if [ $result -ne 0 ]; then
            msg="$I: named-checkconf failed to verify configuration"
            echo ${msg} >&2
            /usr/bin/logger -p daemon.error ${msg}
            if [ "${chroot_dir}" != "" -a "${chroot_dir}" != "/" ]; then
                umount_chroot ${chroot_dir} ${configuration_files} ${libraries}
            fi
            # dns-server should be placed in maintenance state.
            exit ${SMF_EXIT_ERR_CONFIG}
        fi
    fi

    if [ ${result} = ${SMF_EXIT_OK} ]; then
	echo "$I: Executing: ${server} ${cmdopts}"
	# Execute named(1M) with relevant command line options.
	${server} ${cmdopts}
	result=$?
    fi
    ;;
'stop')
    get_config

    smf_kill_contract ${contract} TERM 1
    [ $? -ne 0 ] && exit 1

    if [ "${chroot_dir}" != "" -a "${chroot_dir}" != "/" ]; then
        umount_chroot ${chroot_dir} ${configuration_files} ${libraries}
    fi

    ;;
*)
    echo "Usage: $I [stop|start] <instance>" >&2
    exit 1
    ;;
esac
exit ${result}

File Added: pkgsrc/net/bind916/patches/patch-bin_dig_dighost.c
$NetBSD: patch-bin_dig_dighost.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- bin/dig/dighost.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ bin/dig/dighost.c
@@ -164,7 +164,7 @@ isc_mempool_t *commctx = NULL;
 bool debugging = false;
 bool debugtiming = false;
 bool memdebugging = false;
-char *progname = NULL;
+const char *progname = NULL;
 isc_mutex_t lookup_lock;
 dig_lookup_t *current_lookup = NULL;
 

File Added: pkgsrc/net/bind916/patches/patch-bin_dig_include_dig_dig.h
$NetBSD: patch-bin_dig_include_dig_dig.h,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- bin/dig/include/dig/dig.h.orig	2020-05-06 09:59:35.000000000 +0000
+++ bin/dig/include/dig/dig.h
@@ -230,7 +230,7 @@ extern bool		 free_now;
 extern bool		 debugging, debugtiming, memdebugging;
 extern bool		 keep_open;
 
-extern char *progname;
+extern const char *progname;
 extern int   tries;
 extern int   fatalexit;
 extern bool  verbose;

File Added: pkgsrc/net/bind916/patches/patch-bin_named_Makefile.in
$NetBSD: patch-bin_named_Makefile.in,v 1.1 2020/08/09 15:20:22 taca Exp $

* Dirty hack to prevent WRKDIR reference.

--- bin/named/Makefile.in.orig	2020-05-06 09:59:35.000000000 +0000
+++ bin/named/Makefile.in
@@ -127,7 +127,7 @@ main.@O@: main.c
 		-DPRODUCT=\"${PRODUCT}\" \
 		-DDESCRIPTION=\"${DESCRIPTION}\" \
 		-DSRCID=\"${SRCID}\" \
-		-DCONFIGARGS="\"${CONFIGARGS}\"" \
+		-DCONFIGARGS="\"${CONFIGARGS:S/${WRKDIR}\/.tools/${PREFIX}/g:S/${WRKDIR}\/.buildlink/${PREFIX}/g}\"" \
 		-DBUILDER="\"make\"" \
 		-DNAMED_LOCALSTATEDIR=\"${localstatedir}\" \
 		-DNAMED_SYSCONFDIR=\"${sysconfdir}\" -c ${srcdir}/main.c

File Added: pkgsrc/net/bind916/patches/patch-bin_named_main.c
$NetBSD: patch-bin_named_main.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base including support for blacklistd.

--- bin/named/main.c.orig	2020-06-10 21:01:43.000000000 +0000
+++ bin/named/main.c
@@ -94,6 +94,10 @@
 #ifdef HAVE_ZLIB
 #include <zlib.h>
 #endif /* ifdef HAVE_ZLIB */
+#ifdef HAVE_BLACKLIST
+#include <ns/pfilter.h>
+#endif /* ifdef HAVE_BLACKLIST */
+
 /*
  * Include header files for database drivers here.
  */
@@ -1529,6 +1533,10 @@ main(int argc, char *argv[]) {
 
 	parse_command_line(argc, argv);
 
+#ifdef HAVE_BLACKLIST
+	pfilter_enable();
+#endif
+
 #ifdef ENABLE_AFL
 	if (named_g_fuzz_type != isc_fuzz_none) {
 		named_fuzz_setup();

File Added: pkgsrc/net/bind916/patches/patch-bin_named_server.c
$NetBSD: patch-bin_named_server.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base, especially disable checking working directory
  is writable as BIND_USER in NetBSD base system.

--- bin/named/server.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ bin/named/server.c
@@ -6667,12 +6667,14 @@ directory_callback(const char *clausenam
 			    directory);
 	}
 
+#if 0
 	if (!isc_file_isdirwritable(directory)) {
 		isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
 			      NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR,
 			      "directory '%s' is not writable", directory);
 		return (ISC_R_NOPERM);
 	}
+#endif
 
 	result = isc_dir_chdir(directory);
 	if (result != ISC_R_SUCCESS) {
@@ -9110,6 +9112,7 @@ load_configuration(const char *filename,
 		named_os_changeuser();
 	}
 
+#if 0
 	/*
 	 * Check that the working directory is writable.
 	 */
@@ -9120,7 +9123,7 @@ load_configuration(const char *filename,
 		result = ISC_R_NOPERM;
 		goto cleanup;
 	}
-
+#endif
 #ifdef HAVE_LMDB
 	/*
 	 * Reopen NZD databases.

File Added: pkgsrc/net/bind916/patches/patch-bin_nsupdate_nsupdate.c
$NetBSD: patch-bin_nsupdate_nsupdate.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* C syntax.

--- bin/nsupdate/nsupdate.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ bin/nsupdate/nsupdate.c
@@ -212,8 +212,6 @@ typedef struct nsu_gssinfo {
 } nsu_gssinfo_t;
 
 static void
-failed_gssrequest();
-static void
 start_gssrequest(dns_name_t *master);
 static void
 send_gssrequest(isc_sockaddr_t *destaddr, dns_message_t *msg,
@@ -2893,7 +2891,7 @@ get_ticket_realm(isc_mem_t *mctx) {
 }
 
 static void
-failed_gssrequest() {
+failed_gssrequest(void) {
 	seenerror = true;
 
 	dns_name_free(&tmpzonename, gmctx);

File Added: pkgsrc/net/bind916/patches/patch-bin_pkcs11_pkcs11-keygen.c
$NetBSD: patch-bin_pkcs11_pkcs11-keygen.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Honor HAVE_PKCS11_ECDSA.

--- bin/pkcs11/pkcs11-keygen.c.orig	2019-02-27 23:42:04.000000000 +0000
+++ bin/pkcs11/pkcs11-keygen.c
@@ -421,13 +421,23 @@ main(int argc, char *argv[]) {
 		id_offset = ECC_ID;
 
 		if (bits == 256) {
+#if HAVE_PKCS11_ECDSA
 			public_template[4].pValue = pk11_ecc_prime256v1;
 			public_template[4].ulValueLen =
 				sizeof(pk11_ecc_prime256v1);
+#else
+			fprintf(stderr, "PRIME256v1 is not supported\n");
+			usage();
+#endif
 		} else {
+#if HAVE_PKCS11_ECDSA
 			public_template[4].pValue = pk11_ecc_secp384r1;
 			public_template[4].ulValueLen =
 				sizeof(pk11_ecc_secp384r1);
+#else
+			fprintf(stderr, "SEP384r1 is not supported\n");
+			usage();
+#endif
 		}
 
 		break;

File Added: pkgsrc/net/bind916/patches/Attic/patch-bin_tests_system_kasp_tests.sh
$NetBSD: patch-bin_tests_system_kasp_tests.sh,v 1.1 2020/08/09 15:20:22 taca Exp $

Fix shell portability.

--- bin/tests/system/kasp/tests.sh.orig	2020-07-03 10:44:14.000000000 +0000
+++ bin/tests/system/kasp/tests.sh
@@ -320,7 +320,7 @@ check_key() {
 	# Check file existence.
 	[ -s "$KEY_FILE" ] || ret=1
 	[ -s "$PRIVATE_FILE" ] || ret=1
-	if [ "$_legacy" == "no" ]; then
+	if [ "$_legacy" = "no" ]; then
 		[ -s "$STATE_FILE" ] || ret=1
 	fi
 	[ "$ret" -eq 0 ] || log_error "${BASE_FILE} files missing"
@@ -331,7 +331,7 @@ check_key() {
 	KEY_CREATED=$(awk '{print $3}' < "${ZONE}.${KEY_ID}.${_alg_num}.created")
 
 	grep "Created: ${KEY_CREATED}" "$PRIVATE_FILE" > /dev/null || log_error "mismatch created in $PRIVATE_FILE"
-	if [ "$_legacy" == "no" ]; then
+	if [ "$_legacy" = "no" ]; then
 		grep "Generated: ${KEY_CREATED}" "$STATE_FILE" > /dev/null || log_error "mismatch generated in $STATE_FILE"
 	fi
 
@@ -344,9 +344,9 @@ check_key() {
 	grep "Private-key-format: v1.3" "$PRIVATE_FILE" > /dev/null || log_error "mismatch private key format in $PRIVATE_FILE"
 	grep "Algorithm: ${_alg_num} (${_alg_string})" "$PRIVATE_FILE" > /dev/null || log_error "mismatch algorithm in $PRIVATE_FILE"
 	# Now check the key state file.
-	if [ "$_legacy" == "no" ]; then
+	if [ "$_legacy" = "no" ]; then
 		grep "This is the state of key ${_key_id}, for ${_zone}." "$STATE_FILE" > /dev/null || log_error "mismatch top comment in $STATE_FILE"
-		if [ "$_lifetime" == "none" ]; then
+		if [ "$_lifetime" = "none" ]; then
 			grep "Lifetime: " "$STATE_FILE" > /dev/null && log_error "unexpected lifetime in $STATE_FILE"
 		else
 			grep "Lifetime: ${_lifetime}" "$STATE_FILE" > /dev/null || log_error "mismatch lifetime in $STATE_FILE"
@@ -438,13 +438,13 @@ check_timingmetadata() {
 	if [ "$_published" = "none" ]; then
 		grep "; Publish:" "${_key_file}" > /dev/null && log_error "unexpected publish comment in ${_key_file}"
 		grep "Publish:" "${_private_file}" > /dev/null && log_error "unexpected publish in ${_private_file}"
-		if [ "$_legacy" == "no" ]; then
+		if [ "$_legacy" = "no" ]; then
 			grep "Published: " "${_state_file}" > /dev/null && log_error "unexpected publish in ${_state_file}"
 		fi
 	else
 		grep "; Publish: $_published" "${_key_file}" > /dev/null || log_error "mismatch publish comment in ${_key_file} (expected ${_published})"
 		grep "Publish: $_published" "${_private_file}" > /dev/null || log_error "mismatch publish in ${_private_file} (expected ${_published})"
-		if [ "$_legacy" == "no" ]; then
+		if [ "$_legacy" = "no" ]; then
 			grep "Published: $_published" "${_state_file}" > /dev/null || log_error "mismatch publish in ${_state_file} (expected ${_published})"
 		fi
 	fi
@@ -452,13 +452,13 @@ check_timingmetadata() {
 	if [ "$_syncpublish" = "none" ]; then
 		grep "; SyncPublish:" "${_key_file}" > /dev/null && log_error "unexpected syncpublish comment in ${_key_file}"
 		grep "SyncPublish:" "${_private_file}" > /dev/null && log_error "unexpected syncpublish in ${_private_file}"
-		if [ "$_legacy" == "no" ]; then
+		if [ "$_legacy" = "no" ]; then
 			grep "PublishCDS: " "${_state_file}" > /dev/null && log_error "unexpected syncpublish in ${_state_file}"
 		fi
 	else
 		grep "; SyncPublish: $_syncpublish" "${_key_file}" > /dev/null || log_error "mismatch syncpublish comment in ${_key_file} (expected ${_syncpublish})"
 		grep "SyncPublish: $_syncpublish" "${_private_file}" > /dev/null || log_error "mismatch syncpublish in ${_private_file} (expected ${_syncpublish})"
-		if [ "$_legacy" == "no" ]; then
+		if [ "$_legacy" = "no" ]; then
 			grep "PublishCDS: $_syncpublish" "${_state_file}" > /dev/null || log_error "mismatch syncpublish in ${_state_file} (expected ${_syncpublish})"
 		fi
 	fi
@@ -466,13 +466,13 @@ check_timingmetadata() {
 	if [ "$_active" = "none" ]; then
 		grep "; Activate:" "${_key_file}" > /dev/null && log_error "unexpected active comment in ${_key_file}"
 		grep "Activate:" "${_private_file}" > /dev/null && log_error "unexpected active in ${_private_file}"
-		if [ "$_legacy" == "no" ]; then
+		if [ "$_legacy" = "no" ]; then
 			grep "Active: " "${_state_file}" > /dev/null && log_error "unexpected active in ${_state_file}"
 		fi
 	else
 		grep "; Activate: $_active" "${_key_file}" > /dev/null || log_error "mismatch active comment in ${_key_file} (expected ${_active})"
 		grep "Activate: $_active" "${_private_file}" > /dev/null || log_error "mismatch active in ${_private_file} (expected ${_active})"
-		if [ "$_legacy" == "no" ]; then
+		if [ "$_legacy" = "no" ]; then
 			grep "Active: $_active" "${_state_file}" > /dev/null || log_error "mismatch active in ${_state_file} (expected ${_active})"
 		fi
 	fi
@@ -480,13 +480,13 @@ check_timingmetadata() {
 	if [ "$_retired" = "none" ]; then
 		grep "; Inactive:" "${_key_file}" > /dev/null && log_error "unexpected retired comment in ${_key_file}"
 		grep "Inactive:" "${_private_file}" > /dev/null && log_error "unexpected retired in ${_private_file}"
-		if [ "$_legacy" == "no" ]; then
+		if [ "$_legacy" = "no" ]; then
 			grep "Retired: " "${_state_file}" > /dev/null && log_error "unexpected retired in ${_state_file}"
 		fi
 	else
 		grep "; Inactive: $_retired" "${_key_file}" > /dev/null || log_error "mismatch retired comment in ${_key_file} (expected ${_retired})"
 		grep "Inactive: $_retired" "${_private_file}" > /dev/null || log_error "mismatch retired in ${_private_file} (expected ${_retired})"
-		if [ "$_legacy" == "no" ]; then
+		if [ "$_legacy" = "no" ]; then
 			grep "Retired: $_retired" "${_state_file}" > /dev/null || log_error "mismatch retired in ${_state_file} (expected ${_retired})"
 		fi
 	fi
@@ -494,13 +494,13 @@ check_timingmetadata() {
 	if [ "$_revoked" = "none" ]; then
 		grep "; Revoke:" "${_key_file}" > /dev/null && log_error "unexpected revoked comment in ${_key_file}"
 		grep "Revoke:" "${_private_file}" > /dev/null && log_error "unexpected revoked in ${_private_file}"
-		if [ "$_legacy" == "no" ]; then
+		if [ "$_legacy" = "no" ]; then
 			grep "Revoked: " "${_state_file}" > /dev/null && log_error "unexpected revoked in ${_state_file}"
 		fi
 	else
 		grep "; Revoke: $_revoked" "${_key_file}" > /dev/null || log_error "mismatch revoked comment in ${_key_file} (expected ${_revoked})"
 		grep "Revoke: $_revoked" "${_private_file}" > /dev/null || log_error "mismatch revoked in ${_private_file} (expected ${_revoked})"
-		if [ "$_legacy" == "no" ]; then
+		if [ "$_legacy" = "no" ]; then
 			grep "Revoked: $_revoked" "${_state_file}" > /dev/null || log_error "mismatch revoked in ${_state_file} (expected ${_revoked})"
 		fi
 	fi
@@ -508,13 +508,13 @@ check_timingmetadata() {
 	if [ "$_removed" = "none" ]; then
 		grep "; Delete:" "${_key_file}" > /dev/null && log_error "unexpected removed comment in ${_key_file}"
 		grep "Delete:" "${_private_file}" > /dev/null && log_error "unexpected removed in ${_private_file}"
-		if [ "$_legacy" == "no" ]; then
+		if [ "$_legacy" = "no" ]; then
 			grep "Removed: " "${_state_file}" > /dev/null && log_error "unexpected removed in ${_state_file}"
 		fi
 	else
 		grep "; Delete: $_removed" "${_key_file}" > /dev/null || log_error "mismatch removed comment in ${_key_file} (expected ${_removed})"
 		grep "Delete: $_removed" "${_private_file}" > /dev/null || log_error "mismatch removed in ${_private_file} (expected ${_removed})"
-		if [ "$_legacy" == "no" ]; then
+		if [ "$_legacy" = "no" ]; then
 			grep "Removed: $_removed" "${_state_file}" > /dev/null || log_error "mismatch removed in ${_state_file} (expected ${_removed})"
 		fi
 	fi
@@ -586,7 +586,7 @@ key_unused() {
 	grep "Revoke:" "$PRIVATE_FILE" > /dev/null && log_error "unexpected revoked in $PRIVATE_FILE"
 	grep "Delete:" "$PRIVATE_FILE" > /dev/null && log_error "unexpected removed in $PRIVATE_FILE"
 
-	if [ "$_legacy" == "no" ]; then
+	if [ "$_legacy" = "no" ]; then
 		grep "Published: " "$STATE_FILE" > /dev/null && log_error "unexpected publish in $STATE_FILE"
 		grep "Active: " "$STATE_FILE" > /dev/null && log_error "unexpected active in $STATE_FILE"
 		grep "Retired: " "$STATE_FILE" > /dev/null && log_error "unexpected retired in $STATE_FILE"
@@ -1324,7 +1324,7 @@ set_keytimes_algorithm_policy() {
 	set_keytime    "KEY1" "PUBLISHED" "${created}"
 	set_keytime    "KEY1" "ACTIVE"    "${created}"
 	# Key was pregenerated.
-	if [ "$1" == "pregenerated" ]; then
+	if [ "$1" = "pregenerated" ]; then
 		keyfile=$(key_get KEY1 BASEFILE)
 		grep "; Publish:" "${keyfile}.key" > published.test${n}.key1
 		published=$(awk '{print $3}' < published.test${n}.key1)
@@ -1351,7 +1351,7 @@ set_keytimes_algorithm_policy() {
 	set_keytime    "KEY2" "PUBLISHED" "${created}"
 	set_keytime    "KEY2" "ACTIVE"    "${created}"
 	# Key was pregenerated.
-	if [ "$1" == "pregenerated" ]; then
+	if [ "$1" = "pregenerated" ]; then
 		keyfile=$(key_get KEY2 BASEFILE)
 		grep "; Publish:" "${keyfile}.key" > published.test${n}.key2
 		published=$(awk '{print $3}' < published.test${n}.key2)
@@ -1374,7 +1374,7 @@ set_keytimes_algorithm_policy() {
 	set_keytime    "KEY3" "PUBLISHED" "${created}"
 	set_keytime    "KEY3" "ACTIVE"    "${created}"
 	# Key was pregenerated.
-	if [ "$1" == "pregenerated" ]; then
+	if [ "$1" = "pregenerated" ]; then
 		keyfile=$(key_get KEY3 BASEFILE)
 		grep "; Publish:" "${keyfile}.key" > published.test${n}.key3
 		published=$(awk '{print $3}' < published.test${n}.key3)
@@ -2541,12 +2541,12 @@ rollover_predecessor_keytimes() {
 	set_addkeytime  "KEY1" "PUBLISHED"   "${_created}" "${_addtime}"
 	set_addkeytime  "KEY1" "SYNCPUBLISH" "${_created}" "${_addtime}"
 	set_addkeytime  "KEY1" "ACTIVE"      "${_created}" "${_addtime}"
-	[ "$Lksk" == 0 ] || set_retired_removed "KEY1" "${Lksk}" "${IretKSK}"
+	[ "$Lksk" = 0 ] || set_retired_removed "KEY1" "${Lksk}" "${IretKSK}"
 
 	_created=$(key_get KEY2 CREATED)
 	set_addkeytime  "KEY2" "PUBLISHED"   "${_created}" "${_addtime}"
 	set_addkeytime  "KEY2" "ACTIVE"      "${_created}" "${_addtime}"
-	[ "$Lzsk" == 0 ] || set_retired_removed "KEY2" "${Lzsk}" "${IretZSK}"
+	[ "$Lzsk" = 0 ] || set_retired_removed "KEY2" "${Lzsk}" "${IretZSK}"
 }
 
 # Key properties.
@@ -2994,7 +2994,7 @@ csk_rollover_predecessor_keytimes() {
 	set_addkeytime      "KEY1" "PUBLISHED"   "${_created}" "${_addksktime}"
 	set_addkeytime      "KEY1" "SYNCPUBLISH" "${_created}" "${_addzsktime}"
 	set_addkeytime      "KEY1" "ACTIVE"      "${_created}" "${_addzsktime}"
-	[ "$Lcsk" == 0 ] || set_retired_removed "KEY1" "${Lcsk}" "${IretCSK}"
+	[ "$Lcsk" = 0 ] || set_retired_removed "KEY1" "${Lcsk}" "${IretCSK}"
 }
 
 #
@@ -3908,8 +3908,8 @@ dnssec_verify
 n=$((n+1))
 echo_i "check that of zone ${ZONE} migration to dnssec-policy uses the same keys ($n)"
 ret=0
-[ $_migrate_ksk == $(key_get KEY1 ID) ] || log_error "mismatch ksk tag"
-[ $_migrate_zsk == $(key_get KEY2 ID) ] || log_error "mismatch zsk tag"
+[ $_migrate_ksk = $(key_get KEY1 ID) ] || log_error "mismatch ksk tag"
+[ $_migrate_zsk = $(key_get KEY2 ID) ] || log_error "mismatch zsk tag"
 status=$((status+ret))
 
 # Test migration to dnssec-policy, existing keys do not match key algorithm.
@@ -4024,8 +4024,8 @@ dnssec_verify
 n=$((n+1))
 echo_i "check that of zone ${ZONE} migration to dnssec-policy keeps existing keys ($n)"
 ret=0
-[ $_migratenomatch_algnum_ksk == $(key_get KEY1 ID) ] || log_error "mismatch ksk tag"
-[ $_migratenomatch_algnum_zsk == $(key_get KEY2 ID) ] || log_error "mismatch zsk tag"
+[ $_migratenomatch_algnum_ksk = $(key_get KEY1 ID) ] || log_error "mismatch ksk tag"
+[ $_migratenomatch_algnum_zsk = $(key_get KEY2 ID) ] || log_error "mismatch zsk tag"
 status=$((status+ret))
 
 # Test migration to dnssec-policy, existing keys do not match key length.
@@ -4141,8 +4141,8 @@ dnssec_verify
 n=$((n+1))
 echo_i "check that of zone ${ZONE} migration to dnssec-policy keeps existing keys ($n)"
 ret=0
-[ $_migratenomatch_alglen_ksk == $(key_get KEY1 ID) ] || log_error "mismatch ksk tag"
-[ $_migratenomatch_alglen_zsk == $(key_get KEY2 ID) ] || log_error "mismatch zsk tag"
+[ $_migratenomatch_alglen_ksk = $(key_get KEY1 ID) ] || log_error "mismatch ksk tag"
+[ $_migratenomatch_alglen_zsk = $(key_get KEY2 ID) ] || log_error "mismatch zsk tag"
 status=$((status+ret))
 
 #

File Added: pkgsrc/net/bind916/patches/Attic/patch-bin_tests_system_metadata_tests.sh
$NetBSD: patch-bin_tests_system_metadata_tests.sh,v 1.1 2020/08/09 15:20:22 taca Exp $

* Avoid using "==" for argument of test(1).

--- bin/tests/system/metadata/tests.sh.orig	2018-07-03 06:56:55.000000000 +0000
+++ bin/tests/system/metadata/tests.sh
@@ -139,7 +139,7 @@ status=`expr $status + $ret`
 
 echo_i "checking warning about permissions change on key with dnssec-settime ($n)"
 uname=`uname -o 2> /dev/null`
-if [ Cygwin == "$uname"  ]; then
+if [ Cygwin = "$uname"  ]; then
 	echo_i "Cygwin detected, skipping"
 else
 	ret=0

File Added: pkgsrc/net/bind916/patches/Attic/patch-bin_tests_system_rpz_tests.sh
$NetBSD: patch-bin_tests_system_rpz_tests.sh,v 1.1 2020/08/09 15:20:22 taca Exp $

* Avoid using "==" for argument of test(1).

--- bin/tests/system/rpz/tests.sh.orig	2019-04-06 20:09:59.000000000 +0000
+++ bin/tests/system/rpz/tests.sh
@@ -209,7 +209,7 @@ restart () {
 	fi
     fi
     rm -f ns$1/*.jnl
-    if [ "$2" == "rebuild-bl-rpz" ]; then
+    if [ "$2" = "rebuild-bl-rpz" ]; then
         if test -f ns$1/base.db; then
 	    for NM in ns$1/bl*.db; do
 	        cp -f ns$1/base.db $NM

File Added: pkgsrc/net/bind916/patches/Attic/patch-bin_tools_arpaname.c
$NetBSD: patch-bin_tools_arpaname.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* C syntax.

--- bin/tools/arpaname.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ bin/tools/arpaname.c
@@ -14,7 +14,7 @@
 #include <isc/net.h>
 #include <isc/print.h>
 
-#define UNUSED(x) (void)(x)
+#define UNUSED(x) (void)&(x)
 
 int
 main(int argc, char *argv[]) {

File Added: pkgsrc/net/bind916/patches/patch-bin_tools_nsec3hash.c
$NetBSD: patch-bin_tools_nsec3hash.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* C syntax.

--- bin/tools/nsec3hash.c.orig	2019-04-06 20:09:59.000000000 +0000
+++ bin/tools/nsec3hash.c
@@ -56,7 +56,7 @@ check_result(isc_result_t result, const 
 }
 
 static void
-usage() {
+usage(void) {
 	fprintf(stderr, "Usage: %s salt algorithm iterations domain\n",
 		program);
 	fprintf(stderr, "       %s -r algorithm flags iterations salt domain\n",

File Added: pkgsrc/net/bind916/patches/patch-config.guess
$NetBSD: patch-config.guess,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- config.guess.orig	2020-05-06 09:59:35.000000000 +0000
+++ config.guess
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright 1992-2013 Free Software Foundation, Inc.
+#   Copyright 1992-2017 Free Software Foundation, Inc.
 
-timestamp='2013-11-29'
+timestamp='2017-01-01'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -24,12 +24,12 @@ timestamp='2013-11-29'
 # program.  This Exception is an additional permission under section 7
 # of the GNU General Public License, version 3 ("GPLv3").
 #
-# Originally written by Per Bothner.
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
 #
 # You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
 #
-# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+# Please send patches to <config-patches@gnu.org>.
 
 
 me=`echo "$0" | sed -e 's,.*/,,'`
@@ -50,7 +50,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright 1992-2013 Free Software Foundation, Inc.
+Copyright 1992-2017 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -149,7 +149,7 @@ Linux|GNU|GNU/*)
 	LIBC=gnu
 	#endif
 	EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
 	;;
 esac
 
@@ -168,19 +168,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$
 	# Note: NetBSD doesn't particularly care about the vendor
 	# portion of the name.  We always set it to "unknown".
 	sysctl="sysctl -n hw.machine_arch"
-	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
-	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
+	    /sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || \
+	    echo unknown)`
 	case "${UNAME_MACHINE_ARCH}" in
 	    armeb) machine=armeb-unknown ;;
 	    arm*) machine=arm-unknown ;;
 	    sh3el) machine=shl-unknown ;;
 	    sh3eb) machine=sh-unknown ;;
 	    sh5el) machine=sh5le-unknown ;;
+	    earmv*)
+		arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+		endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
+		machine=${arch}${endian}-unknown
+		;;
 	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
 	esac
 	# The Operating System including object format, if it has switched
-	# to ELF recently, or will in the future.
+	# to ELF recently (or will in the future) and ABI.
 	case "${UNAME_MACHINE_ARCH}" in
+	    earm*)
+		os=netbsdelf
+		;;
 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
 		eval $set_cc_for_build
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
@@ -197,6 +207,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$
 		os=netbsd
 		;;
 	esac
+	# Determine ABI tags.
+	case "${UNAME_MACHINE_ARCH}" in
+	    earm*)
+		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
+		abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
+		;;
+	esac
 	# The OS release
 	# Debian GNU/NetBSD machines have a different userland, and
 	# thus, need a distinct triplet. However, they do not need
@@ -207,13 +224,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$
 		release='-gnu'
 		;;
 	    *)
-		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
 		;;
 	esac
 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
 	# contains redundant information, the shorter form:
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-	echo "${machine}-${os}${release}"
+	echo "${machine}-${os}${release}${abi}"
 	exit ;;
     *:Bitrig:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
@@ -223,6 +240,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
 	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
 	exit ;;
+    *:LibertyBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
+	exit ;;
     *:ekkoBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
 	exit ;;
@@ -235,6 +256,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$
     *:MirBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
 	exit ;;
+    *:Sortix:*:*)
+	echo ${UNAME_MACHINE}-unknown-sortix
+	exit ;;
     alpha:OSF1:*:*)
 	case $UNAME_RELEASE in
 	*4.0)
@@ -251,42 +275,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$
 	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
 	case "$ALPHA_CPU_TYPE" in
 	    "EV4 (21064)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "EV4.5 (21064)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "LCA4 (21066/21068)")
-		UNAME_MACHINE="alpha" ;;
+		UNAME_MACHINE=alpha ;;
 	    "EV5 (21164)")
-		UNAME_MACHINE="alphaev5" ;;
+		UNAME_MACHINE=alphaev5 ;;
 	    "EV5.6 (21164A)")
-		UNAME_MACHINE="alphaev56" ;;
+		UNAME_MACHINE=alphaev56 ;;
 	    "EV5.6 (21164PC)")
-		UNAME_MACHINE="alphapca56" ;;
+		UNAME_MACHINE=alphapca56 ;;
 	    "EV5.7 (21164PC)")
-		UNAME_MACHINE="alphapca57" ;;
+		UNAME_MACHINE=alphapca57 ;;
 	    "EV6 (21264)")
-		UNAME_MACHINE="alphaev6" ;;
+		UNAME_MACHINE=alphaev6 ;;
 	    "EV6.7 (21264A)")
-		UNAME_MACHINE="alphaev67" ;;
+		UNAME_MACHINE=alphaev67 ;;
 	    "EV6.8CB (21264C)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.8AL (21264B)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.8CX (21264D)")
-		UNAME_MACHINE="alphaev68" ;;
+		UNAME_MACHINE=alphaev68 ;;
 	    "EV6.9A (21264/EV69A)")
-		UNAME_MACHINE="alphaev69" ;;
+		UNAME_MACHINE=alphaev69 ;;
 	    "EV7 (21364)")
-		UNAME_MACHINE="alphaev7" ;;
+		UNAME_MACHINE=alphaev7 ;;
 	    "EV7.9 (21364A)")
-		UNAME_MACHINE="alphaev79" ;;
+		UNAME_MACHINE=alphaev79 ;;
 	esac
 	# A Pn.n version is a patched version.
 	# A Vn.n version is a released version.
 	# A Tn.n version is a released field test version.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
 	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
 	exitcode=$?
 	trap '' 0
@@ -359,16 +383,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$
 	exit ;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
 	eval $set_cc_for_build
-	SUN_ARCH="i386"
+	SUN_ARCH=i386
 	# If there is a compiler, see if it is configured for 64-bit objects.
 	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
 	# This test works for both compilers.
-	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
 	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
-		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
 		grep IS_64BIT_ARCH >/dev/null
 	    then
-		SUN_ARCH="x86_64"
+		SUN_ARCH=x86_64
 	    fi
 	fi
 	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
@@ -393,7 +417,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$
 	exit ;;
     sun*:*:4.2BSD:*)
 	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
-	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
 	case "`/bin/arch`" in
 	    sun3)
 		echo m68k-sun-sunos${UNAME_RELEASE}
@@ -579,8 +603,9 @@ EOF
 	else
 		IBM_ARCH=powerpc
 	fi
-	if [ -x /usr/bin/oslevel ] ; then
-		IBM_REV=`/usr/bin/oslevel`
+	if [ -x /usr/bin/lslpp ] ; then
+		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
+			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
 	else
 		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
 	fi
@@ -617,13 +642,13 @@ EOF
 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
 		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
 		    case "${sc_cpu_version}" in
-		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
+		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
 		      532)                      # CPU_PA_RISC2_0
 			case "${sc_kernel_bits}" in
-			  32) HP_ARCH="hppa2.0n" ;;
-			  64) HP_ARCH="hppa2.0w" ;;
-			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+			  32) HP_ARCH=hppa2.0n ;;
+			  64) HP_ARCH=hppa2.0w ;;
+			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
 			esac ;;
 		    esac
 		fi
@@ -662,11 +687,11 @@ EOF
 		    exit (0);
 		}
 EOF
-		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
 		fi ;;
 	esac
-	if [ ${HP_ARCH} = "hppa2.0w" ]
+	if [ ${HP_ARCH} = hppa2.0w ]
 	then
 	    eval $set_cc_for_build
 
@@ -679,12 +704,12 @@ EOF
 	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
 	    # => hppa64-hp-hpux11.23
 
-	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
 		grep -q __LP64__
 	    then
-		HP_ARCH="hppa2.0w"
+		HP_ARCH=hppa2.0w
 	    else
-		HP_ARCH="hppa64"
+		HP_ARCH=hppa64
 	    fi
 	fi
 	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
@@ -789,14 +814,14 @@ EOF
 	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
-	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
 	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
 	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
     5000:UNIX_System_V:4.*:*)
-	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
 	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
@@ -826,7 +851,7 @@ EOF
     *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
-    i*:MSYS*:*)
+    *:MSYS*:*)
 	echo ${UNAME_MACHINE}-pc-msys
 	exit ;;
     i*:windows32*:*)
@@ -878,7 +903,7 @@ EOF
 	exit ;;
     *:GNU/*:*:*)
 	# other systems with GNU libc and userland
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
 	exit ;;
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
@@ -901,7 +926,7 @@ EOF
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
 	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
-	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     arc:Linux:*:* | arceb:Linux:*:*)
@@ -932,6 +957,9 @@ EOF
     crisv32:Linux:*:*)
 	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 	exit ;;
+    e2k:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     frv:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
@@ -944,6 +972,9 @@ EOF
     ia64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
+    k1om:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     m32r*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
@@ -969,10 +1000,13 @@ EOF
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
 	;;
-    or1k:Linux:*:*)
+    mips64el:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
-    or32:Linux:*:*)
+    openrisc*:Linux:*:*)
+	echo or1k-unknown-linux-${LIBC}
+	exit ;;
+    or32:Linux:*:* | or1k*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     padre:Linux:*:*)
@@ -1001,6 +1035,9 @@ EOF
     ppcle:Linux:*:*)
 	echo powerpcle-unknown-linux-${LIBC}
 	exit ;;
+    riscv32:Linux:*:* | riscv64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
 	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
 	exit ;;
@@ -1020,7 +1057,7 @@ EOF
 	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
 	exit ;;
     x86_64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
 	exit ;;
     xtensa*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
@@ -1099,7 +1136,7 @@ EOF
 	# uname -m prints for DJGPP always 'pc', but it prints nothing about
 	# the processor, so we play safe by assuming i586.
 	# Note: whatever this is, it MUST be the same as what config.sub
-	# prints for the "djgpp" host, or else GDB configury will decide that
+	# prints for the "djgpp" host, or else GDB configure will decide that
 	# this is a cross-build.
 	echo i586-pc-msdosdjgpp
 	exit ;;
@@ -1248,6 +1285,9 @@ EOF
     SX-8R:SUPER-UX:*:*)
 	echo sx8r-nec-superux${UNAME_RELEASE}
 	exit ;;
+    SX-ACE:SUPER-UX:*:*)
+	echo sxace-nec-superux${UNAME_RELEASE}
+	exit ;;
     Power*:Rhapsody:*:*)
 	echo powerpc-apple-rhapsody${UNAME_RELEASE}
 	exit ;;
@@ -1261,9 +1301,9 @@ EOF
 	    UNAME_PROCESSOR=powerpc
 	fi
 	if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
-	    if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
 		if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
-		    (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		    (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
 		    grep IS_64BIT_ARCH >/dev/null
 		then
 		    case $UNAME_PROCESSOR in
@@ -1285,7 +1325,7 @@ EOF
 	exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
 	UNAME_PROCESSOR=`uname -p`
-	if test "$UNAME_PROCESSOR" = "x86"; then
+	if test "$UNAME_PROCESSOR" = x86; then
 		UNAME_PROCESSOR=i386
 		UNAME_MACHINE=pc
 	fi
@@ -1316,7 +1356,7 @@ EOF
 	# "uname -m" is not consistent, so use $cputype instead. 386
 	# is converted to i386 for consistency with other x86
 	# operating systems.
-	if test "$cputype" = "386"; then
+	if test "$cputype" = 386; then
 	    UNAME_MACHINE=i386
 	else
 	    UNAME_MACHINE="$cputype"
@@ -1358,7 +1398,7 @@ EOF
 	echo i386-pc-xenix
 	exit ;;
     i*86:skyos:*:*)
-	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
 	exit ;;
     i*86:rdos:*:*)
 	echo ${UNAME_MACHINE}-pc-rdos
@@ -1369,171 +1409,25 @@ EOF
     x86_64:VMkernel:*:*)
 	echo ${UNAME_MACHINE}-unknown-esx
 	exit ;;
-esac
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
-  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
-     I don't know....  */
-  printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
-  printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
-	"4"
-#else
-	""
-#endif
-	); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
-  printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
-  int version;
-  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
-  if (version < 4)
-    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
-  else
-    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
-  exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
-  printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
-  printf ("ns32k-encore-mach\n"); exit (0);
-#else
-  printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
-  printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
-  printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
-  printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
-    struct utsname un;
-
-    uname(&un);
-
-    if (strncmp(un.version, "V2", 2) == 0) {
-	printf ("i386-sequent-ptx2\n"); exit (0);
-    }
-    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
-	printf ("i386-sequent-ptx1\n"); exit (0);
-    }
-    printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-#  include <sys/param.h>
-#  if defined (BSD)
-#   if BSD == 43
-      printf ("vax-dec-bsd4.3\n"); exit (0);
-#   else
-#    if BSD == 199006
-      printf ("vax-dec-bsd4.3reno\n"); exit (0);
-#    else
-      printf ("vax-dec-bsd\n"); exit (0);
-#    endif
-#   endif
-#  else
-    printf ("vax-dec-bsd\n"); exit (0);
-#  endif
-# else
-    printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
-  printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
-  exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
-	{ echo "$SYSTEM_NAME"; exit; }
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
-    case `getsysinfo -f cpu_type` in
-    c1*)
-	echo c1-convex-bsd
-	exit ;;
-    c2*)
-	if getsysinfo -f scalar_acc
-	then echo c32-convex-bsd
-	else echo c2-convex-bsd
-	fi
-	exit ;;
-    c34*)
-	echo c34-convex-bsd
-	exit ;;
-    c38*)
-	echo c38-convex-bsd
+    amd64:Isilon\ OneFS:*:*)
+	echo x86_64-unknown-onefs
 	exit ;;
-    c4*)
-	echo c4-convex-bsd
-	exit ;;
-    esac
-fi
+esac
 
 cat >&2 <<EOF
 $0: unable to guess system type
 
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
+This script (version $timestamp), has failed to recognize the
+operating system you are using. If your script is old, overwrite
+config.guess and config.sub with the latest versions from:
 
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
 and
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
 
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
+If $0 has already been updated, send the following data and any
+information you think might be pertinent to config-patches@gnu.org to
+provide the necessary information to handle your system.
 
 config.guess timestamp = $timestamp
 

File Added: pkgsrc/net/bind916/patches/patch-config.h.in
$NetBSD: patch-config.h.in,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base, adding support for blacklistd.

--- config.h.in.orig	2019-06-04 15:20:04.000000000 +0000
+++ config.h.in
@@ -48,6 +48,9 @@
 /* define if the ARM yield instruction is available */
 #undef HAVE_ARM_YIELD
 
+/* Define to 1 if blacklist is supported. */
+#undef HAVE_BLACKLIST
+
 /* Define to 1 if the compiler supports __builtin_clz. */
 #undef HAVE_BUILTIN_CLZ
 

File Added: pkgsrc/net/bind916/patches/patch-config.sub
$NetBSD: patch-config.sub,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- config.sub.orig	2020-05-06 09:59:35.000000000 +0000
+++ config.sub
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright 1992-2013 Free Software Foundation, Inc.
+#   Copyright 1992-2017 Free Software Foundation, Inc.
 
-timestamp='2013-10-01'
+timestamp='2017-01-01'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ timestamp='2013-10-01'
 # of the GNU General Public License, version 3 ("GPLv3").
 
 
-# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+# Please send patches to <config-patches@gnu.org>.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
@@ -33,7 +33,7 @@ timestamp='2013-10-01'
 # Otherwise, we print the canonical config type on stdout and succeed.
 
 # You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
 
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
@@ -53,8 +53,7 @@ timestamp='2013-10-01'
 me=`echo "$0" | sed -e 's,.*/,,'`
 
 usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
-       $0 [OPTION] ALIAS
+Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
 
 Canonicalize a configuration name.
 
@@ -68,7 +67,7 @@ Report bugs and patches to <config-patch
 version="\
 GNU config.sub ($timestamp)
 
-Copyright 1992-2013 Free Software Foundation, Inc.
+Copyright 1992-2017 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -117,8 +116,8 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-
 case $maybe_os in
   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
   linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
-  knetbsd*-gnu* | netbsd*-gnu* | \
-  kopensolaris*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
+  kopensolaris*-gnu* | cloudabi*-eabi* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -255,12 +254,13 @@ case $basic_machine in
 	| arc | arceb \
 	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
 	| avr | avr32 \
+	| ba \
 	| be32 | be64 \
 	| bfin \
 	| c4x | c8051 | clipper \
 	| d10v | d30v | dlx | dsp16xx \
-	| epiphany \
-	| fido | fr30 | frv \
+	| e2k | epiphany \
+	| fido | fr30 | frv | ft32 \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| hexagon \
 	| i370 | i860 | i960 | ia64 \
@@ -283,8 +283,10 @@ case $basic_machine in
 	| mips64vr5900 | mips64vr5900el \
 	| mipsisa32 | mipsisa32el \
 	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa32r6 | mipsisa32r6el \
 	| mipsisa64 | mipsisa64el \
 	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64r6 | mipsisa64r6el \
 	| mipsisa64sb1 | mipsisa64sb1el \
 	| mipsisa64sr71k | mipsisa64sr71kel \
 	| mipsr5900 | mipsr5900el \
@@ -296,14 +298,15 @@ case $basic_machine in
 	| nds32 | nds32le | nds32be \
 	| nios | nios2 | nios2eb | nios2el \
 	| ns16k | ns32k \
-	| open8 \
-	| or1k | or32 \
+	| open8 | or1k | or1knd | or32 \
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle \
+	| pru \
 	| pyramid \
+	| riscv32 | riscv64 \
 	| rl78 | rx \
 	| score \
-	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
@@ -311,6 +314,7 @@ case $basic_machine in
 	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
 	| ubicom32 \
 	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+	| visium \
 	| we32k \
 	| x86 | xc16x | xstormy16 | xtensa \
 	| z8k | z80)
@@ -325,6 +329,9 @@ case $basic_machine in
 	c6x)
 		basic_machine=tic6x-unknown
 		;;
+	leon|leon[3-9])
+		basic_machine=sparc-$basic_machine
+		;;
 	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
 		basic_machine=$basic_machine-unknown
 		os=-none
@@ -370,12 +377,13 @@ case $basic_machine in
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* | avr32-* \
+	| ba-* \
 	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* \
 	| c8051-* | clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
-	| elxsi-* \
+	| e2k-* | elxsi-* \
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
@@ -402,8 +410,10 @@ case $basic_machine in
 	| mips64vr5900-* | mips64vr5900el-* \
 	| mipsisa32-* | mipsisa32el-* \
 	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa32r6-* | mipsisa32r6el-* \
 	| mipsisa64-* | mipsisa64el-* \
 	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64r6-* | mipsisa64r6el-* \
 	| mipsisa64sb1-* | mipsisa64sb1el-* \
 	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
 	| mipsr5900-* | mipsr5900el-* \
@@ -415,16 +425,19 @@ case $basic_machine in
 	| nios-* | nios2-* | nios2eb-* | nios2el-* \
 	| none-* | np1-* | ns16k-* | ns32k-* \
 	| open8-* \
+	| or1k*-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+	| pru-* \
 	| pyramid-* \
+	| riscv32-* | riscv64-* \
 	| rl78-* | romp-* | rs6000-* | rx-* \
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
 	| tahoe-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
 	| tile*-* \
@@ -432,6 +445,7 @@ case $basic_machine in
 	| ubicom32-* \
 	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
 	| vax-* \
+	| visium-* \
 	| we32k-* \
 	| x86-* | x86_64-* | xc16x-* | xps100-* \
 	| xstormy16-* | xtensa*-* \
@@ -508,6 +522,9 @@ case $basic_machine in
 		basic_machine=i386-pc
 		os=-aros
 		;;
+	asmjs)
+		basic_machine=asmjs-unknown
+		;;
 	aux)
 		basic_machine=m68k-apple
 		os=-aux
@@ -628,6 +645,14 @@ case $basic_machine in
 		basic_machine=m68k-bull
 		os=-sysv3
 		;;
+	e500v[12])
+		basic_machine=powerpc-unknown
+		os=$os"spe"
+		;;
+	e500v[12]-*)
+		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=$os"spe"
+		;;
 	ebmon29k)
 		basic_machine=a29k-amd
 		os=-ebmon
@@ -769,6 +794,9 @@ case $basic_machine in
 		basic_machine=m68k-isi
 		os=-sysv
 		;;
+	leon-*|leon[3-9]-*)
+		basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
+		;;
 	m68knommu)
 		basic_machine=m68k-unknown
 		os=-linux
@@ -824,6 +852,10 @@ case $basic_machine in
 		basic_machine=powerpc-unknown
 		os=-morphos
 		;;
+	moxiebox)
+		basic_machine=moxie-unknown
+		os=-moxiebox
+		;;
 	msdos)
 		basic_machine=i386-pc
 		os=-msdos
@@ -1000,7 +1032,7 @@ case $basic_machine in
 	ppc-* | ppcbe-*)
 		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	ppcle | powerpclittle | ppc-le | powerpc-little)
+	ppcle | powerpclittle)
 		basic_machine=powerpcle-unknown
 		;;
 	ppcle-* | powerpclittle-*)
@@ -1010,7 +1042,7 @@ case $basic_machine in
 		;;
 	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+	ppc64le | powerpc64little)
 		basic_machine=powerpc64le-unknown
 		;;
 	ppc64le-* | powerpc64little-*)
@@ -1356,27 +1388,28 @@ case $os in
 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
 	      | -sym* | -kopensolaris* | -plan9* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-	      | -aos* | -aros* \
+	      | -aos* | -aros* | -cloudabi* | -sortix* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-	      | -bitrig* | -openbsd* | -solidbsd* \
+	      | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
-	      | -chorusos* | -chorusrdb* | -cegcc* \
+	      | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
 	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+	      | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
 	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
-	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
+	      | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1508,6 +1541,8 @@ case $os in
 		;;
 	-nacl*)
 		;;
+	-ios)
+		;;
 	-none)
 		;;
 	*)
@@ -1594,9 +1629,6 @@ case $basic_machine in
 	mips*-*)
 		os=-elf
 		;;
-	or1k-*)
-		os=-elf
-		;;
 	or32-*)
 		os=-coff
 		;;
@@ -1606,6 +1638,9 @@ case $basic_machine in
 	sparc-* | *-sun)
 		os=-sunos4.1.1
 		;;
+	pru-*)
+		os=-elf
+		;;
 	*-be)
 		os=-beos
 		;;

File Added: pkgsrc/net/bind916/patches/patch-config.threads.in
$NetBSD: patch-config.threads.in,v 1.1 2020/08/09 15:20:22 taca Exp $

* Add DragonFly support.

--- config.threads.in.orig	2019-04-06 20:09:59.000000000 +0000
+++ config.threads.in
@@ -48,6 +48,8 @@ case $host in
 	use_threads=false ;;
 *-freebsd*)
 	use_threads=true ;;
+*-dragonfly*)
+	use_threads=false ;;
 *-linux*)
 	use_threads=true ;;
 *-darwin[[123456789]].*)

File Added: pkgsrc/net/bind916/patches/Attic/patch-configure
$NetBSD: patch-configure,v 1.1 2020/08/09 15:20:22 taca Exp $

* Add DragonFly support.
* Use proper link options for NetBSD.
* Link proper postgresql library.
* Take from NetBSD base, adding support for blacklistd.

--- configure.orig	2020-07-03 10:44:14.000000000 +0000
+++ configure
@@ -637,6 +637,8 @@ BUILD_LDFLAGS
 BUILD_CPPFLAGS
 BUILD_CFLAGS
 BUILD_CC
+BLACKLISTLINKOBJS
+BLACKLISTLINKSRCS
 DLZ_DRIVER_MYSQL_LIBS
 DLZ_DRIVER_MYSQL_INCLUDES
 DLZ_SYSTEM_TEST
@@ -732,6 +734,8 @@ JSON_C_LIBS
 JSON_C_CFLAGS
 LIBXML2_LIBS
 LIBXML2_CFLAGS
+LIBUV_LIBS
+LIBUV_CFLAGS
 NZD_MANS
 NZDTARGETS
 NZDSRCS
@@ -1719,6 +1723,7 @@ Optional Packages:
   --with-dlz-stub=ARG     Build with stub DLZ driver [yes|no]. (Required to
                           use stub driver with DLZ)
   --with-make-clean       run "make clean" at end of configure [yes|no]
+  --with-blacklist	  Build with blacklist
 
 Some influential environment variables:
   CC          C compiler command
@@ -3917,7 +3922,7 @@ fi
 
 # On IRIX 5.3, sys/types and inttypes.h are conflicting.
 for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-		  inttypes.h stdint.h unistd.h
+		  inttypes.h stdint.h unistd.h blacklist.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
@@ -18385,6 +18390,135 @@ esac
 
 
 
+#
+# was --with-blacklist specified?
+#
+BLACKLISTLINKOBJS=
+BLACKLISTLINKSRCS=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for blacklist library" >&5
+$as_echo_n "checking for blacklist library... " >&6; }
+
+# Check whether --with-blacklist was given.
+if test "${with_blacklist+set}" = set; then :
+  withval=$with_blacklist; with_blacklist="$withval"
+else
+  with_blacklist="auto"
+fi
+
+
+have_blacklist=""
+case "$with_blacklist" in
+	no)
+		;;
+	auto|yes)
+		for d in /usr /usr/local /opt/local
+		do
+			if test -f "${d}/include/blacklist.h"
+			then
+				if test ${d} != /usr
+				then
+					blacklist_cflags="-I ${d}/include"
+					LIBS="$LIBS -L${d}/lib"
+				fi
+				have_blacklist="yes"
+			fi
+		done
+		;;
+	*)
+		if test -f "${with_blacklist}/include/blacklist.h"
+		then
+			blacklist_cflags="-I${with_blacklist}/include"
+			LIBS="$LIBS -L${with_blacklist}/lib"
+			have_blacklist="yes"
+		else
+			as_fn_error $? "$with_blacklist/include/blacklist.h not found." "$LINENO" 5
+		fi
+		;;
+esac
+
+if test "X${have_blacklist}" != "X"
+then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing blacklist" >&5
+$as_echo_n "checking for library containing blacklist... " >&6; }
+if ${ac_cv_search_blacklist+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char blacklist_open(void);
+int
+main ()
+{
+return blacklist_open();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' blacklist; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_blacklist=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_blacklist+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_blacklist+:} false; then :
+
+else
+  ac_cv_search_blacklist=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_blacklist" >&5
+$as_echo "$ac_cv_search_blacklist" >&6; }
+ac_res=$ac_cv_search_blacklist
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+else
+  as_fn_error $? "found blacklist include but not library." "$LINENO" 5
+			have_blacklist=""
+fi
+
+elif test "X$with_blacklist" = Xyes
+then
+	as_fn_error $? "include/blacklist.h not found." "$LINENO" 5
+else
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+BLACKLIST=
+if test "X${have_blacklist}" != "X"
+then
+	CFLAGS="$CFLAGS $blacklist_cflags"
+
+$as_echo "#define HAVE_BLACKLIST 1" >>confdefs.h
+
+	BLACKLIST=1
+	BLACKLISTLINKSRCS='${BLACKLISTLINKSRCS}'
+	BLACKLISTLINKOBJS='${BLACKLISTLINKOBJS}'
+fi
 
 # Check whether --with-zlib was given.
 if test "${with_zlib+set}" = set; then :
@@ -22517,7 +22651,7 @@ else
 
 fi
 	        ;; #(
-  *-freebsd*|*-openbsd*|*-netbsd*) :
+  *-dragonfly*|*-freebsd*|*-openbsd*|*-netbsd*) :
 
 		 LDFLAGS="${LDFLAGS} -Wl,-E"
 		 SO_CFLAGS="-fpic"
@@ -22549,9 +22683,9 @@ fi
 	        ;; #(
   *-solaris*) :
 
-		 SO_CFLAGS="-KPIC"
-		 SO_LDFLAGS="-G -z text"
-		 SO_LD="ld"
+		 SO_CFLAGS="-fPIC"
+		 SO_LDFLAGS="-Xcompiler -shared -Wl,-z -Wl,text"
+		 SO_LD="${CC}"
 	        ;; #(
   ia64-hp-hpux*) :
 
@@ -22980,8 +23114,8 @@ $as_echo "no" >&6; }
 	fi
 	if test -n "-L$use_dlz_postgres_lib -lpq"
 	then
-		DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS -L$use_dlz_postgres_lib -lpq"
-		DLZ_DRIVER_POSTGRES_LIBS="-L$use_dlz_postgres_lib -lpq"
+		DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS -L${PREFIX}/lib -lpq"
+		DLZ_DRIVER_POSTGRES_LIBS="-L${PREFIX}/lib -lpq"
 	fi
 
 
@@ -26186,6 +26320,7 @@ report() {
 	test "X$PYTHON" = "X" || echo "    Python tools (--with-python)"
 	test "X$LIBXML2_LIBS" = "X" || echo "    XML statistics (--with-libxml2)"
 	test "X$JSON_C_LIBS" = "X" || echo "    JSON statistics (--with-json-c): $JSON_C_CFLAGS $JSON_C_LIBS"
+	test "X$BLACKLIST" = "X" || echo "    blacklist support (--with-blacklist)"
 	test "X$ZLIB_LIBS" = "X" || echo "    HTTP zlib compression (--with-zlib)"
 	test "X$NZD_TOOLS" = "X" || echo "    LMDB database to store configuration for 'addzone' zones (--with-lmdb)"
 	test "no" = "$with_libidn2" || echo "    IDN support (--with-libidn2)"
@@ -26264,6 +26399,7 @@ report() {
     test "X$PYTHON" = "X" && echo "    Python tools (--with-python)"
     test "X$LIBXML2_LIBS" = "X" && echo "    XML statistics (--with-libxml2)"
     test "X$JSON_C_LIBS" = "X" && echo "    JSON statistics (--with-json-c)"
+    test "X$BLACKLIST" = "X" && echo "    blacklist support (--with-blacklist)"
     test "X$ZLIB_LIBS" = "X" && echo "    HTTP zlib compression (--with-zlib)"
     test "X$NZD_TOOLS" = "X" && echo "    LMDB database to store configuration for 'addzone' zones (--with-lmdb)"
     test "no" = "$with_libidn2" && echo "    IDN support (--with-libidn2)"

File Added: pkgsrc/net/bind916/patches/patch-contrib_dlz_config.dlz.in
$NetBSD: patch-contrib_dlz_config.dlz.in,v 1.1 2020/08/09 15:20:22 taca Exp $

* Link proper postgresql library.

--- contrib/dlz/config.dlz.in.orig	2018-07-03 06:56:55.000000000 +0000
+++ contrib/dlz/config.dlz.in
@@ -113,7 +113,7 @@ case "$use_dlz_postgres" in
 	*)
 		DLZ_ADD_DRIVER(POSTGRES, dlz_postgres_driver,
 				[-I$use_dlz_postgres],
-				[-L$use_dlz_postgres_lib -lpq])
+				[-L${PREFIX}/lib -lpq])
 
 		AC_MSG_RESULT(
 [using PostgreSQL from $use_dlz_postgres_lib and $use_dlz_postgres])

File Added: pkgsrc/net/bind916/patches/Attic/patch-contrib_dlz_modules_wildcard_dlz__wildcard__dynamic.c
$NetBSD: patch-contrib_dlz_modules_wildcard_dlz__wildcard__dynamic.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- contrib/dlz/modules/wildcard/dlz_wildcard_dynamic.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ contrib/dlz/modules/wildcard/dlz_wildcard_dynamic.c
@@ -59,6 +59,8 @@
 #include <dlz_list.h>
 #include <dlz_minimal.h>
 
+#include <ctype.h>
+
 #define DE_CONST(konst, var)           \
 	do {                           \
 		union {                \

File Added: pkgsrc/net/bind916/patches/patch-lib_dns_byaddr.c
$NetBSD: patch-lib_dns_byaddr.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* C syntax.

--- lib/dns/byaddr.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/dns/byaddr.c
@@ -160,7 +160,7 @@ lookup_done(isc_task_t *task, isc_event_
 		byaddr->event->result = levent->result;
 	}
 	isc_event_free(&event);
-	isc_task_sendanddetach(&byaddr->task, (isc_event_t **)&byaddr->event);
+	isc_task_sendanddetach(&byaddr->task, (isc_event_t **)(void *)&byaddr->event);
 }
 
 static void

File Added: pkgsrc/net/bind916/patches/Attic/patch-lib_dns_dnsrps.c
$NetBSD: patch-lib_dns_dnsrps.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/dns/dnsrps.c.orig	2019-04-06 20:09:59.000000000 +0000
+++ lib/dns/dnsrps.c
@@ -15,6 +15,7 @@
 
 #include <inttypes.h>
 #include <stdbool.h>
+#include <stdlib.h>
 
 #ifdef USE_DNSRPS
 

File Added: pkgsrc/net/bind916/patches/patch-lib_dns_gssapi__link.c
$NetBSD: patch-lib_dns_gssapi__link.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/dns/gssapi_link.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/dns/gssapi_link.c
@@ -179,9 +179,12 @@ gssapi_verify(dst_context_t *dctx, const
 	gss_buffer_desc gmessage, gsig;
 	OM_uint32 minor, gret;
 	gss_ctx_id_t gssctx = dctx->key->keydata.gssctx;
-	unsigned char buf[sig->length];
+	unsigned char buf[4096];
 	char err[1024];
 
+	if (sizeof(buf) < sig->length)
+		abort();
+
 	/*
 	 * Convert the data we wish to sign into a structure gssapi can
 	 * understand.

File Added: pkgsrc/net/bind916/patches/patch-lib_dns_include_dns_zone.h
$NetBSD: patch-lib_dns_include_dns_zone.h,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/dns/include/dns/zone.h.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/dns/include/dns/zone.h
@@ -87,7 +87,9 @@ typedef enum {
 	DNS_ZONEOPT_CHECKSPF = 1 << 27,		/*%< check SPF records */
 	DNS_ZONEOPT_CHECKTTL = 1 << 28,		/*%< check max-zone-ttl */
 	DNS_ZONEOPT_AUTOEMPTY = 1 << 29,	/*%< automatic empty zone */
+#ifndef __NetBSD__
 	DNS_ZONEOPT___MAX = UINT64_MAX, /* trick to make the ENUM 64-bit wide */
+#endif
 } dns_zoneopt_t;
 
 /*
@@ -99,7 +101,9 @@ typedef enum {
 	DNS_ZONEKEY_CREATE = 0x00000004U,   /*%< make keys when needed */
 	DNS_ZONEKEY_FULLSIGN = 0x00000008U, /*%< roll to new keys immediately */
 	DNS_ZONEKEY_NORESIGN = 0x00000010U, /*%< no automatic resigning */
+#ifndef __NetBSD__
 	DNS_ZONEKEY___MAX = UINT64_MAX, /* trick to make the ENUM 64-bit wide */
+#endif
 } dns_zonekey_t;
 
 #ifndef DNS_ZONE_MINREFRESH

File Added: pkgsrc/net/bind916/patches/patch-lib_dns_lookup.c
$NetBSD: patch-lib_dns_lookup.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/dns/lookup.c.orig	2019-04-06 20:09:59.000000000 +0000
+++ lib/dns/lookup.c
@@ -339,7 +339,7 @@ lookup_find(dns_lookup_t *lookup, dns_fe
 		lookup->event->result = result;
 		lookup->event->ev_sender = lookup;
 		isc_task_sendanddetach(&lookup->task,
-				       (isc_event_t **)&lookup->event);
+				       (isc_event_t **)(void *)&lookup->event);
 		dns_view_detach(&lookup->view);
 	}
 

File Added: pkgsrc/net/bind916/patches/Attic/patch-lib_dns_peer.c
$NetBSD: patch-lib_dns_peer.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/dns/peer.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/dns/peer.c
@@ -214,6 +214,8 @@ dns_peer_newprefix(isc_mem_t *mem, const
 
 	peer = isc_mem_get(mem, sizeof(*peer));
 
+#ifndef __lint__
+// XXX: bug
 	*peer = (dns_peer_t){
 		.magic = DNS_PEER_MAGIC,
 		.address = *addr,
@@ -221,6 +223,7 @@ dns_peer_newprefix(isc_mem_t *mem, const
 		.mem = mem,
 		.transfer_format = dns_one_answer,
 	};
+#endif
 
 	isc_refcount_init(&peer->refs, 1);
 

File Added: pkgsrc/net/bind916/patches/patch-lib_dns_rbt.c
$NetBSD: patch-lib_dns_rbt.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.
* Disable inline on powerpc.

--- lib/dns/rbt.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/dns/rbt.c
@@ -301,12 +301,13 @@ Name(dns_rbtnode_t *node) {
 }
 
 static void
-hexdump(const char *desc, unsigned char *data, size_t size) {
+hexdump(const char *desc, void *blob, size_t size) {
 	char hexdump[BUFSIZ * 2 + 1];
 	isc_buffer_t b;
 	isc_region_t r;
 	isc_result_t result;
 	size_t bytes;
+	uint8_t *data = blob;
 
 	fprintf(stderr, "%s: ", desc);
 	do {
@@ -324,6 +325,10 @@ hexdump(const char *desc, unsigned char 
 }
 #endif /* DEBUG */
 
+#if !defined(inline) && defined(__powerpc__)
+#define        inline  /**/
+#endif
+
 /*
  * Upper node is the parent of the root of the passed node's
  * subtree. The passed node must not be NULL.
@@ -545,6 +550,9 @@ serialize_node(FILE *file, dns_rbtnode_t
 	off_t file_position;
 	unsigned char *node_data = NULL;
 	size_t datasize;
+#ifdef DEBUG
+	dns_name_t nodename;
+#endif
 
 	INSIST(node != NULL);
 
@@ -597,10 +605,12 @@ serialize_node(FILE *file, dns_rbtnode_t
 	CHECK(isc_stdio_write(node_data, 1, datasize, file, NULL));
 
 #ifdef DEBUG
+	dns_name_init(&nodename, NULL);
+	NODENAME(node, &nodename);
 	fprintf(stderr, "serialize ");
-	dns_name_print(name, stderr);
+	dns_name_print(&nodename, stderr);
 	fprintf(stderr, "\n");
-	hexdump("node header", (unsigned char *)&temp_node,
+	hexdump("node header", &temp_node,
 		sizeof(dns_rbtnode_t));
 	hexdump("node data", node_data, datasize);
 #endif /* ifdef DEBUG */
@@ -721,7 +731,7 @@ dns_rbt_serialize_tree(FILE *file, dns_r
 
 	isc_crc64_final(&crc);
 #ifdef DEBUG
-	hexdump("serializing CRC", (unsigned char *)&crc, sizeof(crc));
+	hexdump("serializing CRC", &crc, sizeof(crc));
 #endif /* ifdef DEBUG */
 
 	/* Serialize header */
@@ -742,7 +752,7 @@ cleanup:
 			result = ISC_R_INVALIDFILE; \
 			goto cleanup;               \
 		}                                   \
-	} while (0);
+	} while(/*CONSTCOND*/0)
 
 static isc_result_t
 treefix(dns_rbt_t *rbt, void *base, size_t filesize, dns_rbtnode_t *n,
@@ -852,7 +862,7 @@ treefix(dns_rbt_t *rbt, void *base, size
 	fprintf(stderr, "deserialize ");
 	dns_name_print(&nodename, stderr);
 	fprintf(stderr, "\n");
-	hexdump("node header", (unsigned char *)&header, sizeof(dns_rbtnode_t));
+	hexdump("node header", &header, sizeof(dns_rbtnode_t));
 	hexdump("node data", node_data, datasize);
 #endif /* ifdef DEBUG */
 	isc_crc64_update(crc, (const uint8_t *)&header, sizeof(dns_rbtnode_t));
@@ -928,7 +938,7 @@ dns_rbt_deserialize_tree(void *base_addr
 
 	isc_crc64_final(&crc);
 #ifdef DEBUG
-	hexdump("deserializing CRC", (unsigned char *)&crc, sizeof(crc));
+	hexdump("deserializing CRC", &crc, sizeof(crc));
 #endif /* ifdef DEBUG */
 
 	/* Check file hash */

File Added: pkgsrc/net/bind916/patches/patch-lib_dns_rbtdb.c
$NetBSD: patch-lib_dns_rbtdb.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/dns/rbtdb.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/dns/rbtdb.c
@@ -2218,7 +2218,7 @@ prune_tree(isc_task_t *task, isc_event_t
 	NODE_UNLOCK(&rbtdb->node_locks[locknum].lock, isc_rwlocktype_write);
 	RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_write);
 
-	detach((dns_db_t **)&rbtdb);
+	detach((dns_db_t **)(void *)&rbtdb);
 }
 
 static inline void

File Added: pkgsrc/net/bind916/patches/patch-lib_dns_request.c
$NetBSD: patch-lib_dns_request.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/dns/request.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/dns/request.c
@@ -1443,7 +1443,7 @@ req_sendevent(dns_request_t *request, is
 	task = request->event->ev_sender;
 	request->event->ev_sender = request;
 	request->event->result = result;
-	isc_task_sendanddetach(&task, (isc_event_t **)&request->event);
+	isc_task_sendanddetach(&task, (isc_event_t **)(void *)&request->event);
 }
 
 static void
@@ -1460,7 +1460,7 @@ req_destroy(dns_request_t *request) {
 		isc_buffer_free(&request->answer);
 	}
 	if (request->event != NULL) {
-		isc_event_free((isc_event_t **)&request->event);
+		isc_event_free((isc_event_t **)(void *)&request->event);
 	}
 	if (request->dispentry != NULL) {
 		dns_dispatch_removeresponse(&request->dispentry, NULL);

File Added: pkgsrc/net/bind916/patches/patch-lib_dns_sdb.c
$NetBSD: patch-lib_dns_sdb.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/dns/sdb.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/dns/sdb.c
@@ -621,7 +621,7 @@ createnode(dns_sdb_t *sdb, dns_sdbnode_t
 	node = isc_mem_get(sdb->common.mctx, sizeof(dns_sdbnode_t));
 
 	node->sdb = NULL;
-	attach((dns_db_t *)sdb, (dns_db_t **)&node->sdb);
+	attach((dns_db_t *)sdb, (dns_db_t **)(void *)&node->sdb);
 	ISC_LIST_INIT(node->lists);
 	ISC_LIST_INIT(node->buffers);
 	ISC_LINK_INIT(node, link);

File Added: pkgsrc/net/bind916/patches/patch-lib_dns_sdlz.c
$NetBSD: patch-lib_dns_sdlz.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/dns/sdlz.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/dns/sdlz.c
@@ -451,11 +451,14 @@ closeversion(dns_db_t *db, dns_dbversion
 static isc_result_t
 createnode(dns_sdlz_db_t *sdlz, dns_sdlznode_t **nodep) {
 	dns_sdlznode_t *node;
+	void *sdlzv, *tdlzv;
 
 	node = isc_mem_get(sdlz->common.mctx, sizeof(dns_sdlznode_t));
 
 	node->sdlz = NULL;
-	attach((dns_db_t *)sdlz, (dns_db_t **)&node->sdlz);
+	sdlzv = sdlz;
+	tdlzv = &node->sdlz;
+	attach(sdlzv, tdlzv);
 	ISC_LIST_INIT(node->lists);
 	ISC_LIST_INIT(node->buffers);
 	ISC_LINK_INIT(node, link);

File Added: pkgsrc/net/bind916/patches/Attic/patch-lib_dns_spnego.c
$NetBSD: patch-lib_dns_spnego.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base, avoid gcc warning.

--- lib/dns/spnego.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/dns/spnego.c
@@ -1503,7 +1503,7 @@ spnego_initial(OM_uint32 *minor_status,
 	gss_buffer_desc krb5_output_token = GSS_C_EMPTY_BUFFER;
 	unsigned char *buf = NULL;
 	size_t buf_size;
-	size_t len;
+	size_t len = 0;	/* XXX: gcc */
 	int ret;
 
 	(void)mech_type;

File Added: pkgsrc/net/bind916/patches/patch-lib_dns_validator.c
$NetBSD: patch-lib_dns_validator.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/dns/validator.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/dns/validator.c
@@ -221,7 +221,7 @@ validator_done(dns_validator_t *val, isc
 	val->event->ev_type = DNS_EVENT_VALIDATORDONE;
 	val->event->ev_action = val->action;
 	val->event->ev_arg = val->arg;
-	isc_task_sendanddetach(&task, (isc_event_t **)&val->event);
+	isc_task_sendanddetach(&task, (isc_event_t **)(void *)&val->event);
 }
 
 /*

File Added: pkgsrc/net/bind916/patches/patch-lib_dns_view.c
$NetBSD: patch-lib_dns_view.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Use nta sub-directory as NetBSD base system.

--- lib/dns/view.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/dns/view.c
@@ -105,7 +105,7 @@ dns_view_create(isc_mem_t *mctx, dns_rda
 	isc_mem_attach(mctx, &view->mctx);
 	view->name = isc_mem_strdup(mctx, name);
 
-	result = isc_file_sanitize(NULL, view->name, "nta", buffer,
+	result = isc_file_sanitize("nta", view->name, "nta", buffer,
 				   sizeof(buffer));
 	if (result != ISC_R_SUCCESS) {
 		goto cleanup_name;

File Added: pkgsrc/net/bind916/patches/patch-lib_dns_zone.c
$NetBSD: patch-lib_dns_zone.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/dns/zone.c.orig	2020-06-10 21:01:43.000000000 +0000
+++ lib/dns/zone.c
@@ -224,8 +224,13 @@ struct dns_zone {
 	int32_t journalsize;
 	dns_rdataclass_t rdclass;
 	dns_zonetype_t type;
+#ifdef __NetBSD__
+	atomic_uint_fast32_t flags;
+	atomic_uint_fast32_t options;
+#else
 	atomic_uint_fast64_t flags;
 	atomic_uint_fast64_t options;
+#endif
 	unsigned int db_argc;
 	char **db_argv;
 	isc_time_t expiretime;
@@ -370,7 +375,11 @@ struct dns_zone {
 	/*%
 	 * Autosigning/key-maintenance options
 	 */
+#ifdef __NetBSD__
+	atomic_uint_fast32_t keyopts;
+#else
 	atomic_uint_fast64_t keyopts;
+#endif
 
 	/*%
 	 * True if added by "rndc addzone"
@@ -499,7 +508,9 @@ typedef enum {
 						      * notify due to the zone
 						      * just being loaded for
 						      * the first time.  */
+#ifndef __NetBSD__
 	DNS_ZONEFLG___MAX = UINT64_MAX, /* trick to make the ENUM 64-bit wide */
+#endif
 } dns_zoneflg_t;
 
 #define DNS_ZONE_OPTION(z, o)	 ((atomic_load_relaxed(&(z)->options) & (o)) != 0)

File Added: pkgsrc/net/bind916/patches/patch-lib_isc_backtrace.c
$NetBSD: patch-lib_isc_backtrace.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/isc/backtrace.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/isc/backtrace.c
@@ -196,7 +196,7 @@ isc_backtrace_gettrace(void **addrs, int
 	 * first argument.  Note that the body of this function cannot be
 	 * inlined since it depends on the address of the function argument.
 	 */
-	sp = (void **)&addrs - 2;
+	sp = (void **)(void *)&addrs - 2;
 #endif /* ifdef __x86_64__ */
 
 	while (sp != NULL && i < maxaddrs) {

File Added: pkgsrc/net/bind916/patches/Attic/patch-lib_isc_hp.c
$NetBSD: patch-lib_isc_hp.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/isc/hp.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/isc/hp.c
@@ -82,7 +82,7 @@ struct isc_hp {
 };
 
 static inline int
-tid() {
+tid(void) {
 	if (tid_v == TID_UNKNOWN) {
 		tid_v = atomic_fetch_add(&tid_v_base, 1);
 		REQUIRE(tid_v < isc__hp_max_threads);

File Added: pkgsrc/net/bind916/patches/patch-lib_isc_include_isc_netmgr.h
$NetBSD: patch-lib_isc_include_isc_netmgr.h,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/isc/include/isc/netmgr.h.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/isc/include/isc/netmgr.h
@@ -96,6 +96,9 @@ isc_nmhandle_unref(isc_nmhandle_t *handl
  * with the client.)
  */
 
+int
+isc_nmhandle_getfd(isc_nmhandle_t *handle);
+
 void *
 isc_nmhandle_getdata(isc_nmhandle_t *handle);
 

File Added: pkgsrc/net/bind916/patches/patch-lib_isc_include_isc_socket.h
$NetBSD: patch-lib_isc_include_isc_socket.h,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/isc/include/isc/socket.h.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/isc/include/isc/socket.h
@@ -160,7 +160,8 @@ typedef enum {
 	isc_sockettype_udp = 1,
 	isc_sockettype_tcp = 2,
 	isc_sockettype_unix = 3,
-	isc_sockettype_raw = 4
+	isc_sockettype_raw = 4,
+	isc_sockettype_fdwatch = 5
 } isc_sockettype_t;
 
 /*@{*/
@@ -945,12 +946,55 @@ isc_socketmgr_renderjson(isc_socketmgr_t
  */
 #endif /* HAVE_JSON_C */
 
+/*!
+ * Flags for fdwatchcreate.
+ */
+#define ISC_SOCKFDWATCH_READ	0x00000001	/*%< watch for readable */
+#define ISC_SOCKFDWATCH_WRITE	0x00000002	/*%< watch for writable */
+/*@}*/
+
+isc_result_t
+isc_socket_fdwatchcreate(isc_socketmgr_t *manager,
+			 int fd,
+			 int flags,
+			 isc_sockfdwatch_t callback,
+			 void *cbarg,
+			 isc_task_t *task,
+			 isc_socket_t **socketp);
 /*%<
  * See isc_socketmgr_create() above.
  */
 typedef isc_result_t (*isc_socketmgrcreatefunc_t)(isc_mem_t *	    mctx,
 						  isc_socketmgr_t **managerp);
 
+isc_result_t
+isc_socket_fdwatchpoke(isc_socket_t *sock,
+		       int flags);
+/*%<
+ * Poke a file descriptor watch socket informing the manager that it
+ * should restart watching the socket
+ *
+ * Note:
+ *
+ *\li   'sock' is the socket returned by isc_socket_fdwatchcreate
+ *
+ *\li   'flags' indicates what the manager should watch for on the socket
+ *      in addition to what it may already be watching.  It can be one or
+ *      both of ISC_SOCKFDWATCH_READ and ISC_SOCKFDWATCH_WRITE.  To
+ *      temporarily disable watching on a socket the value indicating
+ *      no more data should be returned from the call back routine.
+ *
+ *\li	This function is not available on Windows.
+ *
+ * Requires:
+ *
+ *\li	'sock' is a valid isc socket
+ *
+ *
+ * Returns:
+ *
+ *\li	#ISC_R_SUCCESS
+ */
 ISC_LANG_ENDDECLS
 
 #endif /* ISC_SOCKET_H */

File Added: pkgsrc/net/bind916/patches/patch-lib_isc_include_isc_types.h
$NetBSD: patch-lib_isc_include_isc_types.h,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/isc/include/isc/types.h.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/isc/include/isc/types.h
@@ -84,7 +84,7 @@ typedef struct isc_socket      isc_socke
 typedef struct isc_socketevent isc_socketevent_t;    /*%< Socket Event */
 typedef struct isc_socketmgr   isc_socketmgr_t;	     /*%< Socket Manager */
 typedef struct isc_stats       isc_stats_t;	     /*%< Statistics */
-#if defined(_WIN32) && !defined(_WIN64)
+#if defined(_WIN32) && !defined(_WIN64) || !defined(_LP64)
 typedef int_fast32_t isc_statscounter_t; /*%< Statistics Counter */
 #else  /* if defined(_WIN32) && !defined(_WIN64) */
 typedef int_fast64_t isc_statscounter_t;

File Added: pkgsrc/net/bind916/patches/patch-lib_isc_netmgr_netmgr.c
$NetBSD: patch-lib_isc_netmgr_netmgr.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/isc/netmgr/netmgr.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/isc/netmgr/netmgr.c
@@ -1197,6 +1197,13 @@ isc_nmhandle_getdata(isc_nmhandle_t *han
 	return (handle->opaque);
 }
 
+int
+isc_nmhandle_getfd(isc_nmhandle_t *handle) {
+	REQUIRE(VALID_NMHANDLE(handle));
+
+	return (handle->sock->fd);
+}
+
 void
 isc_nmhandle_setdata(isc_nmhandle_t *handle, void *arg,
 		     isc_nm_opaquecb_t doreset, isc_nm_opaquecb_t dofree) {

File Added: pkgsrc/net/bind916/patches/Attic/patch-lib_isc_netmgr_tcp.c
$NetBSD: patch-lib_isc_netmgr_tcp.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/isc/netmgr/tcp.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/isc/netmgr/tcp.c
@@ -36,7 +36,7 @@
 static atomic_uint_fast32_t last_tcpquota_log = ATOMIC_VAR_INIT(0);
 
 static bool
-can_log_tcp_quota() {
+can_log_tcp_quota(void) {
 	isc_stdtime_t now, last;
 
 	isc_stdtime_get(&now);

File Added: pkgsrc/net/bind916/patches/patch-lib_isc_rwlock.c
$NetBSD: patch-lib_isc_rwlock.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/isc/rwlock.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/isc/rwlock.c
@@ -142,6 +142,9 @@ isc_rwlock_destroy(isc_rwlock_t *rwl) {
 #define RWLOCK_MAX_ADAPTIVE_COUNT 100
 #endif /* ifndef RWLOCK_MAX_ADAPTIVE_COUNT */
 
+#ifdef __lint__
+# define isc_rwlock_pause()
+#else
 #if defined(_MSC_VER)
 #include <intrin.h>
 #define isc_rwlock_pause() YieldProcessor()
@@ -152,7 +155,7 @@ isc_rwlock_destroy(isc_rwlock_t *rwl) {
 #define isc_rwlock_pause() __asm__ __volatile__("rep; nop")
 #elif defined(__ia64__)
 #define isc_rwlock_pause() __asm__ __volatile__("hint @pause")
-#elif defined(__arm__) && HAVE_ARM_YIELD
+#elif defined(__arm__) && (defined(_ARM_ARCH_6) || HAVE_ARM_YIELD)
 #define isc_rwlock_pause() __asm__ __volatile__("yield")
 #elif defined(sun) && (defined(__sparc) || defined(__sparc__))
 #define isc_rwlock_pause() smt_pause()
@@ -164,6 +167,7 @@ isc_rwlock_destroy(isc_rwlock_t *rwl) {
 #else /* if defined(_MSC_VER) */
 #define isc_rwlock_pause()
 #endif /* if defined(_MSC_VER) */
+#endif
 
 static isc_result_t
 isc__rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type);

File Added: pkgsrc/net/bind916/patches/patch-lib_isc_siphash.c
$NetBSD: patch-lib_isc_siphash.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/isc/siphash.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/isc/siphash.c
@@ -113,8 +113,14 @@ isc_siphash24(const uint8_t *k, const ui
 	REQUIRE(k != NULL);
 	REQUIRE(out != NULL);
 
-	uint64_t k0 = U8TO64_LE(k);
-	uint64_t k1 = U8TO64_LE(k + 8);
+	uint64_t k0;
+	uint64_t k1;
+
+	memcpy(&k0, k, sizeof(k0));
+	memcpy(&k1, k + sizeof(k0), sizeof(k1));
+
+	k0 = le64toh(k0);
+	k1 = le64toh(k1);
 
 	uint64_t v0 = 0x736f6d6570736575ULL ^ k0;
 	uint64_t v1 = 0x646f72616e646f6dULL ^ k1;

File Added: pkgsrc/net/bind916/patches/patch-lib_isc_stats.c
$NetBSD: patch-lib_isc_stats.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Platform fixes from NetBSD base system.

--- lib/isc/stats.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/isc/stats.c
@@ -27,7 +27,7 @@
 #define ISC_STATS_MAGIC	   ISC_MAGIC('S', 't', 'a', 't')
 #define ISC_STATS_VALID(x) ISC_MAGIC_VALID(x, ISC_STATS_MAGIC)
 
-#if defined(_WIN32) && !defined(_WIN64)
+#if (defined(_WIN32) && !defined(_WIN64)) || !defined(_LP64)
 typedef atomic_int_fast32_t isc__atomic_statcounter_t;
 #else  /* if defined(_WIN32) && !defined(_WIN64) */
 typedef atomic_int_fast64_t isc__atomic_statcounter_t;

File Added: pkgsrc/net/bind916/patches/Attic/patch-lib_isc_task.c
$NetBSD: patch-lib_isc_task.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/isc/task.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/isc/task.c
@@ -1381,8 +1381,11 @@ isc_taskmgr_create(isc_mem_t *mctx, unsi
 	REQUIRE(managerp != NULL && *managerp == NULL);
 
 	manager = isc_mem_get(mctx, sizeof(*manager));
+#ifndef __lint__
+// XXX: bug
 	*manager = (isc__taskmgr_t){ .common.impmagic = TASK_MANAGER_MAGIC,
 				     .common.magic = ISCAPI_TASKMGR_MAGIC };
+#endif
 
 	atomic_store(&manager->mode, isc_taskmgrmode_normal);
 	isc_mutex_init(&manager->lock);
@@ -1431,7 +1434,7 @@ isc_taskmgr_create(isc_mem_t *mctx, unsi
 		isc_thread_create(run, &manager->queues[i],
 				  &manager->queues[i].thread);
 		char name[21];
-		snprintf(name, sizeof(name), "isc-worker%04u", i);
+		snprintf(name, sizeof(name), "work-%u", i);
 		isc_thread_setname(manager->queues[i].thread, name);
 	}
 	UNLOCK(&manager->lock);

File Added: pkgsrc/net/bind916/patches/Attic/patch-lib_isc_unix_include_isc_align.h
$NetBSD: patch-lib_isc_unix_include_isc_align.h,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/isc/unix/include/isc/align.h.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/isc/unix/include/isc/align.h
@@ -16,3 +16,8 @@
 #else /* ifdef HAVE_STDALIGN_H */
 #define alignas(x) __attribute__((__aligned__(x)))
 #endif /* ifdef HAVE_STDALIGN_H */
+#ifdef __lint__
+// XXX: bug
+#undef alignas
+#define alignas(a)
+#endif

File Added: pkgsrc/net/bind916/patches/patch-lib_isc_unix_net.c
$NetBSD: patch-lib_isc_unix_net.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Fix build on SmartOS. In this special case, _XOPEN_SOURCE has to be only
  defined on SmartOS.

--- lib/isc/unix/net.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/isc/unix/net.c
@@ -9,6 +9,15 @@
  * information regarding copyright ownership.
  */
 
+/* needed for CMSG_DATA */
+#if defined(__sun)
+#if (__STDC_VERSION__ - 0 < 199901L)
+#define _XOPEN_SOURCE 500
+#else
+#define _XOPEN_SOURCE 600
+#endif
+#endif
+
 #include <stdbool.h>
 #include <sys/types.h>
 

File Added: pkgsrc/net/bind916/patches/patch-lib_isc_unix_socket.c
$NetBSD: patch-lib_isc_unix_socket.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Apply fixes from NetBSD base system.
* Fix build on SmartOS. In this special case, _XOPEN_SOURCE has to be only
  defined on SmartOS.

--- lib/isc/unix/socket.c.orig	2020-06-10 21:01:43.000000000 +0000
+++ lib/isc/unix/socket.c
@@ -11,6 +11,15 @@
 
 /*! \file */
 
+/* needed for CMSG_DATA */
+#if defined(__sun)
+#if (__STDC_VERSION__ - 0 < 199901L)
+#define _XOPEN_SOURCE 500
+#else
+#define _XOPEN_SOURCE 600
+#endif
+#endif
+
 #include <inttypes.h>
 #include <stdbool.h>
 #include <sys/param.h>
@@ -362,7 +371,11 @@ struct isc__socket {
 	unsigned char overflow; /* used for MSG_TRUNC fake */
 #endif				/* ifdef ISC_PLATFORM_RECVOVERFLOW */
 
-	unsigned int dscp;
+	void			*fdwatcharg;
+	isc_sockfdwatch_t	fdwatchcb;
+	int			fdwatchflags;
+	isc_task_t              *fdwatchtask;
+	unsigned int		dscp;
 };
 
 #define SOCKET_MANAGER_MAGIC ISC_MAGIC('I', 'O', 'm', 'g')
@@ -471,6 +484,14 @@ static bool
 process_ctlfd(isc__socketthread_t *thread);
 static void
 setdscp(isc__socket_t *sock, isc_dscp_t dscp);
+static void
+dispatch_recv(isc__socket_t *sock);
+static void
+dispatch_send(isc__socket_t *sock);
+static void
+internal_fdwatch_read(isc__socket_t *sock);
+static void
+internal_fdwatch_write(isc__socket_t *sock);
 
 #define SELECT_POKE_SHUTDOWN (-1)
 #define SELECT_POKE_NOTHING  (-2)
@@ -1558,6 +1579,7 @@ doio_recv(isc__socket_t *sock, isc_socke
 	case isc_sockettype_udp:
 	case isc_sockettype_raw:
 		break;
+	case isc_sockettype_fdwatch:
 	default:
 		INSIST(0);
 		ISC_UNREACHABLE();
@@ -1766,9 +1788,26 @@ socketclose(isc__socketthread_t *thread,
 	 */
 	LOCK(&thread->fdlock[lockid]);
 	thread->fds[fd] = NULL;
-	thread->fdstate[fd] = CLOSE_PENDING;
+	if (sock->type == isc_sockettype_fdwatch)
+		thread->fdstate[fd] = CLOSED;
+	else
+		thread->fdstate[fd] = CLOSE_PENDING;
 	UNLOCK(&thread->fdlock[lockid]);
-	select_poke(thread->manager, thread->threadid, fd, SELECT_POKE_CLOSE);
+	if (sock->type == isc_sockettype_fdwatch) {
+		/*
+		 * The caller may close the socket once this function returns,
+		 * and `fd' may be reassigned for a new socket.  So we do
+		 * unwatch_fd() here, rather than defer it via select_poke().
+		 * Note: this may complicate data protection among threads and
+		 * may reduce performance due to additional locks.  One way to
+		 * solve this would be to dup() the watched descriptor, but we
+		 * take a simpler approach at this moment.
+		 */
+		(void)unwatch_fd(thread, fd, SELECT_POKE_READ);
+		(void)unwatch_fd(thread, fd, SELECT_POKE_WRITE);
+	} else
+		select_poke(thread->manager, thread->threadid, fd,
+		    SELECT_POKE_CLOSE);
 
 	inc_stats(thread->manager->stats, sock->statsindex[STATID_CLOSE]);
 
@@ -2154,6 +2193,13 @@ again:
 			}
 #endif /* if defined(PF_ROUTE) */
 			break;
+		case isc_sockettype_fdwatch:
+			/*
+			 * We should not be called for isc_sockettype_fdwatch
+			 * sockets.
+			 */
+			INSIST(0);
+			break;
 		}
 	} else {
 		sock->fd = dup(dup_socket->fd);
@@ -2447,6 +2493,7 @@ socket_create(isc_socketmgr_t *manager0,
 
 	REQUIRE(VALID_MANAGER(manager));
 	REQUIRE(socketp != NULL && *socketp == NULL);
+	REQUIRE(type != isc_sockettype_fdwatch);
 
 	result = allocate_socket(manager, type, &sock);
 	if (result != ISC_R_SUCCESS) {
@@ -2564,6 +2611,7 @@ isc_socket_open(isc_socket_t *sock0) {
 	REQUIRE(isc_refcount_current(&sock->references) >= 1);
 	REQUIRE(sock->fd == -1);
 	REQUIRE(sock->threadid == -1);
+	REQUIRE(sock->type != isc_sockettype_fdwatch);
 
 	result = opensocket(sock->manager, sock, NULL);
 
@@ -2645,6 +2693,7 @@ isc_socket_close(isc_socket_t *sock0) {
 
 	LOCK(&sock->lock);
 
+	REQUIRE(sock->type != isc_sockettype_fdwatch);
 	REQUIRE(sock->fd >= 0 && sock->fd < (int)sock->manager->maxsocks);
 
 	INSIST(!sock->connecting);
@@ -2675,6 +2724,24 @@ isc_socket_close(isc_socket_t *sock0) {
 	return (ISC_R_SUCCESS);
 }
 
+static void
+dispatch_recv(isc__socket_t *sock) {
+	if (sock->type != isc_sockettype_fdwatch) {
+		internal_recv(sock);
+	} else {
+		internal_fdwatch_read(sock);
+	}
+}
+
+static void
+dispatch_send(isc__socket_t *sock) {
+	if (sock->type != isc_sockettype_fdwatch) {
+		internal_send(sock);
+	} else {
+		internal_fdwatch_write(sock);
+	}
+}
+
 /*
  * Dequeue an item off the given socket's read queue, set the result code
  * in the done event to the one provided, and send it to the task it was
@@ -3117,6 +3184,64 @@ finish:
 	UNLOCK(&sock->lock);
 }
 
+static void
+internal_fdwatch_write(isc__socket_t *sock)
+{
+	int more_data;
+
+	INSIST(VALID_SOCKET(sock));
+
+	LOCK(&sock->lock);
+	isc_refcount_increment(&sock->references);
+	UNLOCK(&sock->lock);
+
+	more_data = (sock->fdwatchcb)(sock->fdwatchtask, (isc_socket_t *)sock,
+				      sock->fdwatcharg, ISC_SOCKFDWATCH_WRITE);
+
+	LOCK(&sock->lock);
+
+	if (isc_refcount_decrement(&sock->references) == 0) {
+		UNLOCK(&sock->lock);
+		destroy(&sock);
+		return;
+	}
+
+	if (more_data)
+		select_poke(sock->manager, sock->threadid, sock->fd,
+		    SELECT_POKE_WRITE);
+
+	UNLOCK(&sock->lock);
+}
+
+static void
+internal_fdwatch_read(isc__socket_t *sock)
+{
+	int more_data;
+
+	INSIST(VALID_SOCKET(sock));
+
+	LOCK(&sock->lock);
+	isc_refcount_increment(&sock->references);
+	UNLOCK(&sock->lock);
+
+	more_data = (sock->fdwatchcb)(sock->fdwatchtask, (isc_socket_t *)sock,
+				      sock->fdwatcharg, ISC_SOCKFDWATCH_READ);
+
+	LOCK(&sock->lock);
+
+	if (isc_refcount_decrement(&sock->references) == 0) {
+		UNLOCK(&sock->lock);
+		destroy(&sock);
+		return;
+	}
+
+	if (more_data)
+		select_poke(sock->manager, sock->threadid, sock->fd,
+		    SELECT_POKE_READ);
+
+	UNLOCK(&sock->lock);
+}
+
 /*
  * Process read/writes on each fd here.  Avoid locking
  * and unlocking twice if both reads and writes are possible.
@@ -3164,7 +3289,7 @@ process_fd(isc__socketthread_t *thread, 
 		if (sock->listener) {
 			internal_accept(sock);
 		} else {
-			internal_recv(sock);
+			dispatch_recv(sock);
 		}
 	}
 
@@ -3172,7 +3297,7 @@ process_fd(isc__socketthread_t *thread, 
 		if (sock->connecting) {
 			internal_connect(sock);
 		} else {
-			internal_send(sock);
+			dispatch_send(sock);
 		}
 	}
 
@@ -5287,7 +5412,7 @@ static isc_once_t hasreuseport_once = IS
 static bool hasreuseport = false;
 
 static void
-init_hasreuseport() {
+init_hasreuseport(void) {
 /*
  * SO_REUSEPORT works very differently on *BSD and on Linux (because why not).
  * We only want to use it on Linux, if it's available. On BSD we want to dup()
@@ -5341,6 +5466,8 @@ _socktype(isc_sockettype_t type) {
 		return ("tcp");
 	case isc_sockettype_unix:
 		return ("unix");
+	case isc_sockettype_fdwatch:
+		return ("fdwatch");
 	default:
 		return ("not-initialized");
 	}
@@ -5353,7 +5480,7 @@ _socktype(isc_sockettype_t type) {
 		xmlrc = (a);        \
 		if (xmlrc < 0)      \
 			goto error; \
-	} while (0)
+	} while (/*CONSTCOND*/0)
 int
 isc_socketmgr_renderxml(isc_socketmgr_t *mgr0, void *writer0) {
 	isc__socketmgr_t *mgr = (isc__socketmgr_t *)mgr0;
@@ -5460,7 +5587,7 @@ error:
 			result = ISC_R_NOMEMORY; \
 			goto error;              \
 		}                                \
-	} while (0)
+	} while (/*CONSTCOND*/0)
 
 isc_result_t
 isc_socketmgr_renderjson(isc_socketmgr_t *mgr0, void *stats0) {
@@ -5582,3 +5709,112 @@ isc_socketmgr_createinctx(isc_mem_t *mct
 
 	return (result);
 }
+
+/*
+ * Create a new 'type' socket managed by 'manager'.  Events
+ * will be posted to 'task' and when dispatched 'action' will be
+ * called with 'arg' as the arg value.  The new socket is returned
+ * in 'socketp'.
+ */
+isc_result_t
+isc_socket_fdwatchcreate(isc_socketmgr_t *manager0, int fd, int flags,
+			 isc_sockfdwatch_t callback, void *cbarg,
+			 isc_task_t *task, isc_socket_t **socketp)
+{
+	isc__socketmgr_t *manager = (isc__socketmgr_t *)manager0;
+	isc__socket_t *sock = NULL;
+	isc__socketthread_t *thread;
+	isc_result_t result;
+	int lockid;
+
+	REQUIRE(VALID_MANAGER(manager));
+	REQUIRE(socketp != NULL && *socketp == NULL);
+
+	if (fd < 0 || (unsigned int)fd >= manager->maxsocks)
+		return (ISC_R_RANGE);
+
+	result = allocate_socket(manager, isc_sockettype_fdwatch, &sock);
+	if (result != ISC_R_SUCCESS)
+		return (result);
+
+	sock->fd = fd;
+	sock->fdwatcharg = cbarg;
+	sock->fdwatchcb = callback;
+	sock->fdwatchflags = flags;
+	sock->fdwatchtask = task;
+
+	sock->threadid = gen_threadid(sock);
+	isc_refcount_init(&sock->references, 1);
+	thread = &manager->threads[sock->threadid];
+	*socketp = (isc_socket_t *)sock;
+
+	/*
+	 * Note we don't have to lock the socket like we normally would because
+	 * there are no external references to it yet.
+	 */
+
+	lockid = FDLOCK_ID(sock->fd);
+	LOCK(&thread->fdlock[lockid]);
+	thread->fds[sock->fd] = sock;
+	thread->fdstate[sock->fd] = MANAGED;
+
+#if defined(USE_EPOLL)
+	manager->epoll_events[sock->fd] = 0;
+#endif
+	UNLOCK(&thread->fdlock[lockid]);
+
+	LOCK(&manager->lock);
+	ISC_LIST_APPEND(manager->socklist, sock, link);
+#ifdef USE_SELECT
+	if (manager->maxfd < sock->fd)
+		manager->maxfd = sock->fd;
+#endif
+	UNLOCK(&manager->lock);
+
+	sock->active = 1;
+	if (flags & ISC_SOCKFDWATCH_READ)
+		select_poke(sock->manager, sock->threadid, sock->fd,
+		    SELECT_POKE_READ);
+	if (flags & ISC_SOCKFDWATCH_WRITE)
+		select_poke(sock->manager, sock->threadid, sock->fd,
+		    SELECT_POKE_WRITE);
+
+	socket_log(sock, NULL, CREATION, "fdwatch-created");
+
+	return (ISC_R_SUCCESS);
+}
+
+/*
+ * Indicate to the manager that it should watch the socket again.
+ * This can be used to restart watching if the previous event handler
+ * didn't indicate there was more data to be processed.  Primarily
+ * it is for writing but could be used for reading if desired
+ */
+
+isc_result_t
+isc_socket_fdwatchpoke(isc_socket_t *sock0, int flags)
+{
+	isc__socket_t *sock = (isc__socket_t *)sock0;
+
+	REQUIRE(VALID_SOCKET(sock));
+
+	/*
+	 * We check both flags first to allow us to get the lock
+	 * once but only if we need it.
+	 */
+
+	if ((flags & (ISC_SOCKFDWATCH_READ | ISC_SOCKFDWATCH_WRITE)) != 0) {
+		LOCK(&sock->lock);
+		if ((flags & ISC_SOCKFDWATCH_READ) != 0)
+			select_poke(sock->manager, sock->threadid, sock->fd,
+				    SELECT_POKE_READ);
+		if ((flags & ISC_SOCKFDWATCH_WRITE) != 0)
+			select_poke(sock->manager, sock->threadid, sock->fd,
+				    SELECT_POKE_WRITE);
+		UNLOCK(&sock->lock);
+	}
+
+	socket_log(sock, NULL, TRACE, "fdwatch-poked flags: %d", flags);
+
+	return (ISC_R_SUCCESS);
+}

File Added: pkgsrc/net/bind916/patches/patch-lib_isc_unix_time.c
$NetBSD: patch-lib_isc_unix_time.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* More check time_t range.

--- lib/isc/unix/time.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/isc/unix/time.c
@@ -285,7 +285,7 @@ isc_time_seconds(const isc_time_t *t) {
 
 isc_result_t
 isc_time_secondsastimet(const isc_time_t *t, time_t *secondsp) {
-	time_t seconds;
+	time_t seconds, i;
 
 	REQUIRE(t != NULL);
 	INSIST(t->nanoseconds < NS_PER_S);
@@ -312,7 +312,18 @@ isc_time_secondsastimet(const isc_time_t
 	INSIST(sizeof(unsigned int) == sizeof(uint32_t));
 	INSIST(sizeof(time_t) >= sizeof(uint32_t));
 
-	if (t->seconds > (~0U >> 1) && seconds <= (time_t)(~0U >> 1)) {
+	if (sizeof(time_t) == sizeof(uint32_t) &&	       /* Same size. */
+	    (time_t)0.5 != 0.5 &&	       /* Not a floating point type. */
+	    (i = (time_t)-1) != 4294967295u &&		       /* Is signed. */
+	    (seconds &
+	     (1ULL << (sizeof(time_t) * CHAR_BIT - 1))) != 0ULL) {   /* Negative. */
+		/*
+		 * This UNUSED() is here to shut up the IRIX compiler:
+		 *	variable "i" was set but never used
+		 * when the value of i *was* used in the third test.
+		 * (Let's hope the compiler got the actual test right.)
+		 */
+		UNUSED(i);
 		return (ISC_R_RANGE);
 	}
 

File Added: pkgsrc/net/bind916/patches/patch-lib_ns_Makefile.in
$NetBSD: patch-lib_ns_Makefile.in,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base; add blacklist support.

--- lib/ns/Makefile.in.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/ns/Makefile.in
@@ -42,16 +42,19 @@ LIBS =		@LIBS@
 OBJS =		client.@O@ hooks.@O@ interfacemgr.@O@ lib.@O@ \
 		listenlist.@O@ log.@O@ notify.@O@ query.@O@ \
 		server.@O@ sortlist.@O@ stats.@O@ update.@O@ \
-		version.@O@ xfrout.@O@
+		version.@O@ xfrout.@O@ @BLACKLISTLINKOBJS@
 
 SRCS =		client.c hooks.c interfacemgr.c lib.c listenlist.c \
 		log.c notify.c query.c server.c sortlist.c stats.c \
-		update.c version.c xfrout.c
+		update.c version.c xfrout.c @BLACKLISTLINKSRCS@
 
 SUBDIRS =	include
 TESTDIRS =	@UNITTESTS@
 TARGETS =	timestamp
 
+BLACKLISTLINKOBJS= pfilter.@O@
+BLACKLISTLINKSRCS= pfilter.c
+
 SO_CFLAGS =	@CFLAGS@ @SO_CFLAGS@
 SO_LDFLAGS =	@LDFLAGS@ @SO_LDFLAGS@
 

File Added: pkgsrc/net/bind916/patches/patch-lib_ns_client.c
$NetBSD: patch-lib_ns_client.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/ns/client.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/ns/client.c
@@ -87,8 +87,8 @@
 	isc_log_write(ns_lctx, NS_LOGCATEGORY_CLIENT, NS_LOGMODULE_CLIENT, \
 		      ISC_LOG_DEBUG(3), "clientmgr @%p: %s", manager, (m))
 #else /* ifdef NS_CLIENT_TRACE */
-#define CTRACE(m) ((void)(m))
-#define MTRACE(m) ((void)(m))
+#define CTRACE(m) ((void)/*LINTED*/(m))
+#define MTRACE(m) ((void)/*LINTED*/(m))
 #endif /* ifdef NS_CLIENT_TRACE */
 
 #define TCP_CLIENT(c) (((c)->attributes & NS_CLIENTATTR_TCP) != 0)
@@ -126,7 +126,7 @@
  * Number of tasks to be used by clients - those are used only when recursing
  */
 
-#if defined(_WIN32) && !defined(_WIN64)
+#if (defined(_WIN32) && !defined(_WIN64)) || !defined(_LP64)
 LIBNS_EXTERNAL_DATA atomic_uint_fast32_t ns_client_requests;
 #else  /* if defined(_WIN32) && !defined(_WIN64) */
 LIBNS_EXTERNAL_DATA atomic_uint_fast64_t ns_client_requests;
@@ -2334,6 +2334,8 @@ ns__client_setup(ns_client_t *client, ns
 		 * Retain these values from the existing client, but
 		 * zero every thing else.
 		 */
+#ifndef __lint__
+/* XXX: bug ? */
 		*client = (ns_client_t){ .magic = 0,
 					 .mctx = oldmctx,
 					 .manager = oldmgr,
@@ -2342,6 +2344,7 @@ ns__client_setup(ns_client_t *client, ns
 					 .sendbuf = sendbuf,
 					 .message = message,
 					 .query = query };
+#endif
 	}
 
 	client->state = NS_CLIENTSTATE_INACTIVE;

File Added: pkgsrc/net/bind916/patches/patch-lib_ns_include_ns_client.h
$NetBSD: patch-lib_ns_include_ns_client.h,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/ns/include/ns/client.h.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/ns/include/ns/client.h
@@ -271,7 +271,7 @@ struct ns_client {
  */
 #define NS_FAILCACHE_CD 0x01
 
-#if defined(_WIN32) && !defined(_WIN64)
+#if (defined(_WIN32) && !defined(_WIN64)) || !defined(_LP64)
 LIBNS_EXTERNAL_DATA extern atomic_uint_fast32_t ns_client_requests;
 #else  /* if defined(_WIN32) && !defined(_WIN64) */
 LIBNS_EXTERNAL_DATA extern atomic_uint_fast64_t ns_client_requests;

File Added: pkgsrc/net/bind916/patches/patch-lib_ns_include_ns_pfilter.h
$NetBSD: patch-lib_ns_include_ns_pfilter.h,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/ns/include/ns/pfilter.h.orig	2020-05-27 15:17:34.854399492 +0000
+++ lib/ns/include/ns/pfilter.h
@@ -0,0 +1,2 @@
+void pfilter_enable(void);
+void pfilter_notify(isc_result_t, ns_client_t *, const char *);

File Added: pkgsrc/net/bind916/patches/Attic/patch-lib_ns_interfacemgr.c
$NetBSD: patch-lib_ns_interfacemgr.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/ns/interfacemgr.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/ns/interfacemgr.c
@@ -396,9 +396,12 @@ ns_interface_create(ns_interfacemgr_t *m
 	REQUIRE(NS_INTERFACEMGR_VALID(mgr));
 
 	ifp = isc_mem_get(mgr->mctx, sizeof(*ifp));
+#ifndef __lint__
+/* XXX: bug? */
 	*ifp = (ns_interface_t){ .generation = mgr->generation,
 				 .addr = *addr,
 				 .dscp = -1 };
+#endif
 
 	strlcpy(ifp->name, name, sizeof(ifp->name));
 

File Added: pkgsrc/net/bind916/patches/patch-lib_ns_pfilter.c
$NetBSD: patch-lib_ns_pfilter.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/ns/pfilter.c.orig	2020-05-27 15:17:34.821165296 +0000
+++ lib/ns/pfilter.c
@@ -0,0 +1,44 @@
+
+#include <isc/platform.h>
+#include <isc/util.h>
+#include <ns/types.h>
+#include <ns/client.h>
+
+#include <blacklist.h>
+
+#include <ns/pfilter.h>
+
+static struct blacklist *blstate;
+static int blenable;
+
+void
+pfilter_enable(void) {
+	blenable = 1;
+}
+
+#define TCP_CLIENT(c)  (((c)->attributes & NS_CLIENTATTR_TCP) != 0)
+
+void
+pfilter_notify(isc_result_t res, ns_client_t *client, const char *msg)
+{
+	int fd;
+
+	if (!blenable)
+		return;
+
+	if (blstate == NULL)
+		blstate = blacklist_open();
+
+	if (blstate == NULL)
+		return;
+
+	if (!TCP_CLIENT(client) && !client->peeraddr_valid)
+		return;
+
+	if ((fd = isc_nmhandle_getfd(client->handle)) == -1)
+		return;
+
+	blacklist_sa_r(blstate, 
+	    res != ISC_R_SUCCESS, fd,
+	    &client->peeraddr.type.sa, client->peeraddr.length, msg);
+}

File Added: pkgsrc/net/bind916/patches/patch-lib_ns_query.c
$NetBSD: patch-lib_ns_query.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/ns/query.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/ns/query.c
@@ -68,6 +68,10 @@
 #include <ns/stats.h>
 #include <ns/xfrout.h>
 
+#ifdef HAVE_BLACKLIST
+#include <ns/pfilter.h>
+#endif
+
 #if 0
 /*
  * It has been recommended that DNS64 be changed to return excluded
@@ -857,6 +861,9 @@ query_checkcacheaccess(ns_client_t *clie
 					      msg);
 			}
 		} else if (log) {
+#ifdef HAVE_BLACKLIST
+			pfilter_notify(result, client, "checkcacheaccess");
+#endif
 			/*
 			 * We were denied by the "allow-query-cache" ACL.
 			 * There is no need to clear NS_QUERYATTR_CACHEACLOK
@@ -989,6 +996,9 @@ query_validatezonedb(ns_client_t *client
 					      msg);
 			}
 		} else {
+#ifdef HAVE_BLACKLIST
+			pfilter_notify(result, client, "validatezonedb");
+#endif
 			ns_client_aclmsg("query", name, qtype,
 					 client->view->rdclass, msg,
 					 sizeof(msg));

File Added: pkgsrc/net/bind916/patches/patch-lib_ns_update.c
$NetBSD: patch-lib_ns_update.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/ns/update.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/ns/update.c
@@ -52,6 +52,10 @@
 #include <ns/stats.h>
 #include <ns/update.h>
 
+#ifdef HAVE_BLACKLIST
+#include <ns/pfilter.h>
+#endif
+
 /*! \file
  * \brief
  * This module implements dynamic update as in RFC2136.
@@ -340,6 +344,9 @@ checkqueryacl(ns_client_t *client, dns_a
 
 	result = ns_client_checkaclsilent(client, NULL, queryacl, true);
 	if (result != ISC_R_SUCCESS) {
+#ifdef HAVE_BLACKLIST
+		pfilter_notify(result, client, "queryacl");
+#endif
 		dns_name_format(zonename, namebuf, sizeof(namebuf));
 		dns_rdataclass_format(client->view->rdclass, classbuf,
 				      sizeof(classbuf));
@@ -352,6 +359,9 @@ checkqueryacl(ns_client_t *client, dns_a
 			      "update '%s/%s' denied due to allow-query",
 			      namebuf, classbuf);
 	} else if (updateacl == NULL && ssutable == NULL) {
+#ifdef HAVE_BLACKLIST
+		pfilter_notify(result, client, "updateacl");
+#endif
 		dns_name_format(zonename, namebuf, sizeof(namebuf));
 		dns_rdataclass_format(client->view->rdclass, classbuf,
 				      sizeof(classbuf));
@@ -393,6 +403,9 @@ checkupdateacl(ns_client_t *client, dns_
 		msg = "disabled";
 	} else {
 		result = ns_client_checkaclsilent(client, NULL, acl, false);
+#ifdef HAVE_BLACKLIST
+		pfilter_notify(result, client, "updateacl");
+#endif
 		if (result == ISC_R_SUCCESS) {
 			level = ISC_LOG_DEBUG(3);
 			msg = "approved";

File Added: pkgsrc/net/bind916/patches/patch-lib_ns_xfrout.c
$NetBSD: patch-lib_ns_xfrout.c,v 1.1 2020/08/09 15:20:22 taca Exp $

* Take from NetBSD base.

--- lib/ns/xfrout.c.orig	2020-05-06 09:59:35.000000000 +0000
+++ lib/ns/xfrout.c
@@ -46,6 +46,10 @@
 #include <ns/stats.h>
 #include <ns/xfrout.h>
 
+#ifdef HAVE_BLACKLIST
+#include <ns/pfilter.h>
+#endif
+
 /*! \file
  * \brief
  * Outgoing AXFR and IXFR.
@@ -821,9 +825,15 @@ ns_xfr_start(ns_client_t *client, dns_rd
 					      ISC_LOG_ERROR,
 					      "zone transfer '%s/%s' denied",
 					      _buf1, _buf2);
+#ifdef HAVE_BLACKLIST
+				pfilter_notify(result, client, "zonexfr");
+#endif
 				goto failure;
 			}
 			if (result != ISC_R_SUCCESS) {
+#ifdef HAVE_BLACKLIST
+				pfilter_notify(result, client, "zonexfr");
+#endif
 				FAILQ(DNS_R_NOTAUTH, "non-authoritative zone",
 				      question_name, question_class);
 			}

File Added: pkgsrc/net/bind916/patches/patch-make_rules.in
$NetBSD: patch-make_rules.in,v 1.1 2020/08/09 15:20:22 taca Exp $

* Add libuv handling.

--- make/rules.in.orig	2020-06-10 21:01:43.000000000 +0000
+++ make/rules.in
@@ -134,6 +134,9 @@ LIBUV_LIBS = @LIBUV_LIBS@
 LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
 LIBXML2_LIBS = @LIBXML2_LIBS@
 
+LIBUV_CFLAGS = @LIBUV_CFLAGS@
+LIBUV_LIBS = @LIBUV_LIBS@
+
 LMDB_CFLAGS = @LMDB_CFLAGS@
 LMDB_LIBS = @LMDB_LIBS@