[arch-commits] Commit in dnsmasq/repos (12 files)
Christian Hesse
eworm at archlinux.org
Sun Oct 9 18:48:23 UTC 2016
Date: Sunday, October 9, 2016 @ 18:48:22
Author: eworm
Revision: 278126
archrelease: copy trunk to testing-i686, testing-x86_64
Added:
dnsmasq/repos/testing-i686/
dnsmasq/repos/testing-i686/0001-Handle-binding-upstream-servers-to-an-interface.patch
(from rev 278125, dnsmasq/trunk/0001-Handle-binding-upstream-servers-to-an-interface.patch)
dnsmasq/repos/testing-i686/PKGBUILD
(from rev 278125, dnsmasq/trunk/PKGBUILD)
dnsmasq/repos/testing-i686/dnsmasq-sysusers.conf
(from rev 278125, dnsmasq/trunk/dnsmasq-sysusers.conf)
dnsmasq/repos/testing-i686/dnsmasq.install
(from rev 278125, dnsmasq/trunk/dnsmasq.install)
dnsmasq/repos/testing-i686/dnsmasq.service
(from rev 278125, dnsmasq/trunk/dnsmasq.service)
dnsmasq/repos/testing-x86_64/
dnsmasq/repos/testing-x86_64/0001-Handle-binding-upstream-servers-to-an-interface.patch
(from rev 278125, dnsmasq/trunk/0001-Handle-binding-upstream-servers-to-an-interface.patch)
dnsmasq/repos/testing-x86_64/PKGBUILD
(from rev 278125, dnsmasq/trunk/PKGBUILD)
dnsmasq/repos/testing-x86_64/dnsmasq-sysusers.conf
(from rev 278125, dnsmasq/trunk/dnsmasq-sysusers.conf)
dnsmasq/repos/testing-x86_64/dnsmasq.install
(from rev 278125, dnsmasq/trunk/dnsmasq.install)
dnsmasq/repos/testing-x86_64/dnsmasq.service
(from rev 278125, dnsmasq/trunk/dnsmasq.service)
---------------------------------------------------------------------------+
testing-i686/0001-Handle-binding-upstream-servers-to-an-interface.patch | 123 ++++++++++
testing-i686/PKGBUILD | 65 +++++
testing-i686/dnsmasq-sysusers.conf | 1
testing-i686/dnsmasq.install | 13 +
testing-i686/dnsmasq.service | 14 +
testing-x86_64/0001-Handle-binding-upstream-servers-to-an-interface.patch | 123 ++++++++++
testing-x86_64/PKGBUILD | 65 +++++
testing-x86_64/dnsmasq-sysusers.conf | 1
testing-x86_64/dnsmasq.install | 13 +
testing-x86_64/dnsmasq.service | 14 +
10 files changed, 432 insertions(+)
Copied: dnsmasq/repos/testing-i686/0001-Handle-binding-upstream-servers-to-an-interface.patch (from rev 278125, dnsmasq/trunk/0001-Handle-binding-upstream-servers-to-an-interface.patch)
===================================================================
--- testing-i686/0001-Handle-binding-upstream-servers-to-an-interface.patch (rev 0)
+++ testing-i686/0001-Handle-binding-upstream-servers-to-an-interface.patch 2016-10-09 18:48:22 UTC (rev 278126)
@@ -0,0 +1,123 @@
+From f7fcfebdbc3c57570d2f6de35f38c72ce6c80143 Mon Sep 17 00:00:00 2001
+From: Christian Hesse <mail at eworm.de>
+Date: Wed, 31 Aug 2016 18:42:22 +0200
+Subject: [PATCH 1/1] Handle binding upstream servers to an interface
+
+upstream commits:
+
+* 2675f2061525bc954be14988d64384b74aa7bf8b
+* 16800ea072dd0cdf14d951c4bb8d2808b3dfe53d
+
+Signed-off-by: Christian Hesse <mail at eworm.de>
+---
+ src/dnsmasq.h | 1 +
+ src/network.c | 32 ++++++++++++++++++++++++++++++--
+ 2 files changed, 31 insertions(+), 2 deletions(-)
+
+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();
+ }
+
+--
+2.9.3
+
Copied: dnsmasq/repos/testing-i686/PKGBUILD (from rev 278125, dnsmasq/trunk/PKGBUILD)
===================================================================
--- testing-i686/PKGBUILD (rev 0)
+++ testing-i686/PKGBUILD 2016-10-09 18:48:22 UTC (rev 278126)
@@ -0,0 +1,65 @@
+# $Id$
+# Maintainer: Dave Reisner <dreisner at archlinux.org>
+# Contributor: Paul Mattal <paul at archlinux.org>
+# Contributor: Tom Newsom <Jeepster at gmx.co.uk>
+
+pkgname=dnsmasq
+pkgver=2.76
+pkgrel=3
+pkgdesc="Lightweight, easy to configure DNS forwarder and DHCP server"
+url="http://www.thekelleys.org.uk/dnsmasq/doc.html"
+arch=('i686' 'x86_64')
+license=('GPL')
+depends=('glibc' 'gmp' 'libidn' 'libdbus' 'libnetfilter_conntrack' 'nettle')
+install=$pkgname.install
+backup=('etc/dnsmasq.conf')
+source=("http://www.thekelleys.org.uk/$pkgname/$pkgname-$pkgver.tar.xz"{,.asc}
+ '0001-Handle-binding-upstream-servers-to-an-interface.patch'
+ 'dnsmasq-sysusers.conf'
+ 'dnsmasq.service')
+md5sums=('00f5ee66b4e4b7f14538bf62ae3c9461'
+ 'SKIP'
+ '2d64212b5e69696fc61948f9b86d6999'
+ '8d07ccf412c107d068ec5cc6964788aa'
+ 'b87f68013c3e8b4bb37117de968d4603')
+validpgpkeys=('269322E7D9255916E0394DD628FC869A289B82B7') # Simon Kelley
+
+_build_copts="-DHAVE_DNSSEC -DHAVE_DBUS -DHAVE_IDN -DHAVE_CONNTRACK"
+
+prepare() {
+ cd "$pkgname-$pkgver"
+
+ # Handle binding upstream servers to an interface
+ patch -Np1 < "$srcdir/0001-Handle-binding-upstream-servers-to-an-interface.patch"
+}
+
+build() {
+ cd "$pkgname-$pkgver"
+
+ make \
+ CFLAGS="$CPPFLAGS $CFLAGS" \
+ LDFLAGS="$LDFLAGS" \
+ COPTS="$_build_copts" \
+ all-i18n
+}
+
+package() {
+ cd "$pkgname-$pkgver"
+
+ # need to pass COPTS here to avoid rebuilding the binary.
+ make \
+ COPTS="$_build_copts" \
+ BINDIR=/usr/bin PREFIX=/usr DESTDIR="$pkgdir" \
+ install install-i18n
+
+ install -Dm644 "dbus/dnsmasq.conf" "$pkgdir"/usr/share/dbus-1/system.d/dnsmasq.conf
+ install -Dm644 "dnsmasq.conf.example" "$pkgdir"/etc/dnsmasq.conf
+ install -Dm644 "$srcdir/dnsmasq.service" "$pkgdir"/usr/lib/systemd/system/dnsmasq.service
+ install -Dm644 "$srcdir/dnsmasq-sysusers.conf" "$pkgdir"/usr/lib/sysusers.d/dnsmasq.conf
+
+ # DNSSEC setup
+ sed -i 's,%%PREFIX%%,/usr,' "$pkgdir"/etc/dnsmasq.conf
+ install -Dm644 "trust-anchors.conf" "$pkgdir"/usr/share/dnsmasq/trust-anchors.conf
+}
+
+# vim: ts=2 sw=2 et ft=sh
Copied: dnsmasq/repos/testing-i686/dnsmasq-sysusers.conf (from rev 278125, dnsmasq/trunk/dnsmasq-sysusers.conf)
===================================================================
--- testing-i686/dnsmasq-sysusers.conf (rev 0)
+++ testing-i686/dnsmasq-sysusers.conf 2016-10-09 18:48:22 UTC (rev 278126)
@@ -0,0 +1 @@
+u dnsmasq - "dnsmasq daemon" /
Copied: dnsmasq/repos/testing-i686/dnsmasq.install (from rev 278125, dnsmasq/trunk/dnsmasq.install)
===================================================================
--- testing-i686/dnsmasq.install (rev 0)
+++ testing-i686/dnsmasq.install 2016-10-09 18:48:22 UTC (rev 278126)
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+post_install() {
+ if hash systemd-sysusers &> /dev/null; then
+ systemd-sysusers dnsmasq.conf
+ fi
+}
+
+post_upgrade(){
+ if hash systemd-sysusers &> /dev/null; then
+ systemd-sysusers dnsmasq.conf
+ fi
+}
Copied: dnsmasq/repos/testing-i686/dnsmasq.service (from rev 278125, dnsmasq/trunk/dnsmasq.service)
===================================================================
--- testing-i686/dnsmasq.service (rev 0)
+++ testing-i686/dnsmasq.service 2016-10-09 18:48:22 UTC (rev 278126)
@@ -0,0 +1,14 @@
+[Unit]
+Description=A lightweight DHCP and caching DNS server
+After=network.target
+Documentation=man:dnsmasq(8)
+
+[Service]
+Type=dbus
+BusName=uk.org.thekelleys.dnsmasq
+ExecStartPre=/usr/bin/dnsmasq --test
+ExecStart=/usr/bin/dnsmasq -k --enable-dbus --user=dnsmasq --pid-file
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target
Copied: dnsmasq/repos/testing-x86_64/0001-Handle-binding-upstream-servers-to-an-interface.patch (from rev 278125, dnsmasq/trunk/0001-Handle-binding-upstream-servers-to-an-interface.patch)
===================================================================
--- testing-x86_64/0001-Handle-binding-upstream-servers-to-an-interface.patch (rev 0)
+++ testing-x86_64/0001-Handle-binding-upstream-servers-to-an-interface.patch 2016-10-09 18:48:22 UTC (rev 278126)
@@ -0,0 +1,123 @@
+From f7fcfebdbc3c57570d2f6de35f38c72ce6c80143 Mon Sep 17 00:00:00 2001
+From: Christian Hesse <mail at eworm.de>
+Date: Wed, 31 Aug 2016 18:42:22 +0200
+Subject: [PATCH 1/1] Handle binding upstream servers to an interface
+
+upstream commits:
+
+* 2675f2061525bc954be14988d64384b74aa7bf8b
+* 16800ea072dd0cdf14d951c4bb8d2808b3dfe53d
+
+Signed-off-by: Christian Hesse <mail at eworm.de>
+---
+ src/dnsmasq.h | 1 +
+ src/network.c | 32 ++++++++++++++++++++++++++++++--
+ 2 files changed, 31 insertions(+), 2 deletions(-)
+
+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();
+ }
+
+--
+2.9.3
+
Copied: dnsmasq/repos/testing-x86_64/PKGBUILD (from rev 278125, dnsmasq/trunk/PKGBUILD)
===================================================================
--- testing-x86_64/PKGBUILD (rev 0)
+++ testing-x86_64/PKGBUILD 2016-10-09 18:48:22 UTC (rev 278126)
@@ -0,0 +1,65 @@
+# $Id$
+# Maintainer: Dave Reisner <dreisner at archlinux.org>
+# Contributor: Paul Mattal <paul at archlinux.org>
+# Contributor: Tom Newsom <Jeepster at gmx.co.uk>
+
+pkgname=dnsmasq
+pkgver=2.76
+pkgrel=3
+pkgdesc="Lightweight, easy to configure DNS forwarder and DHCP server"
+url="http://www.thekelleys.org.uk/dnsmasq/doc.html"
+arch=('i686' 'x86_64')
+license=('GPL')
+depends=('glibc' 'gmp' 'libidn' 'libdbus' 'libnetfilter_conntrack' 'nettle')
+install=$pkgname.install
+backup=('etc/dnsmasq.conf')
+source=("http://www.thekelleys.org.uk/$pkgname/$pkgname-$pkgver.tar.xz"{,.asc}
+ '0001-Handle-binding-upstream-servers-to-an-interface.patch'
+ 'dnsmasq-sysusers.conf'
+ 'dnsmasq.service')
+md5sums=('00f5ee66b4e4b7f14538bf62ae3c9461'
+ 'SKIP'
+ '2d64212b5e69696fc61948f9b86d6999'
+ '8d07ccf412c107d068ec5cc6964788aa'
+ 'b87f68013c3e8b4bb37117de968d4603')
+validpgpkeys=('269322E7D9255916E0394DD628FC869A289B82B7') # Simon Kelley
+
+_build_copts="-DHAVE_DNSSEC -DHAVE_DBUS -DHAVE_IDN -DHAVE_CONNTRACK"
+
+prepare() {
+ cd "$pkgname-$pkgver"
+
+ # Handle binding upstream servers to an interface
+ patch -Np1 < "$srcdir/0001-Handle-binding-upstream-servers-to-an-interface.patch"
+}
+
+build() {
+ cd "$pkgname-$pkgver"
+
+ make \
+ CFLAGS="$CPPFLAGS $CFLAGS" \
+ LDFLAGS="$LDFLAGS" \
+ COPTS="$_build_copts" \
+ all-i18n
+}
+
+package() {
+ cd "$pkgname-$pkgver"
+
+ # need to pass COPTS here to avoid rebuilding the binary.
+ make \
+ COPTS="$_build_copts" \
+ BINDIR=/usr/bin PREFIX=/usr DESTDIR="$pkgdir" \
+ install install-i18n
+
+ install -Dm644 "dbus/dnsmasq.conf" "$pkgdir"/usr/share/dbus-1/system.d/dnsmasq.conf
+ install -Dm644 "dnsmasq.conf.example" "$pkgdir"/etc/dnsmasq.conf
+ install -Dm644 "$srcdir/dnsmasq.service" "$pkgdir"/usr/lib/systemd/system/dnsmasq.service
+ install -Dm644 "$srcdir/dnsmasq-sysusers.conf" "$pkgdir"/usr/lib/sysusers.d/dnsmasq.conf
+
+ # DNSSEC setup
+ sed -i 's,%%PREFIX%%,/usr,' "$pkgdir"/etc/dnsmasq.conf
+ install -Dm644 "trust-anchors.conf" "$pkgdir"/usr/share/dnsmasq/trust-anchors.conf
+}
+
+# vim: ts=2 sw=2 et ft=sh
Copied: dnsmasq/repos/testing-x86_64/dnsmasq-sysusers.conf (from rev 278125, dnsmasq/trunk/dnsmasq-sysusers.conf)
===================================================================
--- testing-x86_64/dnsmasq-sysusers.conf (rev 0)
+++ testing-x86_64/dnsmasq-sysusers.conf 2016-10-09 18:48:22 UTC (rev 278126)
@@ -0,0 +1 @@
+u dnsmasq - "dnsmasq daemon" /
Copied: dnsmasq/repos/testing-x86_64/dnsmasq.install (from rev 278125, dnsmasq/trunk/dnsmasq.install)
===================================================================
--- testing-x86_64/dnsmasq.install (rev 0)
+++ testing-x86_64/dnsmasq.install 2016-10-09 18:48:22 UTC (rev 278126)
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+post_install() {
+ if hash systemd-sysusers &> /dev/null; then
+ systemd-sysusers dnsmasq.conf
+ fi
+}
+
+post_upgrade(){
+ if hash systemd-sysusers &> /dev/null; then
+ systemd-sysusers dnsmasq.conf
+ fi
+}
Copied: dnsmasq/repos/testing-x86_64/dnsmasq.service (from rev 278125, dnsmasq/trunk/dnsmasq.service)
===================================================================
--- testing-x86_64/dnsmasq.service (rev 0)
+++ testing-x86_64/dnsmasq.service 2016-10-09 18:48:22 UTC (rev 278126)
@@ -0,0 +1,14 @@
+[Unit]
+Description=A lightweight DHCP and caching DNS server
+After=network.target
+Documentation=man:dnsmasq(8)
+
+[Service]
+Type=dbus
+BusName=uk.org.thekelleys.dnsmasq
+ExecStartPre=/usr/bin/dnsmasq --test
+ExecStart=/usr/bin/dnsmasq -k --enable-dbus --user=dnsmasq --pid-file
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target
More information about the arch-commits
mailing list