[PATCH] dnsmasq: backport fixes
Hauke Mehrtens
hauke at hauke-m.de
Sun Jan 24 06:44:32 EST 2021
This should fix some error messages shown in the log like this one:
dnsmasq[5246]: failed to send packet: Network unreachable
Fixes: e87c0d934c54 ("dnsmasq: Update to version 2.83")
Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
package/network/services/dnsmasq/Makefile | 2 +-
...c_src-fixes-15b60ddf935a531269bb8c68.patch | 57 +++++++++++++++++++
...f0aec33e58ef5b8d4d107d821c215a52827c.patch | 19 +++++++
...2b171de0d678d98583e2190789e544440e02.patch | 20 +++++++
...00-remove-old-runtime-kernel-support.patch | 4 +-
5 files changed, 99 insertions(+), 3 deletions(-)
create mode 100644 package/network/services/dnsmasq/patches/0120-Move-fd-into-frec_src-fixes-15b60ddf935a531269bb8c68.patch
create mode 100644 package/network/services/dnsmasq/patches/0121-Fix-to-75e2f0aec33e58ef5b8d4d107d821c215a52827c.patch
create mode 100644 package/network/services/dnsmasq/patches/0123-Fix-for-12af2b171de0d678d98583e2190789e544440e02.patch
diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile
index 7b5af1dd273c..b09f4b7c37a7 100644
--- a/package/network/services/dnsmasq/Makefile
+++ b/package/network/services/dnsmasq/Makefile
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=dnsmasq
PKG_UPSTREAM_VERSION:=2.83
PKG_VERSION:=$(subst test,~~test,$(subst rc,~rc,$(PKG_UPSTREAM_VERSION)))
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_UPSTREAM_VERSION).tar.xz
PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq
diff --git a/package/network/services/dnsmasq/patches/0120-Move-fd-into-frec_src-fixes-15b60ddf935a531269bb8c68.patch b/package/network/services/dnsmasq/patches/0120-Move-fd-into-frec_src-fixes-15b60ddf935a531269bb8c68.patch
new file mode 100644
index 000000000000..b3c48db78571
--- /dev/null
+++ b/package/network/services/dnsmasq/patches/0120-Move-fd-into-frec_src-fixes-15b60ddf935a531269bb8c68.patch
@@ -0,0 +1,57 @@
+From 04490bf622ac84891aad6f2dd2edf83725decdee Mon Sep 17 00:00:00 2001
+From: Simon Kelley <simon at thekelleys.org.uk>
+Date: Fri, 22 Jan 2021 16:49:12 +0000
+Subject: Move fd into frec_src, fixes 15b60ddf935a531269bb8c68198de012a4967156
+
+If identical queries from IPv4 and IPv6 sources are combined by the
+new code added in 15b60ddf935a531269bb8c68198de012a4967156 then replies
+can end up being sent via the wrong family of socket. The ->fd
+should be per query, not per-question.
+
+In bind-interfaces mode, this could also result in replies being sent
+via the wrong socket even when IPv4/IPV6 issues are not in play.
+---
+ src/dnsmasq.h | 3 ++-
+ src/forward.c | 4 ++--
+ 2 files changed, 4 insertions(+), 3 deletions(-)
+
+--- a/src/dnsmasq.h
++++ b/src/dnsmasq.h
+@@ -664,6 +664,7 @@ struct frec {
+ union mysockaddr source;
+ union all_addr dest;
+ unsigned int iface, log_id;
++ int fd;
+ unsigned short orig_id;
+ struct frec_src *next;
+ } frec_src;
+@@ -671,7 +672,7 @@ struct frec {
+ struct randfd *rfd4;
+ struct randfd *rfd6;
+ unsigned short new_id;
+- int fd, forwardall, flags;
++ int forwardall, flags;
+ time_t time;
+ unsigned char *hash[HASH_SIZE];
+ #ifdef HAVE_DNSSEC
+--- a/src/forward.c
++++ b/src/forward.c
+@@ -402,8 +402,8 @@ static int forward_query(int udpfd, unio
+ forward->frec_src.dest = *dst_addr;
+ forward->frec_src.iface = dst_iface;
+ forward->frec_src.next = NULL;
++ forward->frec_src.fd = udpfd;
+ forward->new_id = get_id();
+- forward->fd = udpfd;
+ memcpy(forward->hash, hash, HASH_SIZE);
+ forward->forwardall = 0;
+ forward->flags = fwd_flags;
+@@ -1300,7 +1300,7 @@ void reply_query(int fd, int family, tim
+ dump_packet(DUMP_REPLY, daemon->packet, (size_t)nn, NULL, &src->source);
+ #endif
+
+- send_from(forward->fd, option_bool(OPT_NOWILD) || option_bool (OPT_CLEVERBIND), daemon->packet, nn,
++ send_from(src->fd, option_bool(OPT_NOWILD) || option_bool (OPT_CLEVERBIND), daemon->packet, nn,
+ &src->source, &src->dest, src->iface);
+
+ if (option_bool(OPT_EXTRALOG) && src != &forward->frec_src)
diff --git a/package/network/services/dnsmasq/patches/0121-Fix-to-75e2f0aec33e58ef5b8d4d107d821c215a52827c.patch b/package/network/services/dnsmasq/patches/0121-Fix-to-75e2f0aec33e58ef5b8d4d107d821c215a52827c.patch
new file mode 100644
index 000000000000..259e00de6e79
--- /dev/null
+++ b/package/network/services/dnsmasq/patches/0121-Fix-to-75e2f0aec33e58ef5b8d4d107d821c215a52827c.patch
@@ -0,0 +1,19 @@
+From 12af2b171de0d678d98583e2190789e544440e02 Mon Sep 17 00:00:00 2001
+From: Simon Kelley <simon at thekelleys.org.uk>
+Date: Fri, 22 Jan 2021 18:24:03 +0000
+Subject: Fix to 75e2f0aec33e58ef5b8d4d107d821c215a52827c
+
+---
+ src/forward.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/src/forward.c
++++ b/src/forward.c
+@@ -378,6 +378,7 @@ static int forward_query(int udpfd, unio
+ new->dest = *dst_addr;
+ new->log_id = daemon->log_id;
+ new->iface = dst_iface;
++ forward->frec_src.fd = udpfd;
+ }
+
+ return 1;
diff --git a/package/network/services/dnsmasq/patches/0123-Fix-for-12af2b171de0d678d98583e2190789e544440e02.patch b/package/network/services/dnsmasq/patches/0123-Fix-for-12af2b171de0d678d98583e2190789e544440e02.patch
new file mode 100644
index 000000000000..383f97ca36ef
--- /dev/null
+++ b/package/network/services/dnsmasq/patches/0123-Fix-for-12af2b171de0d678d98583e2190789e544440e02.patch
@@ -0,0 +1,20 @@
+From 3f535da79e7a42104543ef5c7b5fa2bed819a78b Mon Sep 17 00:00:00 2001
+From: Simon Kelley <simon at thekelleys.org.uk>
+Date: Fri, 22 Jan 2021 22:26:25 +0000
+Subject: Fix for 12af2b171de0d678d98583e2190789e544440e02
+
+---
+ src/forward.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/src/forward.c
++++ b/src/forward.c
+@@ -378,7 +378,7 @@ static int forward_query(int udpfd, unio
+ new->dest = *dst_addr;
+ new->log_id = daemon->log_id;
+ new->iface = dst_iface;
+- forward->frec_src.fd = udpfd;
++ new->fd = udpfd;
+ }
+
+ return 1;
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 bd11806ae0a3..fae4a49475d7 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
@@ -27,7 +27,7 @@ Signed-off-by: Kevin Darbyshire-Bryant <ldir at darbyshire-bryant.me.uk>
--- a/src/dnsmasq.h
+++ b/src/dnsmasq.h
-@@ -1125,7 +1125,7 @@ extern struct daemon {
+@@ -1126,7 +1126,7 @@ extern struct daemon {
int inotifyfd;
#endif
#if defined(HAVE_LINUX_NETWORK)
@@ -36,7 +36,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
-@@ -1306,9 +1306,6 @@ int read_write(int fd, unsigned char *pa
+@@ -1307,9 +1307,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);
--
2.20.1
More information about the openwrt-devel
mailing list