diff options
-rw-r--r-- | net-dns/dnsmasq/ChangeLog | 9 | ||||
-rw-r--r-- | net-dns/dnsmasq/dnsmasq-2.66.ebuild | 134 | ||||
-rw-r--r-- | net-dns/dnsmasq/files/dnsmasq-2.66-dhcp-option-zero.patch | 134 | ||||
-rw-r--r-- | net-dns/dnsmasq/metadata.xml | 1 |
4 files changed, 277 insertions, 1 deletions
diff --git a/net-dns/dnsmasq/ChangeLog b/net-dns/dnsmasq/ChangeLog index 8916c00b76bf..5bc3652b10f2 100644 --- a/net-dns/dnsmasq/ChangeLog +++ b/net-dns/dnsmasq/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for net-dns/dnsmasq # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-dns/dnsmasq/ChangeLog,v 1.232 2013/01/15 01:05:50 chutzpah Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-dns/dnsmasq/ChangeLog,v 1.233 2013/04/19 17:31:24 chutzpah Exp $ + +*dnsmasq-2.66 (19 Apr 2013) + + 19 Apr 2013; Patrick McLean <chutz@gentoo.org> +dnsmasq-2.66.ebuild, + +files/dnsmasq-2.66-dhcp-option-zero.patch, metadata.xml: + Version bump, add USE flag for new dns authorative support, add upstream + patch to support dhcp option zero. *dnsmasq-2.65 (15 Jan 2013) diff --git a/net-dns/dnsmasq/dnsmasq-2.66.ebuild b/net-dns/dnsmasq/dnsmasq-2.66.ebuild new file mode 100644 index 000000000000..2e6c81856850 --- /dev/null +++ b/net-dns/dnsmasq/dnsmasq-2.66.ebuild @@ -0,0 +1,134 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-dns/dnsmasq/dnsmasq-2.66.ebuild,v 1.1 2013/04/19 17:31:24 chutzpah Exp $ + +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 ~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 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 + +RDEPEND="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="${RDEPEND} + virtual/pkgconfig + app-arch/xz-utils" + +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/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/metadata.xml b/net-dns/dnsmasq/metadata.xml index f3c01d57a85b..74dc8ba08f96 100644 --- a/net-dns/dnsmasq/metadata.xml +++ b/net-dns/dnsmasq/metadata.xml @@ -6,6 +6,7 @@ <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'>Enable support for reading ISC DHCPd lease files</flag> <flag name='script'>Enable support for calling scripts when leases change</flag> |