From 3d377f4375c6e4a66c6741bbd2549ad53ef671b3 Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Wed, 5 Sep 2018 15:39:39 +0200 Subject: [PATCH] dnsmasq: bump to dnsmasq v2.80test5 Refresh patches Remove 240-ubus patch as upstream accepted. Add uci option ubus which allows to enable/disable ubus support (enabled by default) Upstream commits since last bump: da8b651 Implement --address=/example.com/# c5db8f9 Tidy 7f876b64c22b2b18412e2e3d8506ee33e42db7c 974a6d0 Add --caa-record b758b67 Improve logging of RRs from --dns-rr. 9bafdc6 Tidy up file parsing code. 97f876b Properly deal with unaligned addresses in DHCPv6 packets. cbfbd17 Fix broken DNSSEC records in previous. b6f926f Don't return NXDOMAIN to empty non-terminals. c822620 Add --dhcp-name-match 397c050 Handle case of --auth-zone but no --auth-server. 1682d15 Add missing EDNS0 section. EDNS0 section missing in replies to EDNS0-containing queries where answer generated from --local=// dd33e98 Fix crash parsing a --synth-domain with no prefix. Problem introduced in 2.79/6b2b564ac34cb3c862f168e6b1457f9f0b9ca69c c16d966 Add copyright to src/metrics.h 1dfed16 Remove C99 only code. 6f835ed Format fixes - ubus.c 9d6fd17 dnsmasq.c fix OPT_UBUS option usage 8c1b6a5 New metrics and ubus files. 8dcdb33 Add --enable-ubus option. aba8bbb Add collection of metrics caf4d57 Add OpenWRT ubus patch Signed-off-by: Hans Dedecker --- package/network/services/dnsmasq/Makefile | 7 +- .../services/dnsmasq/files/dnsmasq.init | 1 + ...0-fix-poll-h-include-warning-on-musl.patch | 2 +- .../services/dnsmasq/patches/240-ubus.patch | 128 ------------------ 4 files changed, 6 insertions(+), 132 deletions(-) delete mode 100644 package/network/services/dnsmasq/patches/240-ubus.patch diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile index 4dd4e9d9c2..39889639a5 100644 --- a/package/network/services/dnsmasq/Makefile +++ b/package/network/services/dnsmasq/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dnsmasq -PKG_VERSION:=2.80test3 +PKG_VERSION:=2.80test5 PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/test-releases -PKG_HASH:=af9f6fd13e0d6c5a68059bcf8634c2784c0533017fd48fbaf59cd2955342d301 +PKG_HASH:=e17a4430ead6ec3f5710a55888ed261d9c19281954be5356e9f3a1171990f0d6 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING @@ -122,7 +122,8 @@ Package/dnsmasq-full/conffiles = $(Package/dnsmasq/conffiles) TARGET_CFLAGS += -ffunction-sections -fdata-sections TARGET_LDFLAGS += -Wl,--gc-sections -COPTS = $(if $(CONFIG_IPV6),,-DNO_IPV6) +COPTS = -DHAVE_UBUS \ + $(if $(CONFIG_IPV6),,-DNO_IPV6) ifeq ($(BUILD_VARIANT),nodhcpv6) COPTS += -DNO_DHCP6 diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init index 9c5d35b425..de15552424 100644 --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -813,6 +813,7 @@ dnsmasq_start() append_bool "$cfg" localise_queries "--localise-queries" append_bool "$cfg" readethers "--read-ethers" append_bool "$cfg" dbus "--enable-dbus" + append_bool "$cfg" ubus "--enable-ubus" 1 append_bool "$cfg" expandhosts "--expand-hosts" config_get tftp_root "$cfg" "tftp_root" [ -n "$tftp_root" ] && mkdir -p "$tftp_root" && append_bool "$cfg" enable_tftp "--enable-tftp" diff --git a/package/network/services/dnsmasq/patches/230-fix-poll-h-include-warning-on-musl.patch b/package/network/services/dnsmasq/patches/230-fix-poll-h-include-warning-on-musl.patch index 37b11abc1d..169dc0c6a9 100644 --- a/package/network/services/dnsmasq/patches/230-fix-poll-h-include-warning-on-musl.patch +++ b/package/network/services/dnsmasq/patches/230-fix-poll-h-include-warning-on-musl.patch @@ -7,7 +7,7 @@ Signed-off-by: Kevin Darbyshire-Bryant --- a/src/dnsmasq.h +++ b/src/dnsmasq.h -@@ -88,7 +88,7 @@ typedef unsigned long long u64; +@@ -89,7 +89,7 @@ typedef unsigned long long u64; #if defined(HAVE_SOLARIS_NETWORK) # include #endif diff --git a/package/network/services/dnsmasq/patches/240-ubus.patch b/package/network/services/dnsmasq/patches/240-ubus.patch deleted file mode 100644 index 2fa9f48d12..0000000000 --- a/package/network/services/dnsmasq/patches/240-ubus.patch +++ /dev/null @@ -1,128 +0,0 @@ ---- a/src/dnsmasq.c -+++ b/src/dnsmasq.c -@@ -19,6 +19,8 @@ - - #include "dnsmasq.h" - -+#include -+ - struct daemon *daemon; - - static volatile pid_t pid = 0; -@@ -32,6 +34,64 @@ static void fatal_event(struct event_des - static int read_event(int fd, struct event_desc *evp, char **msg); - static void poll_resolv(int force, int do_reload, time_t now); - -+static struct ubus_context *ubus; -+static struct blob_buf b; -+ -+static struct ubus_object_type ubus_object_type = { -+ .name = "dnsmasq", -+}; -+ -+static struct ubus_object ubus_object = { -+ .name = "dnsmasq", -+ .type = &ubus_object_type, -+}; -+ -+void ubus_event_bcast(const char *type, const char *mac, const char *ip, const char *name, const char *interface) -+{ -+ if (!ubus || !ubus_object.has_subscribers) -+ return; -+ -+ blob_buf_init(&b, 0); -+ if (mac) -+ blobmsg_add_string(&b, "mac", mac); -+ if (ip) -+ blobmsg_add_string(&b, "ip", ip); -+ if (name) -+ blobmsg_add_string(&b, "name", name); -+ if (interface) -+ blobmsg_add_string(&b, "interface", interface); -+ ubus_notify(ubus, &ubus_object, type, b.head, -1); -+} -+ -+static void set_ubus_listeners(void) -+{ -+ if (!ubus) -+ return; -+ -+ poll_listen(ubus->sock.fd, POLLIN); -+ poll_listen(ubus->sock.fd, POLLERR); -+ poll_listen(ubus->sock.fd, POLLHUP); -+} -+ -+static void check_ubus_listeners() -+{ -+ if (!ubus) { -+ ubus = ubus_connect(NULL); -+ if (ubus) -+ ubus_add_object(ubus, &ubus_object); -+ else -+ return; -+ } -+ -+ if (poll_check(ubus->sock.fd, POLLIN)) -+ ubus_handle_event(ubus); -+ -+ if (poll_check(ubus->sock.fd, POLLHUP)) { -+ ubus_free(ubus); -+ ubus = NULL; -+ } -+} -+ - int main (int argc, char **argv) - { - int bind_fallback = 0; -@@ -949,6 +1009,7 @@ int main (int argc, char **argv) - set_dbus_listeners(); - #endif - -+ set_ubus_listeners(); - #ifdef HAVE_DHCP - if (daemon->dhcp || daemon->relay4) - { -@@ -1079,6 +1140,8 @@ int main (int argc, char **argv) - check_dbus_listeners(); - #endif - -+ check_ubus_listeners(); -+ - check_dns_listeners(now); - - #ifdef HAVE_TFTP ---- a/Makefile -+++ b/Makefile -@@ -85,7 +85,7 @@ all : $(BUILDDIR) - @cd $(BUILDDIR) && $(MAKE) \ - top="$(top)" \ - 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)" \ -+ build_libs="$(dbus_libs) $(idn2_libs) $(idn_libs) $(ct_libs) $(lua_libs) $(sunos_libs) $(nettle_libs) $(gmp_libs) -lubox -lubus" \ - -f $(top)/Makefile dnsmasq - - mostly_clean : ---- a/src/dnsmasq.h -+++ b/src/dnsmasq.h -@@ -1445,6 +1445,8 @@ void emit_dbus_signal(int action, struct - # endif - #endif - -+void ubus_event_bcast(const char *type, const char *mac, const char *ip, const char *name, const char *interface); -+ - /* ipset.c */ - #ifdef HAVE_IPSET - void ipset_init(void); ---- a/src/rfc2131.c -+++ b/src/rfc2131.c -@@ -1636,6 +1636,10 @@ static void log_packet(char *type, void - daemon->namebuff, - string ? string : "", - err ? err : ""); -+ if (!strcmp(type, "DHCPACK")) -+ ubus_event_bcast("dhcp.ack", daemon->namebuff, addr ? inet_ntoa(a) : NULL, string ? string : NULL, interface); -+ else if (!strcmp(type, "DHCPRELEASE")) -+ ubus_event_bcast("dhcp.release", daemon->namebuff, addr ? inet_ntoa(a) : NULL, string ? string : NULL, interface); - } - - static void log_options(unsigned char *start, u32 xid) -- 2.25.1