[package] add pdnsd DNS proxy
authorFlorian Fainelli <florian@openwrt.org>
Mon, 13 Aug 2012 14:08:47 +0000 (14:08 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Mon, 13 Aug 2012 14:08:47 +0000 (14:08 +0000)
pdnsd, is an IPv6 capable proxy DNS server with permanent caching (the cache
contents are written to hard disk on exit) that is designed to cope with
unreachable or down DNS servers (for example in dial-in networking).

pdnsd can be used with applications that do dns lookups, eg on startup, and
can't be configured to change that behaviour, to prevent the often
minute-long hangs (or even crashes) that result from stalled dns queries.

Signed-off-by: Sebastian Muszynski <basti@linkt.de>
SVN-Revision: 33173

net/pdnsd/Makefile [new file with mode: 0644]
net/pdnsd/files/pdnsd.init [new file with mode: 0644]

diff --git a/net/pdnsd/Makefile b/net/pdnsd/Makefile
new file mode 100644 (file)
index 0000000..3d75aa1
--- /dev/null
@@ -0,0 +1,55 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=pdnsd
+PKG_VERSION:=1.2.9a-par
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://gitorious.org/pdnsd/pdnsd.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=a8e46ccba7b0fa2230d6c42ab6dcd92926f6c21d
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+# PKG_MIRROR_MD5SUM:=
+# CMAKE_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/pdnsd
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  DEPENDS:=+libpthread
+  TITLE:=Proxy DNS Server
+endef
+
+define Package/pdnsd/description
+  pdnsd, is an IPv6 capable proxy DNS server with permanent caching (the cache
+  contents are written to hard disk on exit) that is designed to cope with
+  unreachable or down DNS servers (for example in dial-in networking).
+
+  pdnsd can be used with applications that do dns lookups, eg on startup, and
+  can't be configured to change that behaviour, to prevent the often
+  minute-long hangs (or even crashes) that result from stalled dns queries.
+endef
+
+TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
+#TARGET_CFLAGS += -ggdb3
+
+CMAKE_OPTIONS += -DDEBUG=1
+
+CONFIGURE_ARGS += \
+               --with-cachedir=/var/pdnsd
+
+define Package/pdnsd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/pdnsd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/pdnsd-ctl/pdnsd-ctl $(1)/usr/bin/
+
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/pdnsd.init $(1)/etc/init.d/pdnsd
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/doc/pdnsd.conf $(1)/etc/
+endef
+
+$(eval $(call BuildPackage,pdnsd))
diff --git a/net/pdnsd/files/pdnsd.init b/net/pdnsd/files/pdnsd.init
new file mode 100644 (file)
index 0000000..e678d8d
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/sh /etc/rc.common
+
+START=65
+NAME=pdnsd
+DESC="proxy DNS server"
+
+DAEMON=/usr/sbin/pdnsd
+PID_FILE=/var/run/$NAME.pid
+CACHEDIR=/var/pdnsd
+CACHE=$CACHEDIR/pdnsd.cache
+
+USER=nobody
+GROUP=nogroup
+
+start() {
+       echo -n "Starting $DESC: $NAME"
+
+       gen_cache
+
+       $DAEMON --daemon -p $PID_FILE
+       echo " ."
+}
+
+stop() {
+       echo -n "Stopping $DESC: $NAME"
+       kill `cat $PID_FILE` > /dev/null 2>&1
+       rm -rf $PID_FILE
+       echo " ."
+}
+
+restart() {
+       echo "Restarting $DESC: $NAME... "
+       stop
+       sleep 2
+       start
+}
+
+gen_cache()
+{
+       if ! test -f "$CACHE"; then
+               mkdir -p `dirname $CACHE`
+               dd if=/dev/zero of="$CACHE" bs=1 count=4 2> /dev/null
+               chown -R $USER.$GROUP $CACHEDIR
+       fi
+}
+