summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-dns/dnsmasq')
-rw-r--r--net-dns/dnsmasq/Manifest3
-rw-r--r--net-dns/dnsmasq/dnsmasq-2.66.ebuild137
-rw-r--r--net-dns/dnsmasq/dnsmasq-2.72-r2.ebuild190
-rw-r--r--net-dns/dnsmasq/dnsmasq-2.75.ebuild186
-rw-r--r--net-dns/dnsmasq/files/dnsmasq-2.47-fbsd-config.patch16
-rw-r--r--net-dns/dnsmasq/files/dnsmasq-2.66-dhcp-option-zero.patch134
-rw-r--r--net-dns/dnsmasq/files/dnsmasq-2.72-Fix-crash-caused-by-looking-up-servers.bind-when-many-servers-defined.patch28
-rw-r--r--net-dns/dnsmasq/files/dnsmasq-2.72-Fix-crash-on-receipt-of-certain-malformed-DNS-requests.patch40
-rw-r--r--net-dns/dnsmasq/files/dnsmasq-init-dhcp-r130
-rw-r--r--net-dns/dnsmasq/files/dnsmasq-init-r224
-rw-r--r--net-dns/dnsmasq/files/dnsmasq.confd-r14
-rw-r--r--net-dns/dnsmasq/files/dnsmasq.service12
-rw-r--r--net-dns/dnsmasq/files/dnsmasq.service-r112
-rw-r--r--net-dns/dnsmasq/metadata.xml20
14 files changed, 836 insertions, 0 deletions
diff --git a/net-dns/dnsmasq/Manifest b/net-dns/dnsmasq/Manifest
new file mode 100644
index 000000000000..c917141c3a85
--- /dev/null
+++ b/net-dns/dnsmasq/Manifest
@@ -0,0 +1,3 @@
+DIST dnsmasq-2.66.tar.xz 401056 SHA256 5e143947527bcdc46a30f4b1bbdfbfa96333dd98bcecdac3b5b1d6cacfe06c75 SHA512 f0bde09f178ca15f4c28efb06901213af9a009b4476daa8a08bafc7682b9ffed13ac65c5c232acdf828382f321137de08b4a33108d22613b198fe30695b3362c WHIRLPOOL e749d24017c35fdbaaaf417decdf9316e235cf7f96f031caceee14d06b982c285b0e561f50597cd12b6a31ef554f7f2e22ca6234f44a6d8bb066dede99461166
+DIST dnsmasq-2.72.tar.xz 454048 SHA256 7d0bd23f5d74b3a6b26a75d5ffcf9db81d461b47cbe578cb65a83a98008600b1 SHA512 d84b89c987966a5f5880aa329833626b0a017628dd6aa667bdad880d1c5f101a386dddb439eb6983d58952a36f25670bf58df94281b89320f02895a3e6af4cec WHIRLPOOL 491eadb0060f372a0b7f5855fb57040c4baf37352732a2943fb4173aa28e875b91537f87085201f13e76ec5680e4ad681992829a5cef800833be0911298a793c
+DIST dnsmasq-2.75.tar.xz 472484 SHA256 640c4e1d4c298e42458419cd78cfc26acc549401b1a34d271cd3e0e4226941f1 SHA512 dc6f64e8f04179bba4ceea5acbda4da27398e3e7a87f07ed645c383b0cccef416c438a859decff7be25849e28db9e53912693cdbf7f01ddd9bbf1d5e6ae2a8ec WHIRLPOOL ff2d0c2cb51cae6f2db09321c116003cdc512940001a839424a6ba1ba47deadfe412d01a0e68285250f7dbd9bef454c99e302805defc91783f703863c344b182
diff --git a/net-dns/dnsmasq/dnsmasq-2.66.ebuild b/net-dns/dnsmasq/dnsmasq-2.66.ebuild
new file mode 100644
index 000000000000..74eef761c495
--- /dev/null
+++ b/net-dns/dnsmasq/dnsmasq-2.66.ebuild
@@ -0,0 +1,137 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils toolchain-funcs flag-o-matic user systemd
+
+DESCRIPTION="Small forwarding DNS server"
+HOMEPAGE="http://www.thekelleys.org.uk/dnsmasq/"
+SRC_URI="http://www.thekelleys.org.uk/dnsmasq/${P}.tar.xz"
+
+LICENSE="|| ( GPL-2 GPL-3 )"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="auth-dns conntrack dbus +dhcp dhcp-tools idn ipv6 lua nls script selinux tftp"
+DM_LINGUAS="de es fi fr id it no pl pt_BR ro"
+for dm_lingua in ${DM_LINGUAS}; do
+ IUSE+=" linguas_${dm_lingua}"
+done
+
+CDEPEND="dbus? ( sys-apps/dbus )
+ idn? ( net-dns/libidn )
+ lua? ( dev-lang/lua )
+ conntrack? ( !s390? ( net-libs/libnetfilter_conntrack ) )
+ nls? (
+ sys-devel/gettext
+ net-dns/libidn
+ )"
+
+DEPEND="${CDEPEND}
+ virtual/pkgconfig
+ app-arch/xz-utils"
+
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-dnsmasq )"
+
+REQUIRED_USE="dhcp-tools? ( dhcp )
+ lua? ( script )
+ s390? ( !conntrack )"
+
+use_have() {
+ local NO_ONLY=""
+ if [ $1 == '-n' ]; then
+ NO_ONLY=1
+ shift
+ fi
+
+ local UWORD=${2:-$1}
+ UWORD=${UWORD^^*}
+
+ if ! use ${1}; then
+ echo " -DNO_${UWORD}"
+ elif [ -z "${NO_ONLY}" ]; then
+ echo " -DHAVE_${UWORD}"
+ fi
+}
+
+pkg_setup() {
+ enewgroup dnsmasq
+ enewuser dnsmasq -1 -1 /dev/null dnsmasq
+}
+
+src_prepare() {
+ # dnsmasq on FreeBSD wants the config file in a silly location, this fixes
+ epatch "${FILESDIR}/${P}-dhcp-option-zero.patch"
+ sed -i -r 's:lua5.[0-9]+:lua:' Makefile
+}
+
+src_configure() {
+ COPTS="$(use_have -n auth-dns auth)"
+ COPTS+="$(use_have conntrack)"
+ COPTS+="$(use_have dbus)"
+ COPTS+="$(use_have -n dhcp)"
+ COPTS+="$(use_have idn)"
+ COPTS+="$(use_have -n ipv6)"
+ COPTS+="$(use_have lua luascript)"
+ COPTS+="$(use_have -n script)"
+ COPTS+="$(use_have -n tftp)"
+ COPTS+="$(use ipv6 && use dhcp || echo " -DNO_DHCP6")"
+}
+
+src_compile() {
+ emake \
+ PREFIX=/usr \
+ CC="$(tc-getCC)" \
+ CFLAGS="${CFLAGS}" \
+ LDFLAGS="${LDFLAGS}" \
+ COPTS="${COPTS}" \
+ CONFFILE="/etc/${PN}.conf" \
+ all$(use nls && echo "-i18n")
+
+ use dhcp-tools && emake -C contrib/wrt \
+ PREFIX=/usr \
+ CC="$(tc-getCC)" \
+ CFLAGS="${CFLAGS}" \
+ LDFLAGS="${LDFLAGS}" \
+ all
+}
+
+src_install() {
+ emake \
+ PREFIX=/usr \
+ MANDIR=/usr/share/man \
+ DESTDIR="${D}" \
+ install$(use nls && echo "-i18n")
+
+ local lingua
+ for lingua in ${DM_LINGUAS}; do
+ use linguas_${lingua} || rm -rf "${D}"/usr/share/locale/${lingua}
+ done
+ rmdir --ignore-fail-on-non-empty "${D}"/usr/share/locale/
+
+ dodoc CHANGELOG CHANGELOG.archive FAQ
+ dodoc -r logo
+
+ dodoc CHANGELOG FAQ
+ dohtml *.html
+
+ newinitd "${FILESDIR}"/dnsmasq-init-r2 dnsmasq
+ newconfd "${FILESDIR}"/dnsmasq.confd-r1 dnsmasq
+
+ insinto /etc
+ newins dnsmasq.conf.example dnsmasq.conf
+
+ if use dbus; then
+ insinto /etc/dbus-1/system.d
+ doins dbus/dnsmasq.conf
+ fi
+
+ if use dhcp-tools; then
+ dosbin contrib/wrt/{dhcp_release,dhcp_lease_time}
+ doman contrib/wrt/{dhcp_release,dhcp_lease_time}.1
+ fi
+
+ systemd_dounit "${FILESDIR}"/dnsmasq.service
+}
diff --git a/net-dns/dnsmasq/dnsmasq-2.72-r2.ebuild b/net-dns/dnsmasq/dnsmasq-2.72-r2.ebuild
new file mode 100644
index 000000000000..2f14c001a891
--- /dev/null
+++ b/net-dns/dnsmasq/dnsmasq-2.72-r2.ebuild
@@ -0,0 +1,190 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils toolchain-funcs flag-o-matic user systemd
+
+DESCRIPTION="Small forwarding DNS server"
+HOMEPAGE="http://www.thekelleys.org.uk/dnsmasq/doc.html"
+SRC_URI="http://www.thekelleys.org.uk/dnsmasq/${P}.tar.xz"
+
+LICENSE="|| ( GPL-2 GPL-3 )"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="auth-dns conntrack dbus +dhcp dhcp-tools dnssec idn ipv6 lua nls script selinux static tftp"
+DM_LINGUAS="de es fi fr id it no pl pt_BR ro"
+for dm_lingua in ${DM_LINGUAS}; do
+ IUSE+=" linguas_${dm_lingua}"
+done
+
+CDEPEND="dbus? ( sys-apps/dbus )
+ idn? ( net-dns/libidn )
+ lua? (
+ || (
+ dev-lang/lua:0
+ dev-lang/lua:5.1
+ )
+ )
+ conntrack? ( net-libs/libnetfilter_conntrack )
+ nls? (
+ sys-devel/gettext
+ net-dns/libidn
+ )
+"
+
+DEPEND="${CDEPEND}
+ app-arch/xz-utils
+ dnssec? (
+ dev-libs/nettle[gmp]
+ static? (
+ dev-libs/nettle[static-libs(+)]
+ )
+ )
+ virtual/pkgconfig"
+
+RDEPEND="${CDEPEND}
+ dnssec? (
+ !static? (
+ dev-libs/nettle[gmp]
+ )
+ )
+ selinux? ( sec-policy/selinux-dnsmasq )
+"
+
+REQUIRED_USE="dhcp-tools? ( dhcp )
+ lua? ( script )"
+
+use_have() {
+ local useflag no_only uword
+ if [[ $1 == '-n' ]]; then
+ no_only=1
+ shift
+ fi
+ useflag="${1}"
+ shift
+
+ uword="${1:-${useflag}}"
+ shift
+
+ while [[ ${uword} ]]; do
+ uword=${uword^^*}
+
+ if ! use "${useflag}"; then
+ echo -n " -DNO_${uword}"
+ elif [[ -z "${no_only}" ]]; then
+ echo -n " -DHAVE_${uword}"
+ fi
+ uword="${1}"
+ shift
+ done
+}
+
+pkg_pretend() {
+ if use static; then
+ einfo "Only sys-libs/gmp and dev-libs/nettle are statically linked."
+ use dnssec || einfo "Thus, ${P}[!dnssec,static] makes no sense; the static USE flag is ignored."
+ fi
+}
+
+pkg_setup() {
+ enewgroup dnsmasq
+ enewuser dnsmasq -1 -1 /dev/null dnsmasq
+}
+
+src_prepare() {
+ sed -i -r 's:lua5.[0-9]+:lua:' Makefile
+ sed -i "s:%%PREFIX%%:${EPREFIX}/usr:" dnsmasq.conf.example
+
+ epatch "${FILESDIR}"/${P}-Fix-crash-on-receipt-of-certain-malformed-DNS-requests.patch
+ epatch "${FILESDIR}"/${P}-Fix-crash-caused-by-looking-up-servers.bind-when-many-servers-defined.patch
+}
+
+src_configure() {
+ COPTS="$(use_have -n auth-dns auth)"
+ COPTS+="$(use_have conntrack)"
+ COPTS+="$(use_have dbus)"
+ COPTS+="$(use_have idn)"
+ COPTS+="$(use_have -n dhcp dhcp dhcp6)"
+ COPTS+="$(use_have -n ipv6 ipv6 dhcp6)"
+ COPTS+="$(use_have lua luascript)"
+ COPTS+="$(use_have -n script)"
+ COPTS+="$(use_have -n tftp)"
+ COPTS+="$(use_have dnssec)"
+ COPTS+="$(use_have static dnssec_static)"
+}
+
+src_compile() {
+ emake \
+ PREFIX=/usr \
+ CC="$(tc-getCC)" \
+ CFLAGS="${CFLAGS}" \
+ LDFLAGS="${LDFLAGS}" \
+ COPTS="${COPTS}" \
+ CONFFILE="/etc/${PN}.conf" \
+ all$(use nls && echo "-i18n")
+
+ use dhcp-tools && emake -C contrib/wrt \
+ PREFIX=/usr \
+ CC="$(tc-getCC)" \
+ CFLAGS="${CFLAGS}" \
+ LDFLAGS="${LDFLAGS}" \
+ all
+}
+
+src_install() {
+ local lingua puid
+ emake \
+ PREFIX=/usr \
+ MANDIR=/usr/share/man \
+ DESTDIR="${D}" \
+ install$(use nls && echo "-i18n")
+
+ for lingua in ${DM_LINGUAS}; do
+ use linguas_${lingua} || rm -rf "${D}"/usr/share/locale/${lingua}
+ done
+ [[ -d "${D}"/usr/share/locale/ ]] && rmdir --ignore-fail-on-non-empty "${D}"/usr/share/locale/
+
+ dodoc CHANGELOG CHANGELOG.archive FAQ dnsmasq.conf.example
+ dodoc -r logo
+
+ dodoc CHANGELOG FAQ
+ dohtml *.html
+
+ newinitd "${FILESDIR}"/dnsmasq-init-r2 ${PN}
+ newconfd "${FILESDIR}"/dnsmasq.confd-r1 ${PN}
+
+ insinto /etc
+ newins dnsmasq.conf.example dnsmasq.conf
+
+ insinto /usr/share/dnsmasq
+ doins trust-anchors.conf
+
+ if use dhcp; then
+ dodir /var/lib/misc
+ newinitd "${FILESDIR}"/dnsmasq-init-dhcp-r1 ${PN}
+ fi
+ if use dbus; then
+ insinto /etc/dbus-1/system.d
+ doins dbus/dnsmasq.conf
+ fi
+
+ if use dhcp-tools; then
+ dosbin contrib/wrt/{dhcp_release,dhcp_lease_time}
+ doman contrib/wrt/{dhcp_release,dhcp_lease_time}.1
+ fi
+
+ systemd_newunit "${FILESDIR}"/${PN}.service-r1 ${PN}.service
+
+}
+
+pkg_preinst() {
+ # temporary workaround to (hopefully) prevent leases file from being removed
+ [[ -f /var/lib/misc/dnsmasq.leases ]] && cp /var/lib/misc/dnsmasq.leases "${T}"
+}
+
+pkg_postinst() {
+ # temporary workaround to (hopefully) prevent leases file from being removed
+ [[ -f "${T}"/dnsmasq.leases ]] && cp "${T}"/dnsmasq.leases /var/lib/misc/dnsmasq.leases
+}
diff --git a/net-dns/dnsmasq/dnsmasq-2.75.ebuild b/net-dns/dnsmasq/dnsmasq-2.75.ebuild
new file mode 100644
index 000000000000..05bc1cd73145
--- /dev/null
+++ b/net-dns/dnsmasq/dnsmasq-2.75.ebuild
@@ -0,0 +1,186 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils toolchain-funcs flag-o-matic user systemd
+
+DESCRIPTION="Small forwarding DNS server"
+HOMEPAGE="http://www.thekelleys.org.uk/dnsmasq/doc.html"
+SRC_URI="http://www.thekelleys.org.uk/dnsmasq/${P}.tar.xz"
+
+LICENSE="|| ( GPL-2 GPL-3 )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="auth-dns conntrack dbus +dhcp dhcp-tools dnssec idn +inotify ipv6 lua nls script selinux static tftp"
+DM_LINGUAS="de es fi fr id it no pl pt_BR ro"
+for dm_lingua in ${DM_LINGUAS}; do
+ IUSE+=" linguas_${dm_lingua}"
+done
+
+CDEPEND="dbus? ( sys-apps/dbus )
+ idn? ( net-dns/libidn )
+ lua? ( dev-lang/lua:* )
+ conntrack? ( net-libs/libnetfilter_conntrack )
+ nls? (
+ sys-devel/gettext
+ net-dns/libidn
+ )
+"
+
+DEPEND="${CDEPEND}
+ app-arch/xz-utils
+ dnssec? (
+ dev-libs/nettle[gmp]
+ static? (
+ dev-libs/nettle[static-libs(+)]
+ )
+ )
+ virtual/pkgconfig"
+
+RDEPEND="${CDEPEND}
+ dnssec? (
+ !static? (
+ dev-libs/nettle[gmp]
+ )
+ )
+ selinux? ( sec-policy/selinux-dnsmasq )
+"
+
+REQUIRED_USE="dhcp-tools? ( dhcp )
+ lua? ( script )"
+
+use_have() {
+ local useflag no_only uword
+ if [[ $1 == '-n' ]]; then
+ no_only=1
+ shift
+ fi
+ useflag="${1}"
+ shift
+
+ uword="${1:-${useflag}}"
+ shift
+
+ while [[ ${uword} ]]; do
+ uword=${uword^^*}
+
+ if ! use "${useflag}"; then
+ echo -n " -DNO_${uword}"
+ elif [[ -z "${no_only}" ]]; then
+ echo -n " -DHAVE_${uword}"
+ fi
+ uword="${1}"
+ shift
+ done
+}
+
+pkg_pretend() {
+ if use static; then
+ einfo "Only sys-libs/gmp and dev-libs/nettle are statically linked."
+ use dnssec || einfo "Thus, ${P}[!dnssec,static] makes no sense; the static USE flag is ignored."
+ fi
+}
+
+pkg_setup() {
+ enewgroup dnsmasq
+ enewuser dnsmasq -1 -1 /dev/null dnsmasq
+}
+
+src_prepare() {
+ sed -i -r 's:lua5.[0-9]+:lua:' Makefile
+ sed -i "s:%%PREFIX%%:${EPREFIX}/usr:" dnsmasq.conf.example
+}
+
+src_configure() {
+ COPTS="$(use_have -n auth-dns auth)"
+ COPTS+="$(use_have conntrack)"
+ COPTS+="$(use_have dbus)"
+ COPTS+="$(use_have idn)"
+ COPTS+="$(use_have -n inotify)"
+ COPTS+="$(use_have -n dhcp dhcp dhcp6)"
+ COPTS+="$(use_have -n ipv6 ipv6 dhcp6)"
+ COPTS+="$(use_have lua luascript)"
+ COPTS+="$(use_have -n script)"
+ COPTS+="$(use_have -n tftp)"
+ COPTS+="$(use_have dnssec)"
+ COPTS+="$(use_have static dnssec_static)"
+}
+
+src_compile() {
+ emake \
+ PREFIX=/usr \
+ MANDIR=/usr/share/man \
+ CC="$(tc-getCC)" \
+ CFLAGS="${CFLAGS}" \
+ LDFLAGS="${LDFLAGS}" \
+ COPTS="${COPTS}" \
+ CONFFILE="/etc/${PN}.conf" \
+ all$(use nls && echo "-i18n")
+
+ use dhcp-tools && emake -C contrib/wrt \
+ PREFIX=/usr \
+ MANDIR=/usr/share/man \
+ CC="$(tc-getCC)" \
+ CFLAGS="${CFLAGS}" \
+ LDFLAGS="${LDFLAGS}" \
+ all
+}
+
+src_install() {
+ local lingua puid
+ emake \
+ PREFIX=/usr \
+ MANDIR=/usr/share/man \
+ COPTS="${COPTS}" \
+ DESTDIR="${D}" \
+ install$(use nls && echo "-i18n")
+
+ for lingua in ${DM_LINGUAS}; do
+ use linguas_${lingua} || rm -rf "${D}"/usr/share/locale/${lingua}
+ done
+ [[ -d "${D}"/usr/share/locale/ ]] && rmdir --ignore-fail-on-non-empty "${D}"/usr/share/locale/
+
+ dodoc CHANGELOG CHANGELOG.archive FAQ dnsmasq.conf.example
+ dodoc -r logo
+
+ dodoc CHANGELOG FAQ
+ dohtml *.html
+
+ newinitd "${FILESDIR}"/dnsmasq-init-r2 ${PN}
+ newconfd "${FILESDIR}"/dnsmasq.confd-r1 ${PN}
+
+ insinto /etc
+ newins dnsmasq.conf.example dnsmasq.conf
+
+ insinto /usr/share/dnsmasq
+ doins trust-anchors.conf
+
+ if use dhcp; then
+ dodir /var/lib/misc
+ newinitd "${FILESDIR}"/dnsmasq-init-dhcp-r1 ${PN}
+ fi
+ if use dbus; then
+ insinto /etc/dbus-1/system.d
+ doins dbus/dnsmasq.conf
+ fi
+
+ if use dhcp-tools; then
+ dosbin contrib/wrt/{dhcp_release,dhcp_lease_time}
+ doman contrib/wrt/{dhcp_release,dhcp_lease_time}.1
+ fi
+
+ systemd_newunit "${FILESDIR}"/${PN}.service-r1 ${PN}.service
+
+}
+
+pkg_preinst() {
+ # temporary workaround to (hopefully) prevent leases file from being removed
+ [[ -f /var/lib/misc/dnsmasq.leases ]] && cp /var/lib/misc/dnsmasq.leases "${T}"
+}
+
+pkg_postinst() {
+ # temporary workaround to (hopefully) prevent leases file from being removed
+ [[ -f "${T}"/dnsmasq.leases ]] && cp "${T}"/dnsmasq.leases /var/lib/misc/dnsmasq.leases
+}
diff --git a/net-dns/dnsmasq/files/dnsmasq-2.47-fbsd-config.patch b/net-dns/dnsmasq/files/dnsmasq-2.47-fbsd-config.patch
new file mode 100644
index 000000000000..38a3679bd240
--- /dev/null
+++ b/net-dns/dnsmasq/files/dnsmasq-2.47-fbsd-config.patch
@@ -0,0 +1,16 @@
+diff -ur dnsmasq-2.47.orig/src/config.h dnsmasq-2.47/src/config.h
+--- dnsmasq-2.47.orig/src/config.h 2009-02-05 07:14:24.000000000 -0500
++++ dnsmasq-2.47/src/config.h 2009-03-30 00:04:52.000000000 -0400
+@@ -50,11 +50,7 @@
+ #endif
+
+ #ifndef CONFFILE
+-# if defined(__FreeBSD__)
+-# define CONFFILE "/usr/local/etc/dnsmasq.conf"
+-# else
+-# define CONFFILE "/etc/dnsmasq.conf"
+-# endif
++# define CONFFILE "/etc/dnsmasq.conf"
+ #endif
+
+ #define DEFLEASE 3600 /* default lease time, 1 hour */
diff --git a/net-dns/dnsmasq/files/dnsmasq-2.66-dhcp-option-zero.patch b/net-dns/dnsmasq/files/dnsmasq-2.66-dhcp-option-zero.patch
new file mode 100644
index 000000000000..6c52a533f1a1
--- /dev/null
+++ b/net-dns/dnsmasq/files/dnsmasq-2.66-dhcp-option-zero.patch
@@ -0,0 +1,134 @@
+commit bd08ae67f9a0cae2ce15be885254cad9449d4551
+Author: Simon Kelley <simon@thekelleys.org.uk>
+Date: Fri Apr 19 10:22:06 2013 +0100
+
+ Allow option number zero in encapsulated DHCP options.
+
+diff --git a/src/dhcp-common.c b/src/dhcp-common.c
+index f4fd088..8de4268 100644
+--- a/src/dhcp-common.c
++++ b/src/dhcp-common.c
+@@ -512,7 +512,7 @@ void display_opts6(void)
+ }
+ #endif
+
+-u16 lookup_dhcp_opt(int prot, char *name)
++int lookup_dhcp_opt(int prot, char *name)
+ {
+ const struct opttab_t *t;
+ int i;
+@@ -528,10 +528,10 @@ u16 lookup_dhcp_opt(int prot, char *name)
+ if (strcasecmp(t[i].name, name) == 0)
+ return t[i].val;
+
+- return 0;
++ return -1;
+ }
+
+-u16 lookup_dhcp_len(int prot, u16 val)
++int lookup_dhcp_len(int prot, int val)
+ {
+ const struct opttab_t *t;
+ int i;
+diff --git a/src/dnsmasq.h b/src/dnsmasq.h
+index 69ae7a7..41e2798 100644
+--- a/src/dnsmasq.h
++++ b/src/dnsmasq.h
+@@ -1216,8 +1216,8 @@ void log_tags(struct dhcp_netid *netid, u32 xid);
+ int match_bytes(struct dhcp_opt *o, unsigned char *p, int len);
+ void dhcp_update_configs(struct dhcp_config *configs);
+ void display_opts(void);
+-u16 lookup_dhcp_opt(int prot, char *name);
+-u16 lookup_dhcp_len(int prot, u16 val);
++int lookup_dhcp_opt(int prot, char *name);
++int lookup_dhcp_len(int prot, int val);
+ char *option_string(int prot, unsigned int opt, unsigned char *val,
+ int opt_len, char *buf, int buf_len);
+ #ifdef HAVE_LINUX_NETWORK
+diff --git a/src/option.c b/src/option.c
+index b2596ec..2a61017 100644
+--- a/src/option.c
++++ b/src/option.c
+@@ -750,6 +750,7 @@ static int parse_dhcp_opt(char *errstr, char *arg, int flags)
+ struct dhcp_netid *np = NULL;
+ u16 opt_len = 0;
+ int is6 = 0;
++ int option_ok = 0;
+
+ new->len = 0;
+ new->flags = flags;
+@@ -769,16 +770,19 @@ static int parse_dhcp_opt(char *errstr, char *arg, int flags)
+ {
+ new->opt = atoi(arg);
+ opt_len = 0;
++ option_ok = 1;
+ break;
+ }
+
+ if (strstr(arg, "option:") == arg)
+ {
+- new->opt = lookup_dhcp_opt(AF_INET, arg+7);
+- opt_len = lookup_dhcp_len(AF_INET, new->opt);
+- /* option:<optname> must follow tag and vendor string. */
+- if ((opt_len & OT_INTERNAL) && flags != DHOPT_MATCH)
+- new->opt = 0;
++ if ((new->opt = lookup_dhcp_opt(AF_INET, arg+7)) != -1)
++ {
++ opt_len = lookup_dhcp_len(AF_INET, new->opt);
++ /* option:<optname> must follow tag and vendor string. */
++ if (!(opt_len & OT_INTERNAL) || flags == DHOPT_MATCH)
++ option_ok = 1;
++ }
+ break;
+ }
+ #ifdef HAVE_DHCP6
+@@ -792,13 +796,16 @@ static int parse_dhcp_opt(char *errstr, char *arg, int flags)
+ {
+ new->opt = atoi(arg+8);
+ opt_len = 0;
++ option_ok = 1;
+ }
+ else
+ {
+- new->opt = lookup_dhcp_opt(AF_INET6, arg+8);
+- opt_len = lookup_dhcp_len(AF_INET6, new->opt);
+- if ((opt_len & OT_INTERNAL) && flags != DHOPT_MATCH)
+- new->opt = 0;
++ if ((new->opt = lookup_dhcp_opt(AF_INET6, arg+8)) != -1)
++ {
++ opt_len = lookup_dhcp_len(AF_INET6, new->opt);
++ if (!(opt_len & OT_INTERNAL) || flags == DHOPT_MATCH)
++ option_ok = 1;
++ }
+ }
+ /* option6:<opt>|<optname> must follow tag and vendor string. */
+ is6 = 1;
+@@ -821,7 +828,7 @@ static int parse_dhcp_opt(char *errstr, char *arg, int flags)
+ new->flags |= DHOPT_RFC3925;
+ if (flags == DHOPT_MATCH)
+ {
+- new->opt = 1; /* avoid error below */
++ option_ok = 1;
+ break;
+ }
+ }
+@@ -848,16 +855,16 @@ static int parse_dhcp_opt(char *errstr, char *arg, int flags)
+
+ if (opt_len == 0 &&
+ !(new->flags & DHOPT_RFC3925))
+- opt_len = lookup_dhcp_len(AF_INET6 ,new->opt);
++ opt_len = lookup_dhcp_len(AF_INET6, new->opt);
+ }
+ else
+ #endif
+ if (opt_len == 0 &&
+ !(new->flags & (DHOPT_VENDOR | DHOPT_ENCAPSULATE | DHOPT_RFC3925)))
+- opt_len = lookup_dhcp_len(AF_INET ,new->opt);
++ opt_len = lookup_dhcp_len(AF_INET, new->opt);
+
+ /* option may be missing with rfc3925 match */
+- if (new->opt == 0)
++ if (!option_ok)
+ ret_err(_("bad dhcp-option"));
+
+ if (comma)
diff --git a/net-dns/dnsmasq/files/dnsmasq-2.72-Fix-crash-caused-by-looking-up-servers.bind-when-many-servers-defined.patch b/net-dns/dnsmasq/files/dnsmasq-2.72-Fix-crash-caused-by-looking-up-servers.bind-when-many-servers-defined.patch
new file mode 100644
index 000000000000..57708b6f716e
--- /dev/null
+++ b/net-dns/dnsmasq/files/dnsmasq-2.72-Fix-crash-caused-by-looking-up-servers.bind-when-many-servers-defined.patch
@@ -0,0 +1,28 @@
+commit 04b0ac05377936d121a36873bb63d492cde292c9
+Author: Simon Kelley <simon@thekelleys.org.uk>
+Date: Mon Apr 6 17:19:13 2015 +0100
+
+ Fix crash caused by looking up servers.bind when many servers defined.
+
+diff --git a/src/cache.c b/src/cache.c
+index d7bea57..178d654 100644
+--- a/src/cache.c
++++ b/src/cache.c
+@@ -1367,7 +1367,7 @@ int cache_make_stat(struct txt_record *t)
+ }
+ port = prettyprint_addr(&serv->addr, daemon->addrbuff);
+ lenp = p++; /* length */
+- bytes_avail = (p - buff) + bufflen;
++ bytes_avail = bufflen - (p - buff );
+ bytes_needed = snprintf(p, bytes_avail, "%s#%d %u %u", daemon->addrbuff, port, queries, failed_queries);
+ if (bytes_needed >= bytes_avail)
+ {
+@@ -1381,7 +1381,7 @@ int cache_make_stat(struct txt_record *t)
+ lenp = p - 1;
+ buff = new;
+ bufflen = newlen;
+- bytes_avail = (p - buff) + bufflen;
++ bytes_avail = bufflen - (p - buff );
+ bytes_needed = snprintf(p, bytes_avail, "%s#%d %u %u", daemon->addrbuff, port, queries, failed_queries);
+ }
+ *lenp = bytes_needed;
diff --git a/net-dns/dnsmasq/files/dnsmasq-2.72-Fix-crash-on-receipt-of-certain-malformed-DNS-requests.patch b/net-dns/dnsmasq/files/dnsmasq-2.72-Fix-crash-on-receipt-of-certain-malformed-DNS-requests.patch
new file mode 100644
index 000000000000..c6106db510de
--- /dev/null
+++ b/net-dns/dnsmasq/files/dnsmasq-2.72-Fix-crash-on-receipt-of-certain-malformed-DNS-requests.patch
@@ -0,0 +1,40 @@
+commit ad4a8ff7d9097008d7623df8543df435bfddeac8
+Author: Simon Kelley <simon@thekelleys.org.uk>
+Date: Thu Apr 9 21:48:00 2015 +0100
+
+ Fix crash on receipt of certain malformed DNS requests.
+
+diff --git a/src/rfc1035.c b/src/rfc1035.c
+index 7a07b0c..a995ab5 100644
+--- a/src/rfc1035.c
++++ b/src/rfc1035.c
+@@ -1198,7 +1198,10 @@ unsigned int extract_request(struct dns_header *header, size_t qlen, char *name,
+ size_t setup_reply(struct dns_header *header, size_t qlen,
+ struct all_addr *addrp, unsigned int flags, unsigned long ttl)
+ {
+- unsigned char *p = skip_questions(header, qlen);
++ unsigned char *p;
++
++ if (!(p = skip_questions(header, qlen)))
++ return 0;
+
+ /* clear authoritative and truncated flags, set QR flag */
+ header->hb3 = (header->hb3 & ~(HB3_AA | HB3_TC)) | HB3_QR;
+@@ -1214,7 +1217,7 @@ size_t setup_reply(struct dns_header *header, size_t qlen,
+ SET_RCODE(header, NOERROR); /* empty domain */
+ else if (flags == F_NXDOMAIN)
+ SET_RCODE(header, NXDOMAIN);
+- else if (p && flags == F_IPV4)
++ else if (flags == F_IPV4)
+ { /* we know the address */
+ SET_RCODE(header, NOERROR);
+ header->ancount = htons(1);
+@@ -1222,7 +1225,7 @@ size_t setup_reply(struct dns_header *header, size_t qlen,
+ add_resource_record(header, NULL, NULL, sizeof(struct dns_header), &p, ttl, NULL, T_A, C_IN, "4", addrp);
+ }
+ #ifdef HAVE_IPV6
+- else if (p && flags == F_IPV6)
++ else if (flags == F_IPV6)
+ {
+ SET_RCODE(header, NOERROR);
+ header->ancount = htons(1);
diff --git a/net-dns/dnsmasq/files/dnsmasq-init-dhcp-r1 b/net-dns/dnsmasq/files/dnsmasq-init-dhcp-r1
new file mode 100644
index 000000000000..07f0d2181d98
--- /dev/null
+++ b/net-dns/dnsmasq/files/dnsmasq-init-dhcp-r1
@@ -0,0 +1,30 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Id$
+
+extra_started_commands="reload"
+
+pidfile="/var/run/dnsmasq.pid"
+command="/usr/sbin/dnsmasq"
+command_args="-x ${pidfile} ${DNSMASQ_OPTS}"
+start_stop_daemon_args="--retry TERM/3/TERM/5"
+
+depend() {
+ provide dns
+ need localmount net
+ after bootmisc
+ use logger
+}
+
+start_pre() {
+ checkpath --owner dnsmasq:dnsmasq \
+ --mode 0644 \
+ --file /var/lib/misc/dnsmasq.leases
+}
+
+reload() {
+ ebegin "Reloading ${RC_SVCNAME}"
+ kill -HUP $(cat "${pidfile}")
+ eend $?
+}
diff --git a/net-dns/dnsmasq/files/dnsmasq-init-r2 b/net-dns/dnsmasq/files/dnsmasq-init-r2
new file mode 100644
index 000000000000..94627ef95b00
--- /dev/null
+++ b/net-dns/dnsmasq/files/dnsmasq-init-r2
@@ -0,0 +1,24 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Id$
+
+extra_started_commands="reload"
+
+pidfile="/var/run/dnsmasq.pid"
+command="/usr/sbin/dnsmasq"
+command_args="-x ${pidfile} ${DNSMASQ_OPTS}"
+start_stop_daemon_args="--retry TERM/3/TERM/5"
+
+depend() {
+ provide dns
+ need localmount net
+ after bootmisc
+ use logger
+}
+
+reload() {
+ ebegin "Reloading ${SVCNAME}"
+ kill -HUP $(cat "${pidfile}")
+ eend $?
+}
diff --git a/net-dns/dnsmasq/files/dnsmasq.confd-r1 b/net-dns/dnsmasq/files/dnsmasq.confd-r1
new file mode 100644
index 000000000000..0e94463074c9
--- /dev/null
+++ b/net-dns/dnsmasq/files/dnsmasq.confd-r1
@@ -0,0 +1,4 @@
+# /etc/conf.d/dnsmasq: config file for /etc/init.d/dnsmasq
+
+# See the dnsmasq(8) man page for possible options to put here.
+DNSMASQ_OPTS="--user=dnsmasq --group=dnsmasq"
diff --git a/net-dns/dnsmasq/files/dnsmasq.service b/net-dns/dnsmasq/files/dnsmasq.service
new file mode 100644
index 000000000000..8e313bcfd996
--- /dev/null
+++ b/net-dns/dnsmasq/files/dnsmasq.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=A lightweight DHCP and caching DNS server
+After=network.target
+
+[Service]
+Type=simple
+ExecStartPre=/usr/sbin/dnsmasq --test
+ExecStart=/usr/sbin/dnsmasq -k --user=dnsmasq --group=dnsmasq
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-dns/dnsmasq/files/dnsmasq.service-r1 b/net-dns/dnsmasq/files/dnsmasq.service-r1
new file mode 100644
index 000000000000..8e313bcfd996
--- /dev/null
+++ b/net-dns/dnsmasq/files/dnsmasq.service-r1
@@ -0,0 +1,12 @@
+[Unit]
+Description=A lightweight DHCP and caching DNS server
+After=network.target
+
+[Service]
+Type=simple
+ExecStartPre=/usr/sbin/dnsmasq --test
+ExecStart=/usr/sbin/dnsmasq -k --user=dnsmasq --group=dnsmasq
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-dns/dnsmasq/metadata.xml b/net-dns/dnsmasq/metadata.xml
new file mode 100644
index 000000000000..7d417df79405
--- /dev/null
+++ b/net-dns/dnsmasq/metadata.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+<email>chutzpah@gentoo.org</email>
+<name>Patrick McLean</name>
+</maintainer>
+<use>
+ <flag name='auth-dns'>Add support for acting as an authorative DNS server.</flag>
+ <flag name='conntrack'>Add support for Linux conntrack connection marking.</flag>
+ <flag name='dhcp-tools'>Install extra command line tools for manually managing DHCP leases.</flag>
+ <flag name='dhcp'>Enable support for acting as a DHCP server.</flag>
+ <flag name='dnssec'>Enable support DNSSEC validation and caching.</flag>
+ <flag name='script'>Enable support for calling scripts when leases change.</flag>
+ <flag name='tftp'>Enables built in TFTP server for netbooting.</flag>
+</use>
+<upstream>
+ <remote-id type="cpe">cpe:/a:thekelleys:dnsmasq</remote-id>
+</upstream>
+</pkgmetadata>