--- /dev/null
+#
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id$
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=bind
+PKG_VERSION:=9.3.1
+PKG_RELEASE:=7
+PKG_BUILDDEP:=openssl
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.isc.org/isc/bind9/9.3.1/
+PKG_MD5SUM:=9ff3204eea27184ea0722f37e43fc95d
+PKG_CAT:=zcat
+
+PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bind
+ SECTION:=net
+ CATEGORY:=Network
+ SUBMENU:=ISC's DNS suite implementation
+ DEPENDS:=+libopenssl
+ TITLE:=ISC's DNS suite implementation
+ DESCRIPTION:=ISC's DNS suite implementation
+ URL:=http://www.isc.org/sw/bind/
+endef
+
+define Package/bind-server
+ $(call Package/bind)
+ DEFAULT:=m if ALL
+ TITLE:=ISC's DNS server implementation
+ DESCRIPTION:=ISC's DNS server implementation
+endef
+
+define Package/bind-client
+ $(call Package/bind)
+ DEFAULT:=m if ALL
+ TITLE:=A dynamic DNS client
+ DESCRIPTION:=A dynamic DNS client
+endef
+
+define Package/bind-tools
+ $(call Package/bind)
+ DEFAULT:=m if ALL
+ TITLE:=Bind administration tools
+ DESCRIPTION:=A DNS client
+endef
+
+define Package/bind-rndc
+ $(call Package/bind)
+ DEFAULT:=m if ALL
+ TITLE:=bind administration tools (rndc and rndc-confgen only)
+ DESCRIPTION:=bind administration tools (rndc and rndc-confgen only)
+endef
+
+define Package/bind-check
+ $(call Package/bind)
+ DEFAULT:=m if ALL
+ TITLE:=bind administration tools (named-checkconf and named-checkzone only)
+ DESCRIPTION:=bind administration tools (named-checkconf and named-checkzone only)
+endef
+
+define Package/bind-dnssec
+ $(call Package/bind)
+ DEFAULT:=m if ALL
+ TITLE:=Bind administration tools (dnssec-keygen and dnssec-signzone only)
+ DESCRIPTION:=Bind administration tools (dnssec-keygen and dnssec-signzone only)
+endef
+
+define Package/bind-host
+ $(call Package/bind)
+ DEFAULT:=m if ALL
+ TITLE:=A simple DNS client
+ DESCRIPTION:=A simple DNS client
+endef
+
+define Package/bind-dig
+ $(call Package/bind)
+ DEFAULT:=m if ALL
+ TITLE:=A DNS client
+ DESCRIPTION:=A DNS client
+endef
+
+define Package/Build/Configure
+$(call Build/Configure/Default,--enable-shared \
+--enable-static \
+--enable-ipv6 \
+--with-randomdev=/dev/urandom \
+--disable-threads \
+--with-openssl=$(STAGING_DIR)/usr/
+)
+endef
+
+define Build/Compile
+ rm -rf $(PKG_INSTALL_DIR)
+ mkdir -p $(PKG_INSTALL_DIR)
+ $(MAKE) -C $(PKG_BUILD_DIR)/lib/dns \
+ CC="$(HOSTCC)" \
+ CFLAGS="-O2" \
+ gen
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ DESTDIR="$(PKG_INSTALL_DIR)" \
+ STAGING_DIR=$(STAGING_DIR) \
+ all install
+endef
+
+define Package/bind-server/install
+ install -d -m0755 $(1)/usr/sbin
+ install -d -m0755 $(1)/etc/init.d
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/named $(1)/usr/sbin/
+ $(CP) files/bind $(1)/etc
+ $(CP) files/named.init $(1)/etc/init.d/S$(PKG_INIT_LEVEL)named
+ find $(1)/etc/bind -name ".svn" | xargs rm -rf
+endef
+
+define Package/bind-client/install
+ install -d -m0755 $(1)/usr/bin
+ $(CP) $(PKG_INSTALL_DIR)/usr/bin/nsupdate $(1)/usr/bin/
+endef
+
+define Package/bind-tools/install
+ install -d -m0755 $(1)/usr/bin
+ install -d -m0755 $(1)/usr/sbin
+ $(CP) $(PKG_INSTALL_DIR)/usr/bin/dig $(1)/usr/bin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/bin/host $(1)/usr/bin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-keygen $(1)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-signzone $(1)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/named-checkconf $(1)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/named-checkzone $(1)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/rndc $(1)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/rndc-confgen $(1)/usr/sbin/
+endef
+
+define Package/bind-rndc/install
+ install -d -m0755 $(1)/usr/sbin
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/rndc $(1)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/rndc-confgen $(1)/usr/sbin/
+endef
+
+define Package/bind-check/install
+ install -d -m0755 $(1)/usr/sbin
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/named-checkconf $(1)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/named-checkzone $(1)/usr/sbin/
+endef
+
+define Package/bind-dnssec/install
+ install -d -m0755 $(1)/usr/sbin
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-keygen $(1)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-signzone $(1)/usr/sbin/
+endef
+
+define Package/bind-host/install
+ install -d -m0755 $(1)/usr/bin
+ $(CP) $(PKG_INSTALL_DIR)/usr/bin/host $(1)/usr/bin/
+endef
+
+define Package/bind-dig/install
+ install -d -m0755 $(1)/usr/bin
+ $(CP) $(PKG_INSTALL_DIR)/usr/bin/dig $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,bind-server))
+$(eval $(call BuildPackage,bind-client))
+$(eval $(call BuildPackage,bind-tools))
+$(eval $(call BuildPackage,bind-rndc))
+$(eval $(call BuildPackage,bind-check))
+$(eval $(call BuildPackage,bind-dnssec))
+$(eval $(call BuildPackage,bind-host))
+$(eval $(call BuildPackage,bind-dig))
--- /dev/null
+;
+; BIND reverse data file for broadcast zone
+;
+$TTL 604800
+@ IN SOA localhost. root.localhost. (
+ 1 ; Serial
+ 604800 ; Refresh
+ 86400 ; Retry
+ 2419200 ; Expire
+ 604800 ) ; Negative Cache TTL
+;
+@ IN NS localhost.
--- /dev/null
+;
+; BIND reverse data file for local loopback interface
+;
+$TTL 604800
+@ IN SOA localhost. root.localhost. (
+ 1 ; Serial
+ 604800 ; Refresh
+ 86400 ; Retry
+ 2419200 ; Expire
+ 604800 ) ; Negative Cache TTL
+;
+@ IN NS localhost.
+1.0.0 IN PTR localhost.
--- /dev/null
+;
+; BIND reverse data file for broadcast zone
+;
+$TTL 604800
+@ IN SOA localhost. root.localhost. (
+ 1 ; Serial
+ 604800 ; Refresh
+ 86400 ; Retry
+ 2419200 ; Expire
+ 604800 ) ; Negative Cache TTL
+;
+@ IN NS localhost.
--- /dev/null
+;
+; BIND data file for local loopback interface
+;
+$TTL 604800
+@ IN SOA localhost. root.localhost. (
+ 1 ; Serial
+ 604800 ; Refresh
+ 86400 ; Retry
+ 2419200 ; Expire
+ 604800 ) ; Negative Cache TTL
+;
+@ IN NS localhost.
+@ IN A 127.0.0.1
--- /dev/null
+
+; <<>> DiG 9.2.3 <<>> ns . @a.root-servers.net.
+;; global options: printcmd
+;; Got answer:
+;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18944
+;; flags: qr aa rd; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 13
+
+;; QUESTION SECTION:
+;. IN NS
+
+;; ANSWER SECTION:
+. 518400 IN NS A.ROOT-SERVERS.NET.
+. 518400 IN NS B.ROOT-SERVERS.NET.
+. 518400 IN NS C.ROOT-SERVERS.NET.
+. 518400 IN NS D.ROOT-SERVERS.NET.
+. 518400 IN NS E.ROOT-SERVERS.NET.
+. 518400 IN NS F.ROOT-SERVERS.NET.
+. 518400 IN NS G.ROOT-SERVERS.NET.
+. 518400 IN NS H.ROOT-SERVERS.NET.
+. 518400 IN NS I.ROOT-SERVERS.NET.
+. 518400 IN NS J.ROOT-SERVERS.NET.
+. 518400 IN NS K.ROOT-SERVERS.NET.
+. 518400 IN NS L.ROOT-SERVERS.NET.
+. 518400 IN NS M.ROOT-SERVERS.NET.
+
+;; ADDITIONAL SECTION:
+A.ROOT-SERVERS.NET. 3600000 IN A 198.41.0.4
+B.ROOT-SERVERS.NET. 3600000 IN A 192.228.79.201
+C.ROOT-SERVERS.NET. 3600000 IN A 192.33.4.12
+D.ROOT-SERVERS.NET. 3600000 IN A 128.8.10.90
+E.ROOT-SERVERS.NET. 3600000 IN A 192.203.230.10
+F.ROOT-SERVERS.NET. 3600000 IN A 192.5.5.241
+G.ROOT-SERVERS.NET. 3600000 IN A 192.112.36.4
+H.ROOT-SERVERS.NET. 3600000 IN A 128.63.2.53
+I.ROOT-SERVERS.NET. 3600000 IN A 192.36.148.17
+J.ROOT-SERVERS.NET. 3600000 IN A 192.58.128.30
+K.ROOT-SERVERS.NET. 3600000 IN A 193.0.14.129
+L.ROOT-SERVERS.NET. 3600000 IN A 198.32.64.12
+M.ROOT-SERVERS.NET. 3600000 IN A 202.12.27.33
+
+;; Query time: 81 msec
+;; SERVER: 198.41.0.4#53(a.root-servers.net.)
+;; WHEN: Sun Feb 1 11:27:14 2004
+;; MSG SIZE rcvd: 436
+
--- /dev/null
+// This is the primary configuration file for the BIND DNS server named.
+
+options {
+ directory "/tmp";
+
+ // If your ISP provided one or more IP addresses for stable
+ // nameservers, you probably want to use them as forwarders.
+ // Uncomment the following block, and insert the addresses replacing
+ // the all-0's placeholder.
+
+ // forwarders {
+ // 0.0.0.0;
+ // };
+
+ auth-nxdomain no; # conform to RFC1035
+};
+
+// prime the server with knowledge of the root servers
+zone "." {
+ type hint;
+ file "/etc/bind/db.root";
+};
+
+// be authoritative for the localhost forward and reverse zones, and for
+// broadcast zones as per RFC 1912
+
+zone "localhost" {
+ type master;
+ file "/etc/bind/db.local";
+};
+
+zone "127.in-addr.arpa" {
+ type master;
+ file "/etc/bind/db.127";
+};
+
+zone "0.in-addr.arpa" {
+ type master;
+ file "/etc/bind/db.0";
+};
+
+zone "255.in-addr.arpa" {
+ type master;
+ file "/etc/bind/db.255";
+};
--- /dev/null
+#!/bin/sh
+
+if [ -f /etc/bind/named.conf ]; then
+ named -c /etc/bind/named.conf
+fi
--- /dev/null
+diff -urN bind-9.3.1/configure bind-9.3.1.new/configure
+--- bind-9.3.1/configure 2004-12-09 05:09:03.000000000 +0100
++++ bind-9.3.1.new/configure 2006-07-31 14:24:19.000000000 +0200
+@@ -4750,7 +4750,7 @@
+ use_openssl="auto"
+ fi;
+
+-openssldirs="/usr /usr/local /usr/local/ssl /usr/pkg"
++openssldirs="-I$STAGING_DIR/usr/include"
+ if test "$use_openssl" = "auto"
+ then
+ for d in $openssldirs
+@@ -5289,6 +5289,7 @@
+ if eval "test \"\${$as_ac_File+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
++cross_compiling=no
+ test "$cross_compiling" = yes &&
+ { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+ echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+@@ -23675,175 +23676,6 @@
+ # which provides some (all?) of the desired functions.
+ #
+
+-echo "$as_me:$LINENO: checking for inet_ntop with IPv6 support" >&5
+-echo $ECHO_N "checking for inet_ntop with IPv6 support... $ECHO_C" >&6
+-if test "$cross_compiling" = yes; then
+- { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+-See \`config.log' for more details." >&5
+-echo "$as_me: error: cannot run test program while cross compiling
+-See \`config.log' for more details." >&2;}
+- { (exit 1); exit 1; }; }
+-else
+- cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h. */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h. */
+-
+-#include <sys/types.h>
+-#include <sys/socket.h>
+-#include <netinet/in.h>
+-#include <arpa/inet.h>
+-main() {
+-char a[16],b[64]; return(inet_ntop(AF_INET6, a, b, sizeof(b)) == (char*)0);}
+-_ACEOF
+-rm -f conftest$ac_exeext
+-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+- (eval $ac_link) 2>&5
+- ac_status=$?
+- echo "$as_me:$LINENO: \$? = $ac_status" >&5
+- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+- (eval $ac_try) 2>&5
+- ac_status=$?
+- echo "$as_me:$LINENO: \$? = $ac_status" >&5
+- (exit $ac_status); }; }; then
+- echo "$as_me:$LINENO: result: yes" >&5
+-echo "${ECHO_T}yes" >&6
+- ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"
+-else
+- echo "$as_me: program exited with status $ac_status" >&5
+-echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-( exit $ac_status )
+-echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6
+- ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.$O"
+- ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_ntop.c"
+- ISC_PLATFORM_NEEDNTOP="#define ISC_PLATFORM_NEEDNTOP 1"
+-fi
+-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+-fi
+-
+-
+-# On NetBSD 1.4.2 and maybe others, inet_pton() incorrectly accepts
+-# addresses with less than four octets, like "1.2.3". Also leading
+-# zeros should also be rejected.
+-
+-echo "$as_me:$LINENO: checking for working inet_pton with IPv6 support" >&5
+-echo $ECHO_N "checking for working inet_pton with IPv6 support... $ECHO_C" >&6
+-if test "$cross_compiling" = yes; then
+- echo "$as_me:$LINENO: result: assuming target platform has working inet_pton" >&5
+-echo "${ECHO_T}assuming target platform has working inet_pton" >&6
+- ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"
+-else
+- cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h. */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h. */
+-
+-#include <sys/types.h>
+-#include <sys/socket.h>
+-#include <netinet/in.h>
+-#include <arpa/inet.h>
+-main() { char a[16]; return (inet_pton(AF_INET, "1.2.3", a) == 1 ? 1 :
+- inet_pton(AF_INET, "1.2.3.04", a) == 1 ? 1 :
+- (inet_pton(AF_INET6, "::1.2.3.4", a) != 1)); }
+-_ACEOF
+-rm -f conftest$ac_exeext
+-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+- (eval $ac_link) 2>&5
+- ac_status=$?
+- echo "$as_me:$LINENO: \$? = $ac_status" >&5
+- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+- (eval $ac_try) 2>&5
+- ac_status=$?
+- echo "$as_me:$LINENO: \$? = $ac_status" >&5
+- (exit $ac_status); }; }; then
+- echo "$as_me:$LINENO: result: yes" >&5
+-echo "${ECHO_T}yes" >&6
+- ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"
+-else
+- echo "$as_me: program exited with status $ac_status" >&5
+-echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-( exit $ac_status )
+-echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6
+- ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_pton.$O"
+- ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_pton.c"
+- ISC_PLATFORM_NEEDPTON="#define ISC_PLATFORM_NEEDPTON 1"
+-fi
+-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+-fi
+-
+-echo "$as_me:$LINENO: checking for inet_aton" >&5
+-echo $ECHO_N "checking for inet_aton... $ECHO_C" >&6
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h. */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h. */
+-
+-#include <sys/types.h>
+-#include <netinet/in.h>
+-#include <arpa/inet.h>
+-int
+-main ()
+-{
+-struct in_addr in; inet_aton(0, &in); return (0);
+- ;
+- return 0;
+-}
+-_ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+- (eval $ac_link) 2>conftest.er1
+- ac_status=$?
+- grep -v '^ *+' conftest.er1 >conftest.err
+- rm -f conftest.er1
+- cat conftest.err >&5
+- echo "$as_me:$LINENO: \$? = $ac_status" >&5
+- (exit $ac_status); } &&
+- { ac_try='test -z "$ac_c_werror_flag"
+- || test ! -s conftest.err'
+- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+- (eval $ac_try) 2>&5
+- ac_status=$?
+- echo "$as_me:$LINENO: \$? = $ac_status" >&5
+- (exit $ac_status); }; } &&
+- { ac_try='test -s conftest$ac_exeext'
+- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+- (eval $ac_try) 2>&5
+- ac_status=$?
+- echo "$as_me:$LINENO: \$? = $ac_status" >&5
+- (exit $ac_status); }; }; then
+- echo "$as_me:$LINENO: result: yes" >&5
+-echo "${ECHO_T}yes" >&6
+- ISC_PLATFORM_NEEDATON="#undef ISC_PLATFORM_NEEDATON"
+-else
+- echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6
+- ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_aton.$O"
+- ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_aton.c"
+- ISC_PLATFORM_NEEDATON="#define ISC_PLATFORM_NEEDATON 1"
+-fi
+-rm -f conftest.err conftest.$ac_objext \
+- conftest$ac_exeext conftest.$ac_ext
+-
+-
+-
+-
+
+ #
+ # Look for a 4.4BSD-style sa_len member in struct sockaddr.
+diff -urN bind-9.3.1/configure.in bind-9.3.1.new/configure.in
+--- bind-9.3.1/configure.in 2004-12-09 05:07:10.000000000 +0100
++++ bind-9.3.1.new/configure.in 2006-07-31 14:16:55.000000000 +0200
+@@ -362,7 +362,7 @@
+ (Required for DNSSEC)],
+ use_openssl="$withval", use_openssl="auto")
+
+-openssldirs="/usr /usr/local /usr/local/ssl /usr/pkg"
++openssldirs="$STAGING_DIR/usr/include $STAGING_DIR/include"
+ if test "$use_openssl" = "auto"
+ then
+ for d in $openssldirs