diff --git a/SOURCES/dnsmasq-2.66-dns-sleep-resume.patch b/SOURCES/dnsmasq-2.66-dns-sleep-resume.patch new file mode 100644 index 0000000..4f32bf1 --- /dev/null +++ b/SOURCES/dnsmasq-2.66-dns-sleep-resume.patch @@ -0,0 +1,127 @@ +commit 64d3d2c83b30c751570faf0c5d527ff3da9f2036 +Author: Beniamino Galvani +Date: Sun Aug 28 20:44:05 2016 +0100 + + Handle binding upstream servers to an interface + (--server=1.2.3.4@eth0) when the named interface + is destroyed and recreated in the kernel. + +diff --git a/src/dbus.c b/src/dbus.c +index 7379341..e56d8c7 100644 +--- a/src/dbus.c ++++ b/src/dbus.c +@@ -161,6 +161,10 @@ static void add_update_server(union mysockaddr *addr, + + if (serv) + { ++ serv->sfd = NULL; ++ serv->queries = 0; ++ serv->failed_queries = 0; ++ + if (interface) + strcpy(serv->interface, interface); + else +diff --git a/src/dnsmasq.h b/src/dnsmasq.h +index 69ae7a7..7b8020e 100644 +--- a/src/dnsmasq.h ++++ b/src/dnsmasq.h +@@ -412,6 +412,7 @@ struct serverfd { + int fd; + union mysockaddr source_addr; + char interface[IF_NAMESIZE+1]; ++ unsigned int ifindex, used; + struct serverfd *next; + }; + +diff --git a/src/network.c b/src/network.c +index 792914b..d2bebcc 100644 +--- a/src/network.c ++++ b/src/network.c +@@ -839,6 +839,7 @@ int local_bind(int fd, union mysockaddr *addr, char *intname, int is_tcp) + static struct serverfd *allocate_sfd(union mysockaddr *addr, char *intname) + { + struct serverfd *sfd; ++ unsigned int ifindex = 0; + int errsave; + + /* when using random ports, servers which would otherwise use +@@ -859,11 +860,15 @@ static struct serverfd *allocate_sfd(union mysockaddr *addr, char *intname) + return NULL; + #endif + } ++ ++ if (intname && strlen(intname) != 0) ++ ifindex = if_nametoindex(intname); /* index == 0 when not binding to an interface */ + + /* may have a suitable one already */ + for (sfd = daemon->sfds; sfd; sfd = sfd->next ) + if (sockaddr_isequal(&sfd->source_addr, addr) && +- strcmp(intname, sfd->interface) == 0) ++ strcmp(intname, sfd->interface) == 0 && ++ ifindex == sfd->ifindex) + return sfd; + + /* need to make a new one. */ +@@ -885,11 +890,13 @@ static struct serverfd *allocate_sfd(union mysockaddr *addr, char *intname) + errno = errsave; + return NULL; + } +- ++ + strcpy(sfd->interface, intname); + sfd->source_addr = *addr; + sfd->next = daemon->sfds; ++ sfd->ifindex = ifindex; + daemon->sfds = sfd; ++ + return sfd; + } + +@@ -944,12 +951,16 @@ void check_servers(void) + { + struct irec *iface; + struct server *new, *tmp, *ret = NULL; ++ struct serverfd *sfd, *tmpfd, **up; + int port = 0; + + /* interface may be new since startup */ + if (!option_bool(OPT_NOWILD)) + enumerate_interfaces(); + ++ for (sfd = daemon->sfds; sfd; sfd = sfd->next) ++ sfd->used = 0; ++ + for (new = daemon->servers; new; new = tmp) + { + tmp = new->next; +@@ -987,6 +998,9 @@ void check_servers(void) + free(new); + continue; + } ++ ++ if (new->sfd) ++ new->sfd->used = 1; + } + + /* reverse order - gets it right. */ +@@ -1019,6 +1033,20 @@ void check_servers(void) + } + } + ++ /* Remove unused sfds */ ++ for (sfd = daemon->sfds, up = &daemon->sfds; sfd; sfd = tmpfd) ++ { ++ tmpfd = sfd->next; ++ if (!sfd->used) ++ { ++ *up = sfd->next; ++ close(sfd->fd); ++ free(sfd); ++ } ++ else ++ up = &sfd->next; ++ } ++ + daemon->servers = ret; + } + diff --git a/SOURCES/dnsmasq-2.66-rh1275626.patch b/SOURCES/dnsmasq-2.66-rh1275626.patch new file mode 100644 index 0000000..a6171c8 --- /dev/null +++ b/SOURCES/dnsmasq-2.66-rh1275626.patch @@ -0,0 +1,15 @@ +--- dnsmasq-2.66/src/dhcp-common.c.orig 2016-05-31 12:59:36.269904624 +0200 ++++ dnsmasq-2.66/src/dhcp-common.c 2016-05-31 12:58:49.929904889 +0200 +@@ -316,9 +316,10 @@ + + /* dhcpcd prefixes ASCII client IDs by zero which is wrong, but we try and + cope with that here */ +- if (!(context->flags & CONTEXT_V6) && *clid == 0 && config->clid_len == clid_len-1 && ++ if ((!context || !(context->flags & CONTEXT_V6)) && (!clid || *clid == 0) && ++ config->clid_len == clid_len-1 && + memcmp(config->clid, clid+1, clid_len-1) == 0 && +- is_config_in_context(context, config)) ++ (!context || is_config_in_context(context, config))) + return config; + } + diff --git a/SPECS/dnsmasq.spec b/SPECS/dnsmasq.spec index 93ec46b..7b152d5 100644 --- a/SPECS/dnsmasq.spec +++ b/SPECS/dnsmasq.spec @@ -13,7 +13,7 @@ Name: dnsmasq Version: 2.66 -Release: 14%{?extraversion}%{?dist}.1 +Release: 21%{?extraversion}%{?dist} Summary: A lightweight DHCP/caching DNS server Group: System Environment/Daemons @@ -67,8 +67,12 @@ Patch19: %{name}-2.66-Set-SOREUSEADDR-as-well-as-SOREUSEPORT-on-DHCP-sock Patch20: %{name}-2.66-Support-IPv6-assignment-based-on-MAC-for-DHCPv6.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1232677 Patch21: %{name}-2.66-dhcp-v4-v6.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1275626 +Patch22: %{name}-2.66-rh1275626.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1358427 -Patch23: %{name}-2.66-numeric-hostnames.patch +Patch23: %{name}-2.66-numeric-hostnames.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1367772 +Patch24: %{name}-2.66-dns-sleep-resume.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -127,7 +131,9 @@ query/remove a DHCP server's leases. %patch19 -p1 -b .reuseport %patch20 -p1 %patch21 -p1 +%patch22 -p1 %patch23 -p1 +%patch24 -p1 # 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 @@ -208,8 +214,27 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man1/dhcp_* %changelog -* Tue Aug 30 2016 Pavel Šimerda - 2.66-14.1 -- Resolves: #1371460 - dhcp errors with hostnames beginning with numbers +* Tue Sep 13 2016 Pavel Šimerda - 2.66-21 +- Related: #1367772 - fix dns server update + +* Thu Sep 08 2016 Pavel Šimerda - 2.66-20 +- Related: #1367772 - additional upstream patch + +* Tue Sep 06 2016 Pavel Šimerda - 2.66-19 +- Resolves: #1367772 - dns not updated after sleep and resume laptop + +* Fri Aug 26 2016 root - 2.66-18 +- Resolves: #1358427 - dhcp errors with hostnames beginning with numbers + +* Tue May 31 2016 Pavel Šimerda - 2.66-17 +- Resolves: #1275626 - modify the patch using new information + +* Mon May 30 2016 Pavel Šimerda - 2.66-16 +- Resolves: #1275626 - use the patch + +* Wed May 25 2016 Pavel Šimerda - 2.66-15 +- Resolves: #1275626 - dnsmasq crash with coredump on infiniband network with + OpenStack * Thu Jun 25 2015 Pavel Šimerda - 2.66-14 - Resolves: #1232677 - handle IPv4 and IPv6 host entries properly