[PATCH v4 1/2] dnsmasq: Update to version 2.86test3

Oldřich Jedlička oldium.pro at gmail.com
Sun Jun 27 00:35:51 PDT 2021


ne 27. 6. 2021 v 1:28 odesílatel Etan Kissling <etan.kissling at gmail.com> napsal:
>
> Need this version to add config option for connmark DNS filtering.
>
> Summary of upstream CHANGELOG:
> * Handle DHCPREBIND requests in the DHCPv6 server code.
> * Fix bug which caused dnsmasq to lose track of processes forked.
> * Major rewrite of the DNS server and domain handling code.
> * Revise resource handling for number of concurrent DNS queries.
> * Improve efficiency of DNSSEC.
> * Connection track mark based DNS query filtering.
>
> Signed-off-by: Etan Kissling <etan.kissling at gmail.com>
> ---
> v3: Refreshed patches.
> v4: Fix crash when running multiple dnsmasq instances.
>
>  package/network/services/dnsmasq/Makefile     |  6 ++--
>  ...00-remove-old-runtime-kernel-support.patch |  4 +--
>  ...not-crash-when-Ubus-connection-fails.patch | 28 +++++++++++++++++++
>  3 files changed, 33 insertions(+), 5 deletions(-)
>  create mode 100644 package/network/services/dnsmasq/patches/101-Do-not-crash-when-Ubus-connection-fails.patch
>
> diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile
> index 90a81b5f65..53080cb95b 100644
> --- a/package/network/services/dnsmasq/Makefile
> +++ b/package/network/services/dnsmasq/Makefile
> @@ -8,13 +8,13 @@
>  include $(TOPDIR)/rules.mk
>
>  PKG_NAME:=dnsmasq
> -PKG_UPSTREAM_VERSION:=2.85
> +PKG_UPSTREAM_VERSION:=2.86test3
>  PKG_VERSION:=$(subst test,~~test,$(subst rc,~rc,$(PKG_UPSTREAM_VERSION)))
>  PKG_RELEASE:=$(AUTORELEASE)
>
>  PKG_SOURCE:=$(PKG_NAME)-$(PKG_UPSTREAM_VERSION).tar.xz
> -PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq
> -PKG_HASH:=ad98d3803df687e5b938080f3d25c628fe41c878752d03fbc6199787fee312fa
> +PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/test-releases
> +PKG_HASH:=0d0b465db89390e9f518f1239dec88b458c84489e7fd38586af6a5781f85e7db
>
>  PKG_LICENSE:=GPL-2.0
>  PKG_LICENSE_FILES:=COPYING
> diff --git a/package/network/services/dnsmasq/patches/100-remove-old-runtime-kernel-support.patch b/package/network/services/dnsmasq/patches/100-remove-old-runtime-kernel-support.patch
> index b601bce1a9..5670808afc 100644
> --- a/package/network/services/dnsmasq/patches/100-remove-old-runtime-kernel-support.patch
> +++ b/package/network/services/dnsmasq/patches/100-remove-old-runtime-kernel-support.patch
> @@ -26,7 +26,7 @@ Signed-off-by: Kevin Darbyshire-Bryant <ldir at darbyshire-bryant.me.uk>
>
>  --- a/src/dnsmasq.h
>  +++ b/src/dnsmasq.h
> -@@ -1144,7 +1144,7 @@ extern struct daemon {
> +@@ -1185,7 +1185,7 @@ extern struct daemon {
>     int inotifyfd;
>   #endif
>   #if defined(HAVE_LINUX_NETWORK)
> @@ -35,7 +35,7 @@ Signed-off-by: Kevin Darbyshire-Bryant <ldir at darbyshire-bryant.me.uk>
>   #elif defined(HAVE_BSD_NETWORK)
>     int dhcp_raw_fd, dhcp_icmp_fd, routefd;
>   #endif
> -@@ -1326,9 +1326,6 @@ int read_write(int fd, unsigned char *pa
> +@@ -1368,9 +1368,6 @@ int read_write(int fd, unsigned char *pa
>   void close_fds(long max_fd, int spare1, int spare2, int spare3);
>   int wildcard_match(const char* wildcard, const char* match);
>   int wildcard_matchn(const char* wildcard, const char* match, int num);
> diff --git a/package/network/services/dnsmasq/patches/101-Do-not-crash-when-Ubus-connection-fails.patch b/package/network/services/dnsmasq/patches/101-Do-not-crash-when-Ubus-connection-fails.patch
> new file mode 100644
> index 0000000000..fad6e7d083
> --- /dev/null
> +++ b/package/network/services/dnsmasq/patches/101-Do-not-crash-when-Ubus-connection-fails.patch
> @@ -0,0 +1,28 @@
> +From c69760a3e317ab7e524bc794eac458292e683ca8 Mon Sep 17 00:00:00 2001
> +From: Etan Kissling <etan.kissling at gmail.com>
> +Date: Sun, 27 Jun 2021 01:04:32 +0200
> +Subject: [PATCH] Do not crash when Ubus connection fails.
> +
> +When using multiple dnsmasq instances Ubus only connects on one of them.
> +Since 3c93e8eb41952a9c91699386132d6fe83050e9be dnsmasq crashes instead.
> +This change avoids the crash, leading to a graceful retry + error log.
> +
> +Signed-off-by: Etan Kissling <etan.kissling at gmail.com>
> +---
> + src/dnsmasq.c | 4 +---
> + 1 file changed, 1 insertion(+), 3 deletions(-)
> +
> +--- a/src/dnsmasq.c
> ++++ b/src/dnsmasq.c
> +@@ -445,10 +445,8 @@ int main (int argc, char **argv)
> +   if (option_bool(OPT_UBUS))
> + #ifdef HAVE_UBUS
> +     {
> +-      char *err;
> +       daemon->ubus = NULL;
> +-      if ((err = ubus_init()))
> +-      die(_("UBus error: %s"), err, EC_MISC);
> ++      (void) ubus_init(); /* Logging not set up yet. */

The crash is caused by a conflict in UBUS service name (the root name
of UBUS path). Previously only warning was logged when you tried to
use multiple Dnsmasq instances with UBUS enabled - only the first one
can register to the UBUS with the same name. Dying is a new behaviour
caused by a recent commit [1].

For the long run, I think the best would be to fix this in the init
script, I already added support to specify different UBUS names both
in Dnsmasq (commit from last year [2]) and in Openwrt (see Pull
Request [3]). The solution would be to pass a specific name for each
Dnsmasq instance (maybe matching the section name?), not only the
enable/disable flag.

[1] https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=commitdiff;h=3c93e8eb41952a9c91699386132d6fe83050e9be
[2] https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=commit;h=d162bee356586ccddccb50fd665c4a5556ce1147
[3] https://github.com/openwrt/openwrt/pull/4098

> +     }
> + #else
> +   die(_("UBus not available: set HAVE_UBUS in src/config.h"), NULL, EC_BADCONF);
> --
> 2.30.1 (Apple Git-130)
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list