summaryrefslogtreecommitdiff
path: root/net/dnsdist
diff options
context:
space:
mode:
authorfhajny <fhajny@pkgsrc.org>2017-03-31 20:49:51 +0000
committerfhajny <fhajny@pkgsrc.org>2017-03-31 20:49:51 +0000
commit3d9f105708dc4c722deb3f5e88c52ca8e04f1669 (patch)
tree66bded5a2a4dd67504697f4f3f5ea86ecb6b0b8c /net/dnsdist
parenta1ad558a4a247847bce52a7401c5902312d17482 (diff)
downloadpkgsrc-3d9f105708dc4c722deb3f5e88c52ca8e04f1669.tar.gz
Import dnsdist 1.1.0 as dns/dnsdist.
dnsdist is a highly DNS-, DoS- and abuse-aware loadbalancer. Its goal in life is to route traffic to the best server, delivering top performance to legitimate users while shunting or blocking abusive traffic.
Diffstat (limited to 'net/dnsdist')
-rw-r--r--net/dnsdist/DESCR4
-rw-r--r--net/dnsdist/Makefile51
-rw-r--r--net/dnsdist/PLIST4
-rw-r--r--net/dnsdist/distinfo11
-rw-r--r--net/dnsdist/files/dnsdist.conf6
-rw-r--r--net/dnsdist/files/dnsdist.sh24
-rw-r--r--net/dnsdist/files/smf/manifest.xml28
-rw-r--r--net/dnsdist/patches/patch-dns.hh15
-rw-r--r--net/dnsdist/patches/patch-dnsdist-console.cc15
-rw-r--r--net/dnsdist/patches/patch-dnsdist.cc15
-rw-r--r--net/dnsdist/patches/patch-iputils.hh50
-rw-r--r--net/dnsdist/patches/patch-qtype.hh17
12 files changed, 240 insertions, 0 deletions
diff --git a/net/dnsdist/DESCR b/net/dnsdist/DESCR
new file mode 100644
index 00000000000..8b6e998da8b
--- /dev/null
+++ b/net/dnsdist/DESCR
@@ -0,0 +1,4 @@
+dnsdist is a highly DNS-, DoS- and abuse-aware loadbalancer. Its
+goal in life is to route traffic to the best server, delivering top
+performance to legitimate users while shunting or blocking abusive
+traffic.
diff --git a/net/dnsdist/Makefile b/net/dnsdist/Makefile
new file mode 100644
index 00000000000..fffc61e69c1
--- /dev/null
+++ b/net/dnsdist/Makefile
@@ -0,0 +1,51 @@
+# $NetBSD: Makefile,v 1.1 2017/03/31 20:49:51 fhajny Exp $
+
+DISTNAME= dnsdist-1.1.0
+CATEGORIES= net
+MASTER_SITES= https://downloads.powerdns.com/releases/
+EXTRACT_SUFX= .tar.bz2
+
+MAINTAINER= filip@joyent.com
+HOMEPAGE= http://dnsdist.org/
+COMMENT= Highly DNS-, DoS- and abuse-aware loadbalancer
+LICENSE= gnu-gpl-v2
+
+GNU_CONFIGURE= yes
+USE_LANGUAGES= c c++
+USE_TOOLS+= gmake pkg-config
+
+.include "../../mk/bsd.prefs.mk"
+
+BUILD_DEFS+= DNSDIST_USER DNSDIST_GROUP
+DNSDIST_USER?= dnsdist
+DNSDIST_GROUP?= dnsdist
+PKG_GROUPS+= ${DNSDIST_GROUP}
+PKG_USERS+= ${DNSDIST_USER}:${DNSDIST_GROUP}
+PKG_GECOS.${DNSDIST_USER}= dnsdist daemon user
+
+FILES_SUBST+= DNSDIST_USER=${DNSDIST_USER}
+FILES_SUBST+= DNSDIST_GROUP=${DNSDIST_GROUP}
+CONF_FILES+= share/examples/dnsdist/dnsdist.conf \
+ ${PKG_SYSCONFDIR}/dnsdist.conf
+
+CONFIGURE_ARGS+= --enable-dnscrypt
+CONFIGURE_ARGS+= --enable-libsodium
+CONFIGURE_ARGS+= --enable-protobuf
+CONFIGURE_ARGS+= --enable-re2
+CONFIGURE_ENV+= LIBEDIT_CFLAGS="-I${BUILDLINK_PREFIX.libedit}/include"
+CONFIGURE_ENV+= LIBEDIT_LIBS="-L${BUILDLINK_PREFIX.libedit}/lib -ledit"
+
+INSTALLATION_DIRS+= share/examples/dnsdist
+RCD_SCRIPTS+= dnsdist
+
+post-install:
+ ${INSTALL_DATA} ${.CURDIR}/files/dnsdist.conf \
+ ${DESTDIR}${PREFIX}/share/examples/dnsdist
+
+.include "../../devel/boost-headers/buildlink3.mk"
+.include "../../devel/editline/buildlink3.mk"
+.include "../../devel/protobuf/buildlink3.mk"
+.include "../../devel/re2/buildlink3.mk"
+.include "../../lang/lua/buildlink3.mk"
+.include "../../security/libsodium/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/net/dnsdist/PLIST b/net/dnsdist/PLIST
new file mode 100644
index 00000000000..555f5763d09
--- /dev/null
+++ b/net/dnsdist/PLIST
@@ -0,0 +1,4 @@
+@comment $NetBSD: PLIST,v 1.1 2017/03/31 20:49:51 fhajny Exp $
+bin/dnsdist
+man/man1/dnsdist.1
+share/examples/dnsdist/dnsdist.conf
diff --git a/net/dnsdist/distinfo b/net/dnsdist/distinfo
new file mode 100644
index 00000000000..3a3b2b7e625
--- /dev/null
+++ b/net/dnsdist/distinfo
@@ -0,0 +1,11 @@
+$NetBSD: distinfo,v 1.1 2017/03/31 20:49:51 fhajny Exp $
+
+SHA1 (dnsdist-1.1.0.tar.bz2) = 9b6372fc5f606ee83dac465e1dc9c824242f5905
+RMD160 (dnsdist-1.1.0.tar.bz2) = 7724641b2be1c3611dd0b2c685cf6e8b7a365e67
+SHA512 (dnsdist-1.1.0.tar.bz2) = 91da716997c2440e153944f510a39dd86c9cf8ba8093a7f51a9a5d58ab0a1c230bd99ec57fe8ff0721279c8c4429ad576fe797c1fbe4cde2b9fb8f0405025320
+Size (dnsdist-1.1.0.tar.bz2) = 874837 bytes
+SHA1 (patch-dns.hh) = 13834e3d9f48b3095ce4912540c7d0d275c3a3a3
+SHA1 (patch-dnsdist-console.cc) = 51fee0e89b648e0f9c2e6c0d9a6859ef2991a1b7
+SHA1 (patch-dnsdist.cc) = 2b2bf569c134019dd8a5d4f3df104fdd16a47a31
+SHA1 (patch-iputils.hh) = 666fe81cc651b2c7e85164b8246283e301bcce1a
+SHA1 (patch-qtype.hh) = 4551be1e303a31d34030c363849398923f5ff987
diff --git a/net/dnsdist/files/dnsdist.conf b/net/dnsdist/files/dnsdist.conf
new file mode 100644
index 00000000000..083ac49c4b2
--- /dev/null
+++ b/net/dnsdist/files/dnsdist.conf
@@ -0,0 +1,6 @@
+-- newServer({address="2001:4860:4860::8888", qps=1})
+-- newServer({address="2001:4860:4860::8844", qps=1})
+-- newServer({address="2620:0:ccc::2", qps=10})
+-- newServer({address="2620:0:ccd::2", name="dns1", qps=10})
+-- newServer("192.168.1.2")
+-- setServerPolicy(firstAvailable) -- first server within its QPS limit
diff --git a/net/dnsdist/files/dnsdist.sh b/net/dnsdist/files/dnsdist.sh
new file mode 100644
index 00000000000..f861d0b4482
--- /dev/null
+++ b/net/dnsdist/files/dnsdist.sh
@@ -0,0 +1,24 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: dnsdist.sh,v 1.1 2017/03/31 20:49:51 fhajny Exp $
+#
+# PROVIDE: dnsdist
+# REQUIRE: DAEMON network
+# KEYWORD: shutdown
+
+if [ -f /etc/rc.subr ]; then
+ . /etc/rc.subr
+fi
+
+name="dnsdist"
+rcvar=$name
+command="@PREFIX@/bin/dnsdist"
+dnsdist_flags="${dnsdist_flags:- -d -u @DNSDIST_USER@ -g @DNSDIST@ -C @PKG_SYSCONFDIR@/dnsdist.conf}"
+
+if [ -f /etc/rc.subr ]; then
+ load_rc_config $name
+ run_rc_command "$1"
+else
+ echo -n "${name}"
+ ${command} ${dnsdist_flags}
+fi
diff --git a/net/dnsdist/files/smf/manifest.xml b/net/dnsdist/files/smf/manifest.xml
new file mode 100644
index 00000000000..cc9463e846c
--- /dev/null
+++ b/net/dnsdist/files/smf/manifest.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<service_bundle type="manifest" name="export">
+ <service name="@SMF_PREFIX@/dnsdist" type="service" version="1">
+ <create_default_instance enabled="false" />
+ <single_instance />
+ <dependency name="network" grouping="require_all" restart_on="error" type="service">
+ <service_fmri value="svc:/milestone/network:default" />
+ </dependency>
+ <dependency name="filesystem" grouping="require_all" restart_on="error" type="service">
+ <service_fmri value="svc:/system/filesystem/local" />
+ </dependency>
+ <exec_method type="method" name="start" exec="@PREFIX@/bin/dnsdist -d -u @DNSDIST_USER@ -g @DNSDIST_GROUP@ -C %{config_file}" timeout_seconds="60" />
+ <exec_method type="method" name="stop" exec=":kill" timeout_seconds="60" />
+ <property_group name="startd" type="framework">
+ <propval name="duration" type="astring" value="contract" />
+ <propval name="ignore_error" type="astring" value="core,signal" />
+ </property_group>
+ <property_group name="dnsdist" type="application">
+ <propval name="config_file" type="astring" value="@PKG_SYSCONFDIR@/dnsdist.conf" />
+ </property_group>
+ <template>
+ <common_name>
+ <loctext xml:lang="C">dnsdist daemon</loctext>
+ </common_name>
+ </template>
+ </service>
+</service_bundle>
diff --git a/net/dnsdist/patches/patch-dns.hh b/net/dnsdist/patches/patch-dns.hh
new file mode 100644
index 00000000000..43be6778f76
--- /dev/null
+++ b/net/dnsdist/patches/patch-dns.hh
@@ -0,0 +1,15 @@
+$NetBSD: patch-dns.hh,v 1.1 2017/03/31 20:49:51 fhajny Exp $
+
+Add NetBSD support.
+
+--- dns.hh.orig 2016-12-29 12:45:46.000000000 +0000
++++ dns.hh
+@@ -146,7 +146,7 @@ struct EDNS0Record
+
+ static_assert(sizeof(EDNS0Record) == 4, "EDNS0Record size must be 4");
+
+-#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
++#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
+ #include <machine/endian.h>
+ #elif __linux__ || __GNU__
+ # include <endian.h>
diff --git a/net/dnsdist/patches/patch-dnsdist-console.cc b/net/dnsdist/patches/patch-dnsdist-console.cc
new file mode 100644
index 00000000000..d14346d9399
--- /dev/null
+++ b/net/dnsdist/patches/patch-dnsdist-console.cc
@@ -0,0 +1,15 @@
+$NetBSD: patch-dnsdist-console.cc,v 1.1 2017/03/31 20:49:51 fhajny Exp $
+
+Add NetBSD support.
+
+--- dnsdist-console.cc.orig 2016-12-29 12:45:46.000000000 +0000
++++ dnsdist-console.cc
+@@ -22,7 +22,7 @@
+ #include "dnsdist.hh"
+ #include "sodcrypto.hh"
+
+-#if defined (__OpenBSD__)
++#if defined (__OpenBSD__) || defined (__NetBSD__)
+ #include <readline/readline.h>
+ #include <readline/history.h>
+ #else
diff --git a/net/dnsdist/patches/patch-dnsdist.cc b/net/dnsdist/patches/patch-dnsdist.cc
new file mode 100644
index 00000000000..8f18700ee40
--- /dev/null
+++ b/net/dnsdist/patches/patch-dnsdist.cc
@@ -0,0 +1,15 @@
+$NetBSD: patch-dnsdist.cc,v 1.1 2017/03/31 20:49:51 fhajny Exp $
+
+Add NetBSD support.
+
+--- dnsdist.cc.orig 2016-12-29 12:45:46.000000000 +0000
++++ dnsdist.cc
+@@ -27,7 +27,7 @@
+ #include <limits>
+ #include "dolog.hh"
+
+-#if defined (__OpenBSD__)
++#if defined (__OpenBSD__) || defined (__NetBSD__)
+ #include <readline/readline.h>
+ #else
+ #include <editline/readline.h>
diff --git a/net/dnsdist/patches/patch-iputils.hh b/net/dnsdist/patches/patch-iputils.hh
new file mode 100644
index 00000000000..b315c73e177
--- /dev/null
+++ b/net/dnsdist/patches/patch-iputils.hh
@@ -0,0 +1,50 @@
+$NetBSD: patch-iputils.hh,v 1.1 2017/03/31 20:49:51 fhajny Exp $
+
+- Do not use IP_PKTINFO on NetBSD, the structure is not as expected.
+- Backport fix for SunOS segfault problem, see:
+ https://github.com/PowerDNS/pdns/pull/4877
+
+--- iputils.hh.orig 2017-01-17 08:43:49.000000000 +0000
++++ iputils.hh
+@@ -40,6 +40,10 @@
+
+ #include "namespaces.hh"
+
++#if defined(__NetBSD__) && defined(IP_PKTINFO)
++#undef IP_PKTINFO
++#endif
++
+ #ifdef __APPLE__
+ #include <libkern/OSByteOrder.h>
+
+@@ -59,23 +63,22 @@
+ #define le64toh(x) OSSwapLittleToHostInt64(x)
+ #endif
+
+-// for illumos
+-#ifdef BE_64
++#ifdef __sun
+
+ #define htobe16(x) BE_16(x)
+ #define htole16(x) LE_16(x)
+-#define be16toh(x) BE_IN16(x)
+-#define le16toh(x) LE_IN16(x)
++#define be16toh(x) BE_IN16(&(x))
++#define le16toh(x) LE_IN16(&(x))
+
+ #define htobe32(x) BE_32(x)
+ #define htole32(x) LE_32(x)
+-#define be32toh(x) BE_IN32(x)
+-#define le32toh(x) LE_IN32(x)
++#define be32toh(x) BE_IN32(&(x))
++#define le32toh(x) LE_IN32(&(x))
+
+ #define htobe64(x) BE_64(x)
+ #define htole64(x) LE_64(x)
+-#define be64toh(x) BE_IN64(x)
+-#define le64toh(x) LE_IN64(x)
++#define be64toh(x) BE_IN64(&(x))
++#define le64toh(x) LE_IN64(&(x))
+
+ #endif
+
diff --git a/net/dnsdist/patches/patch-qtype.hh b/net/dnsdist/patches/patch-qtype.hh
new file mode 100644
index 00000000000..d50bb4229f4
--- /dev/null
+++ b/net/dnsdist/patches/patch-qtype.hh
@@ -0,0 +1,17 @@
+$NetBSD: patch-qtype.hh,v 1.1 2017/03/31 20:49:51 fhajny Exp $
+
+Avoid symbol pollution on SunOS.
+
+--- qtype.hh.orig 2017-01-17 08:43:49.000000000 +0000
++++ qtype.hh
+@@ -26,6 +26,10 @@
+ #include <vector>
+ #include "namespaces.hh"
+
++#if defined(__sun) && defined(DS)
++#undef DS
++#endif
++
+ /** The QType class is meant to deal easily with the different kind of resource types, like 'A', 'NS',
+ * 'CNAME' etcetera. These types have both a name and a number. This class can seamlessly move between
+ * them. Use it like this: