--- make/unbound/Config.in	1970-01-01 01:00:00.000000000 +0100
+++ make/unbound/Config.in	2017-11-08 20:21:11.272249134 +0100
@@ -0,0 +1,33 @@
+config FREETZ_PACKAGE_UNBOUND
+	bool "unbound 1.6.7"
+	select FREETZ_LIB_libssl
+	select FREETZ_LIB_libcrypto
+	select FREETZ_LIB_libexpat
+	default n
+	help
+		 Unbound is designed as a set of modular components, so that also
+		 DNSSEC (secure DNS) validation and stub-resolvers (that do not run as
+		 a server, but are linked into an application) are easily possible.
+		  Goals:
+		    * A validating recursive DNS resolver.
+		    * Code diversity in the DNS resolver monoculture.
+		    * Drop-in replacement for BIND apart from config.
+		    * DNSSEC support.
+		    * Fully RFC compliant.
+		    * High performance
+		      o even with validation.
+		    * Used as
+		      o stub resolver.
+		      o full caching name server.
+		      o resolver library.
+		    * Elegant design of validator, resolver, cache modules.
+		      o provide the ability to pick and choose modules.
+		    * Robust.
+		    * In C, open source: The BSD license.
+		    * Smallest as possible component that does the job.
+		    * Stub-zones can be configured (local data or AS112 zones).
+		  Non-goals:
+		    * An authoritative name server.
+		    * Too many Features.
+		  WWW: http://unbound.net
+		  man-page: http://www.unbound.net/documentation/unbound.html
--- make/unbound/external.files	1970-01-01 01:00:00.000000000 +0100
+++ make/unbound/external.files	2017-11-08 20:21:11.276249035 +0100
@@ -0,0 +1,2 @@
+[ "$EXTERNAL_FREETZ_PACKAGE_UNBOUND" == "y" ] && EXTERNAL_FILES+=" /usr/bin/unbound /usr/bin/unbound-control /usr/bin/unbound-checkconf \
+/usr/bin/unbound-host /usr/lib/freetz/libunbound.so.2.5.6"
--- make/unbound/external.in	1970-01-01 01:00:00.000000000 +0100
+++ make/unbound/external.in	2017-11-08 20:21:11.272249134 +0100
@@ -0,0 +1,11 @@
+config EXTERNAL_FREETZ_PACKAGE_UNBOUND
+	depends on EXTERNAL_ENABLED && FREETZ_PACKAGE_UNBOUND
+	bool "unbound"
+	default n
+	help
+		externals these file(s):
+		 /usr/bin/unbound
+		 /usr/bin/unbound-control
+		 /usr/bin/unbound-checkconf
+		 /usr/bin/unbound-host
+		 /usr/lib/freetz/libunbound.so.2.5.6
--- make/unbound/external.services	1970-01-01 01:00:00.000000000 +0100
+++ make/unbound/external.services	2017-11-08 20:21:11.276249035 +0100
@@ -0,0 +1,2 @@
+[ "$EXTERNAL_FREETZ_PACKAGE_UNBOUND" == "y" ] && EXTERNAL_SERVICES+=" unbound"
+
--- make/unbound/files/.language	1970-01-01 01:00:00.000000000 +0100
+++ make/unbound/files/.language	2017-11-08 20:21:11.276249035 +0100
@@ -0,0 +1,10 @@
+languages
+{ de en }
+default
+{ en }
+files
+{
+	usr/lib/cgi-bin/unbound.cgi
+	etc/default.unbound/unbound_conf.def
+}
+
--- make/unbound/files/root/etc/default.unbound/root.key	1970-01-01 01:00:00.000000000 +0100
+++ make/unbound/files/root/etc/default.unbound/root.key	2017-11-08 20:21:11.276249035 +0100
@@ -0,0 +1 @@
+. IN DS 19036 8 2 49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE32F24E8FB5
--- make/unbound/files/root/etc/default.unbound/unbound.cfg	1970-01-01 01:00:00.000000000 +0100
+++ make/unbound/files/root/etc/default.unbound/unbound.cfg	2017-11-08 20:21:11.276249035 +0100
@@ -0,0 +1,2 @@
+export UNBOUND_ENABLED='no'
+export UNBOUND_CMDLINE=""
--- make/unbound/files/root/etc/default.unbound/unbound_conf	1970-01-01 01:00:00.000000000 +0100
+++ make/unbound/files/root/etc/default.unbound/unbound_conf	2017-11-08 20:21:11.276249035 +0100
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+cat <<EOF
+server:
+
+	interface: ::0
+	interface: 0.0.0.0
+	access-control: ::1 allow
+	access-control: 192.168.0.0/16 allow
+
+	pidfile: "/var/run/unbound.pid"
+
+	do-ip4: yes
+	do-ip6: yes
+	do-udp: yes
+	do-tcp: yes
+
+	port: 533
+	username: "nobody"
+
+	hide-identity: yes
+	hide-version: yes
+	harden-glue: yes
+	harden-dnssec-stripped: yes
+	use-caps-for-id: yes
+
+	cache-min-ttl: 300
+	cache-max-ttl: 86400
+	prefetch: yes
+
+	# Faster UDP with multithreading
+	so-reuseport: yes
+
+	num-threads: 2
+	# power of 2 close to num-threads
+	msg-cache-slabs: 2
+	rrset-cache-slabs: 2
+	infra-cache-slabs: 2
+	key-cache-slabs: 2
+
+	# rrset=msg*2
+	rrset-cache-size: 2m
+	msg-cache-size: 1m
+
+	# outgoing connections: 1024/cores - 50
+	outgoing-range: 450
+	num-queries-per-thread: 256
+
+	# reduce edns packet size to help big udp packets over dumb firewalls
+	edns-buffer-size: 1232
+	max-udp-size: 1232
+
+	# logfile: "/var/log/unbound.log"
+	# log-time-ascii: no
+	verbosity: 1
+	use-syslog: yes
+
+	qname-minimisation: yes
+	root-hints: "/tmp/flash/unbound/root.hints"
+
+	auto-trust-anchor-file: "/tmp/flash/unbound/root.key"
+
+EOF
--- make/unbound/files/root/etc/default.unbound/unbound_conf.def	1970-01-01 01:00:00.000000000 +0100
+++ make/unbound/files/root/etc/default.unbound/unbound_conf.def	2017-11-08 20:21:11.276249035 +0100
@@ -0,0 +1,9 @@
+CAPTION='unbound: unbound.conf'
+DESCRIPTION='$(lang de:"Manpage auf" en:"Manpage at") www.unbound.net: <a target=blank href=http://www.unbound.net/documentation/unbound.conf.html>http://www.unbound.net/documentation/unbound.conf.html</a>'
+
+CONFIG_FILE='/tmp/flash/unbound/unbound.conf'
+CONFIG_SAVE='modsave flash; if pidof unbound > /dev/null; then echo ""; /mod/etc/init.d/rc.unbound restart; fi'
+CONFIG_TYPE='text'
+
+TEXT_ROWS=30
+
--- make/unbound/files/root/etc/init.d/rc.unbound	1970-01-01 01:00:00.000000000 +0100
+++ make/unbound/files/root/etc/init.d/rc.unbound	2017-11-08 20:21:11.276249035 +0100
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+DAEMON=unbound
+CONF_FILE=/tmp/flash/$DAEMON/$DAEMON.conf
+. /etc/init.d/modlibrc
+
+
+start() {
+	modlib_startdaemon unbound $UNBOUND_CMDLINE
+}
+
+case $1 in
+	""|load)
+		[ ! -d "/tmp/flash/$DAEMON" ] && mkdir -p /tmp/flash/$DAEMON
+
+		[ ! -e "$CONF_FILE" ] && /etc/default.$DAEMON/unbound_conf > $CONF_FILE
+		[ ! -e "/tmp/flash/$DAEMON/root.key" ] && cp /etc/default.$DAEMON/root.key /tmp/flash/$DAEMON/root.key
+		[ ! -e "/tmp/flash/$DAEMON/root.hints" ] && cp /etc/$DAEMON/root.hints /tmp/flash/$DAEMON/root.hints
+		chown -R nobody /tmp/flash/$DAEMON
+
+		modreg file $DAEMON conf 'unbound: unbound.conf' 1 "unbound_conf"
+		modreg cgi $DAEMON unbound
+                modreg daemon $DAEMON
+
+		modlib_start $UNBOUND_ENABLED
+		;;
+	unload)
+                modunreg daemon $DAEMON
+		modunreg cgi $DAEMON
+		modunreg file $DAEMON
+		modlib_stop
+		;;
+	start)
+		modlib_start
+		;;
+	stop)
+		modlib_stop
+		;;
+	restart)
+		modlib_restart
+		;;
+	status)
+		modlib_status
+		;;
+	*)
+		echo "Usage: $0 [load|unload|start|stop|restart|status]" 1>&2
+		exit 1
+		;;
+esac
+
+exit 0
--- make/unbound/files/root/usr/lib/cgi-bin/unbound.cgi	1970-01-01 01:00:00.000000000 +0100
+++ make/unbound/files/root/usr/lib/cgi-bin/unbound.cgi	2017-11-08 20:21:11.276249035 +0100
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+. /usr/lib/libmodcgi.sh
+
+check "$UNBOUND_ENABLED" yes:auto "*":man
+
+
+sec_begin '$(lang de:"Starttyp" en:"Start type")'
+
+cat << EOF
+<p>
+<input id="e1" type="radio" name="enabled" value="yes"$auto_chk><label for="e1"> $(lang de:"Automatisch" en:"Automatic")</label>
+<input id="e2" type="radio" name="enabled" value="no"$man_chk><label for="e2"> $(lang de:"Manuell" en:"Manual")</label>
+</p>
+EOF
+
+sec_end
+sec_begin '$(lang de:"Konfiguration" en:"Configuration")'
+
+cat << EOF
+<p>
+<a href="$(href file unbound conf)">$(lang de:"Zum Bearbeiten der unbound.conf hier klicken." en:"To edit the unbound.conf click here.")</a>
+</p>
+<p>
+$(lang de:"Optionale Parameter:" en:"Optional parameters:")
+<input type="text" name="cmdline" size="55" maxlength="250" value="$(html "$UNBOUND_CMDLINE")">
+</p>
+EOF
+
+sec_end
+
--- make/unbound/Makefile.in	1970-01-01 01:00:00.000000000 +0100
+++ make/unbound/Makefile.in	2017-11-08 20:21:11.272249134 +0100
@@ -0,0 +1,3 @@
+ifeq ($(strip $(FREETZ_PACKAGE_UNBOUND)),y)
+PACKAGES+=unbound
+endif
--- make/unbound/unbound.mk	1970-01-01 01:00:00.000000000 +0100
+++ make/unbound/unbound.mk	2017-11-08 20:21:11.272249134 +0100
@@ -0,0 +1,77 @@
+$(call PKG_INIT_BIN, 1.6.7)
+$(PKG)_SOURCE:=$(pkg)-$($(PKG)_VERSION).tar.gz
+$(PKG)_SOURCE_MD5:=67ed382add11134d689f5e88f8efc43e
+$(PKG)_SITE:=http://www.$(pkg).net/downloads
+
+$(PKG)_BINARIES:=$(pkg) $(pkg)-control $(pkg)-checkconf
+$(PKG)_BINARIES_BUILD_DIR:=$($(PKG)_BINARIES:%=$($(PKG)_DIR)/%)
+$(PKG)_BINARIES_TARGET_DIR:=$($(PKG)_BINARIES:%=$($(PKG)_DEST_DIR)/usr/bin/%)
+
+$(PKG)_LIBS:=lib$(pkg).so.2.5.6
+$(PKG)_LIBS_BUILD_DIR:=$($(PKG)_LIBS:%=$($(PKG)_DIR)/.libs/%)
+$(PKG)_LIBS_TARGET_DIR:=$($(PKG)_LIBS:%=$($(PKG)_DEST_LIBDIR)/%)
+
+$(PKG)_BINARY:=$($(PKG)_DIR)/.libs/$(pkg)-host
+$(PKG)_TARGET_BINARY:=$($(PKG)_DEST_DIR)/usr/bin/$(pkg)-host
+
+$(PKG)_FILES:=root.hints
+$(PKG)_FILES_BUILD_DIR:=$($(PKG)_FILES:%=$($(PKG)_DIR)/%)
+$(PKG)_FILES_TARGET_DIR:=$($(PKG)_FILES:%=$($(PKG)_DEST_DIR)/etc/$(pkg)/%)
+
+$(PKG)_CONFIGURE_PRE_CMDS += $(call PKG_PREVENT_RPATH_HARDCODING,./configure)
+
+$(PKG)_DEPENDS_ON += openssl expat
+$(PKG)_CONFIGURE_OPTIONS += --with-ssl=$(TARGET_TOOLCHAIN_STAGING_DIR)/usr
+$(PKG)_CONFIGURE_OPTIONS += --with-libexpat=$(TARGET_TOOLCHAIN_STAGING_DIR)/usr
+$(PKG)_CONFIGURE_OPTIONS += --with-pidfile=/var/run/unbound.pid
+$(PKG)_CONFIGURE_OPTIONS += --with-conf-file=/tmp/flash/unbound/unbound.conf
+$(PKG)_CONFIGURE_OPTIONS += --without-pyunbound
+$(PKG)_CONFIGURE_OPTIONS += --without-pythonmodule
+$(PKG)_CONFIGURE_OPTIONS += --without-libevent
+ifeq ($(strip $(FREETZ_LIB_libpthread)),y)
+$(PKG)_CONFIGURE_OPTIONS += --with-pthreads
+else
+$(PKG)_CONFIGURE_OPTIONS += --without-pthreads
+endif
+ifeq ($(strip $(FREETZ_LIB_libcrypto_WITH_EC)),y)
+$(PKG)_CONFIGURE_OPTIONS += --enable-gost
+$(PKG)_CONFIGURE_OPTIONS += --enable-ecdsa
+else
+$(PKG)_CONFIGURE_OPTIONS += --disable-gost
+$(PKG)_CONFIGURE_OPTIONS += --disable-ecdsa
+endif
+
+
+$(PKG_SOURCE_DOWNLOAD)
+$(PKG_UNPACKED)
+$(PKG_CONFIGURED_CONFIGURE)
+
+$($(PKG)_BINARIES_BUILD_DIR) $($(PKG)_LIBS_BUILD_DIR) $($(PKG)_BINARY): $($(PKG)_DIR)/.configured
+		wget -N -q -c https://www.internic.net/domain/named.cache -O $(UNBOUND_DIR)/root.hints
+		$(SUBMAKE) -C $(UNBOUND_DIR)
+
+$($(PKG)_BINARIES_TARGET_DIR): $($(PKG)_DEST_DIR)/usr/bin/%: $($(PKG)_DIR)/%
+	$(INSTALL_BINARY_STRIP)
+
+$($(PKG)_LIBS_TARGET_DIR): $($(PKG)_DEST_LIBDIR)/%: $($(PKG)_DIR)/.libs/%
+	$(INSTALL_LIBRARY_STRIP)
+
+$($(PKG)_TARGET_BINARY): $($(PKG)_BINARY)
+	$(INSTALL_BINARY_STRIP)
+
+$($(PKG)_FILES_TARGET_DIR): $($(PKG)_DEST_DIR)/etc/$(pkg)/%: $($(PKG)_DIR)/%
+	$(INSTALL_FILE)
+
+$(pkg):
+
+$(pkg)-precompiled: $($(PKG)_BINARIES_TARGET_DIR) $($(PKG)_LIBS_TARGET_DIR) $($(PKG)_TARGET_BINARY) \
+$($(PKG)_FILES_TARGET_DIR)
+
+$(pkg)-clean:
+	-$(SUBMAKE) -C $(UNBOUND_DIR) clean
+	$(RM) $(UNBOUND_DIR)/.configured
+
+$(pkg)-uninstall:
+	$(RM) $(UNBOUND_BINARIES_TARGET_DIR) $(UNBOUND_LIBS_TARGET_DIR) $(UNBOUND_FILES_TARGET_DIR)
+
+$(PKG_FINISH)
