Update to 2.77rc2

This commit is contained in:
Petr Menšík 2017-05-11 18:05:24 +02:00
parent 1db48a66a4
commit 389f40bfd5
5 changed files with 12 additions and 253 deletions

1
.gitignore vendored
View File

@ -23,3 +23,4 @@ dnsmasq-2.52.tar.lzma
/dnsmasq-2.72.tar.xz
/dnsmasq-2.75.tar.xz
/dnsmasq-2.76.tar.xz
/dnsmasq-2.77rc2.tar.xz

View File

@ -1,104 +0,0 @@
diff --git a/src/dnsmasq.h b/src/dnsmasq.h
index 1896a64..aa5ec84 100644
--- a/src/dnsmasq.h
+++ b/src/dnsmasq.h
@@ -487,6 +487,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 e7722fd..d87d08f 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1204,6 +1204,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
@@ -1224,11 +1225,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. */
@@ -1250,11 +1255,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;
}
@@ -1429,12 +1436,16 @@ void check_servers(void)
{
struct irec *iface;
struct server *serv;
+ struct serverfd *sfd, *tmp, **up;
int port = 0, count;
/* interface may be new since startup */
if (!option_bool(OPT_NOWILD))
enumerate_interfaces(0);
+ for (sfd = daemon->sfds; sfd; sfd = sfd->next)
+ sfd->used = 0;
+
#ifdef HAVE_DNSSEC
/* Disable DNSSEC validation when using server=/domain/.... servers
unless there's a configured trust anchor. */
@@ -1505,6 +1516,9 @@ void check_servers(void)
serv->flags |= SERV_MARK;
continue;
}
+
+ if (serv->sfd)
+ serv->sfd->used = 1;
}
if (!(serv->flags & SERV_NO_REBIND) && !(serv->flags & SERV_LITERAL_ADDRESS))
@@ -1547,6 +1561,20 @@ void check_servers(void)
if (count - 1 > SERVERS_LOGGED)
my_syslog(LOG_INFO, _("using %d more nameservers"), count - SERVERS_LOGGED - 1);
+ /* Remove unused sfds */
+ for (sfd = daemon->sfds, up = &daemon->sfds; sfd; sfd = tmp)
+ {
+ tmp = sfd->next;
+ if (!sfd->used)
+ {
+ *up = sfd->next;
+ close(sfd->fd);
+ free(sfd);
+ }
+ else
+ up = &sfd->next;
+ }
+
cleanup_servers();
}

View File

@ -1,128 +0,0 @@
From 53ba1f8632b1fb09b5bf78e5bc355eebed2bc8b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
Date: Tue, 9 May 2017 18:56:16 +0200
Subject: [PATCH] Support for libidn2
---
Makefile | 6 ++++--
src/config.h | 10 +++++++++-
src/util.c | 19 ++++++++++++++-----
3 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/Makefile b/Makefile
index dd0513b..eacf5d4 100644
--- a/Makefile
+++ b/Makefile
@@ -55,6 +55,8 @@ dbus_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG)
dbus_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --libs dbus-1`
idn_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --cflags libidn`
idn_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --libs libidn`
+idn2_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LIBIDN2 $(PKG_CONFIG) --cflags libidn2`
+idn2_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LIBIDN2 $(PKG_CONFIG) --libs libidn2`
ct_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_CONNTRACK $(PKG_CONFIG) --cflags libnetfilter_conntrack`
ct_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_CONNTRACK $(PKG_CONFIG) --libs libnetfilter_conntrack`
lua_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --cflags lua5.1`
@@ -82,8 +84,8 @@ hdrs = dnsmasq.h config.h dhcp-protocol.h dhcp6-protocol.h \
all : $(BUILDDIR)
@cd $(BUILDDIR) && $(MAKE) \
top="$(top)" \
- build_cflags="$(version) $(dbus_cflags) $(idn_cflags) $(ct_cflags) $(lua_cflags) $(nettle_cflags)" \
- build_libs="$(dbus_libs) $(idn_libs) $(ct_libs) $(lua_libs) $(sunos_libs) $(nettle_libs) $(gmp_libs)" \
+ build_cflags="$(version) $(dbus_cflags) $(idn2_cflags) $(idn_cflags) $(ct_cflags) $(lua_cflags) $(nettle_cflags)" \
+ build_libs="$(dbus_libs) $(idn2_libs) $(idn_libs) $(ct_libs) $(lua_libs) $(sunos_libs) $(nettle_libs) $(gmp_libs)" \
-f $(top)/Makefile dnsmasq
mostly_clean :
diff --git a/src/config.h b/src/config.h
index 80a50e1..c9e24e5 100644
--- a/src/config.h
+++ b/src/config.h
@@ -92,11 +92,14 @@ HAVE_DBUS
servers via DBus.
HAVE_IDN
- define this if you want international domain name support.
+ define this if you want international domain name 2003 support.
NOTE: for backwards compatibility, IDN support is automatically
included when internationalisation support is built, using the
*-i18n makefile targets, even if HAVE_IDN is not explicitly set.
+HAVE_LIBIDN2
+ define this if you want international domain name 2008 support.
+
HAVE_CONNTRACK
define this to include code which propogates conntrack marks from
incoming DNS queries to the corresponding upstream queries. This adds
@@ -173,6 +176,7 @@ RESOLVFILE
/* #define HAVE_LUASCRIPT */
/* #define HAVE_DBUS */
/* #define HAVE_IDN */
+/* #define HAVE_LIBIDN2 */
/* #define HAVE_CONNTRACK */
/* #define HAVE_DNSSEC */
@@ -396,6 +400,10 @@ static char *compile_opts =
"no-"
#endif
"IDN "
+#if !defined(HAVE_LIBIDN2)
+"no-"
+#endif
+"IDN2 "
#ifndef HAVE_DHCP
"no-"
#endif
diff --git a/src/util.c b/src/util.c
index 93b24f5..0d3285f 100644
--- a/src/util.c
+++ b/src/util.c
@@ -24,7 +24,9 @@
#include <sys/times.h>
#endif
-#if defined(LOCALEDIR) || defined(HAVE_IDN)
+#ifdef HAVE_LIBIDN2
+#include <idn2.h>
+#elif defined(LOCALEDIR) || defined(HAVE_IDN)
#include <idna.h>
#endif
@@ -134,7 +136,7 @@ static int check_name(char *in)
else if (isascii((unsigned char)c) && iscntrl((unsigned char)c))
/* iscntrl only gives expected results for ascii */
return 0;
-#if !defined(LOCALEDIR) && !defined(HAVE_IDN)
+#if !defined(LOCALEDIR) && !defined(HAVE_IDN) && !defined(HAVE_LIBIDN2)
else if (!isascii((unsigned char)c))
return 0;
#endif
@@ -184,7 +186,7 @@ int legal_hostname(char *name)
char *canonicalise(char *in, int *nomem)
{
char *ret = NULL;
-#if defined(LOCALEDIR) || defined(HAVE_IDN)
+#if defined(LOCALEDIR) || defined(HAVE_IDN) || defined(HAVE_LIBIDN2)
int rc;
#endif
@@ -194,8 +196,15 @@ char *canonicalise(char *in, int *nomem)
if (!check_name(in))
return NULL;
-#if defined(LOCALEDIR) || defined(HAVE_IDN)
- if ((rc = idna_to_ascii_lz(in, &ret, 0)) != IDNA_SUCCESS)
+#if defined(LOCALEDIR) || defined(HAVE_IDN) || defined(HAVE_LIBIDN2)
+#ifdef HAVE_LIBIDN2
+ rc = idn2_to_ascii_lz(in, &ret, IDN2_NONTRANSITIONAL);
+ if (rc == IDN2_DISALLOWED)
+ rc = idn2_to_ascii_lz(in, &ret, IDN2_TRANSITIONAL);
+#else
+ rc = idna_to_ascii_lz(in, &ret, 0);
+#endif
+ if (rc != IDNA_SUCCESS)
{
if (ret)
free(ret);
--
2.9.3

View File

@ -1,19 +1,19 @@
%define testrelease 0
%define releasecandidate 0
%define releasecandidate 2
%if 0%{testrelease}
%define extrapath test-releases/
%define extraversion test16
%define extraversion test%{testrelease}
%endif
%if 0%{releasecandidate}
%define extrapath release-candidates/
%define extraversion rc1
%define extraversion rc%{releasecandidate}
%endif
%define _hardened_build 1
Name: dnsmasq
Version: 2.76
Release: 4%{?dist}
Version: 2.77
Release: 1%{?extraversion:.%{extraversion}}%{?dist}
Summary: A lightweight DHCP/caching DNS server
Group: System Environment/Daemons
@ -22,11 +22,6 @@ URL: http://www.thekelleys.org.uk/dnsmasq/
Source0: http://www.thekelleys.org.uk/dnsmasq/%{?extrapath}%{name}-%{version}%{?extraversion}.tar.xz
Source1: %{name}.service
# dns not updated after sleep and resume laptop
# https://bugzilla.redhat.com/show_bug.cgi?id=1367772
Patch0: dnsmasq-2.76-dns-sleep-resume.patch
Patch1: dnsmasq-2.76-libidn2.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: dbus-devel
@ -60,8 +55,6 @@ query/remove a DHCP server's leases.
%prep
%setup -q -n %{name}-%{version}%{?extraversion}
%patch0 -p1
%patch1 -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
@ -71,14 +64,8 @@ done
# fix the path to the trust anchor
sed -i 's|%%%%PREFIX%%%%|%{_prefix}|' dnsmasq.conf.example
#enable dbus
sed -i 's|/\* #define HAVE_DBUS \*/|#define HAVE_DBUS|g' src/config.h
#enable IDN support
sed -i 's|/\* #define HAVE_LIBIDN2 \*/|#define HAVE_LIBIDN2|g' src/config.h
#enable DNSSEC support
sed -i 's|/\* #define HAVE_DNSSEC \*/|#define HAVE_DNSSEC|g' src/config.h
# optional parts
sed -i 's|^COPTS[[:space:]]*=|\0 -DHAVE_DBUS -DHAVE_LIBIDN2 -DHAVE_DNSSEC|' Makefile
#enable /etc/dnsmasq.d fix bz 526703, ignore RPM backup files
cat << EOF >> dnsmasq.conf.example
@ -153,6 +140,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/dhcp_*
%changelog
* Thu May 11 2017 Petr Menšík <pemensik@redhat.com> - 2.77-1
- Update to 2.77rc2
* Thu May 11 2017 Petr Menšík <pemensik@redhat.com>
- Include dhcp_release6 tool and license in utils
- Support for IDN 2008 (#1449150)

View File

@ -1 +1 @@
00f5ee66b4e4b7f14538bf62ae3c9461 dnsmasq-2.76.tar.xz
SHA512 (dnsmasq-2.77rc2.tar.xz) = d9e5c723dd1de33d6d71194855c1987e9f0541f84663f1dc70bfafe2c6010df4acfc1db4969de70b1f0debbb5471bd97ad943e2f9a9ef507725939badab93a91