diff --git a/dnsmasq-2.66-Allow-option_number_zero_in_encapsulated_DHCP_options.patch b/dnsmasq-2.66-Allow-option_number_zero_in_encapsulated_DHCP_options.patch new file mode 100644 index 0000000..4acc08d --- /dev/null +++ b/dnsmasq-2.66-Allow-option_number_zero_in_encapsulated_DHCP_options.patch @@ -0,0 +1,142 @@ +From bd08ae67f9a0cae2ce15be885254cad9449d4551 Mon Sep 17 00:00:00 2001 +From: Simon Kelley +Date: Fri, 19 Apr 2013 10:22:06 +0100 +Subject: [PATCH] Allow option number zero in encapsulated DHCP options. + +--- + src/dhcp-common.c | 6 +++--- + src/dnsmasq.h | 4 ++-- + src/option.c | 33 ++++++++++++++++++++------------- + 3 files changed, 25 insertions(+), 18 deletions(-) + +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: 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: 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:| 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) +-- +1.8.1.4 + diff --git a/dnsmasq-2.66-Fix-wrong_size_in_memset_call.patch b/dnsmasq-2.66-Fix-wrong_size_in_memset_call.patch new file mode 100644 index 0000000..f5103bc --- /dev/null +++ b/dnsmasq-2.66-Fix-wrong_size_in_memset_call.patch @@ -0,0 +1,26 @@ +From 4582c0efe7d7af93517b1f3bcc7af67685ab3e5c Mon Sep 17 00:00:00 2001 +From: Dave Reisner +Date: Thu, 18 Apr 2013 09:47:49 +0100 +Subject: [PATCH] Fix wrong size in memset() call. + +Thanks to Dave Reisner. +--- + src/ipset.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/ipset.c b/src/ipset.c +index a34ed96..f175fa4 100644 +--- a/src/ipset.c ++++ b/src/ipset.c +@@ -110,7 +110,7 @@ static int new_add_to_ipset(const char *setname, const struct all_addr *ipaddr, + return -1; + } + +- memset(buffer, 0, sizeof(buffer)); ++ memset(buffer, 0, BUFF_SZ); + + nlh = (struct nlmsghdr *)buffer; + nlh->nlmsg_len = NL_ALIGN(sizeof(struct nlmsghdr)); +-- +1.8.1.4 + diff --git a/dnsmasq.spec b/dnsmasq.spec index 11729ee..ab8753e 100644 --- a/dnsmasq.spec +++ b/dnsmasq.spec @@ -11,7 +11,7 @@ Name: dnsmasq Version: 2.66 -Release: 2%{?extraversion}%{?dist} +Release: 3%{?extraversion}%{?dist} Summary: A lightweight DHCP/caching DNS server Group: System Environment/Daemons @@ -20,6 +20,12 @@ URL: http://www.thekelleys.org.uk/dnsmasq/ Source0: http://www.thekelleys.org.uk/dnsmasq/%{?extrapath}%{name}-%{version}%{?extraversion}.tar.gz Source1: %{name}.service +#include upstream bug fix patches committed after stable release +# commit 4582c0efe7d7af93517b1f3bcc7af67685ab3e5c +Patch0: %{name}-2.66-Fix-wrong_size_in_memset_call.patch +# commit bd08ae67f9a0cae2ce15be885254cad9449d4551 +Patch1: %{name}-2.66-Allow-option_number_zero_in_encapsulated_DHCP_options.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: dbus-devel @@ -54,6 +60,9 @@ query/remove a DHCP server's leases. %prep %setup -q -n %{name}-%{version}%{?extraversion} +%patch0 -p1 -b .wrong_size +%patch1 -p1 -b .zero_DHCP_option + # use /var/lib/dnsmasq instead of /var/lib/misc for file in dnsmasq.conf.example man/dnsmasq.8 man/es/dnsmasq.8 src/config.h; do sed -i 's|/var/lib/misc/dnsmasq.leases|/var/lib/dnsmasq/dnsmasq.leases|g' "$file" @@ -133,6 +142,9 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man1/dhcp_* %changelog +* Fri Apr 19 2013 Tomas Hozza - 2.66-3 +- include two fixes from upstream git repo + * Thu Apr 18 2013 Tomas Hozza - 2.66-2 - New stable version dnsmasq-2.66 - Drop of merged patch