惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Vulnerabilities – Threatpost
L
LINUX DO - 热门话题
F
Fox-IT International blog
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
T
Tor Project blog
Malwarebytes
Malwarebytes
Latest news
Latest news
D
Darknet – Hacking Tools, Hacker News & Cyber Security
SecWiki News
SecWiki News
N
News and Events Feed by Topic
T
True Tiger Recordings
www.infosecurity-magazine.com
www.infosecurity-magazine.com
美团技术团队
P
Palo Alto Networks Blog
V
V2EX - 技术
AWS News Blog
AWS News Blog
A
About on SuperTechFans
Microsoft Azure Blog
Microsoft Azure Blog
量子位
博客园 - 【当耐特】
P
Proofpoint News Feed
N
News and Events Feed by Topic
博客园 - 司徒正美
U
Unit 42
G
Google Developers Blog
阮一峰的网络日志
阮一峰的网络日志
Schneier on Security
Schneier on Security
G
GRAHAM CLULEY
O
OpenAI News
T
The Blog of Author Tim Ferriss
F
Future of Privacy Forum
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
Blog — PlanetScale
Blog — PlanetScale
人人都是产品经理
人人都是产品经理
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
N
News | PayPal Newsroom
V
Visual Studio Blog
V
V2EX
Simon Willison's Weblog
Simon Willison's Weblog
Microsoft Security Blog
Microsoft Security Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Threat Research - Cisco Blogs
Spread Privacy
Spread Privacy
N
Netflix TechBlog - Medium
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
Docker
小众软件
小众软件
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
Intezer

dnsmasq-discuss

Re: [Dnsmasq-discuss] patch: block-file/allow-file - for review/feedback Re: [Dnsmasq-discuss] patch: block-file/allow-file - for review/feedback Re: [Dnsmasq-discuss] patch: block-file/allow-file - for review/feedback Re: [Dnsmasq-discuss] patch: block-file/allow-file - for review/feedback [Dnsmasq-discuss] patch: block-file/allow-file - for review/feedback Re: [Dnsmasq-discuss] server= with interface parameter changes behavior over time [Dnsmasq-discuss] NFTsets and hosts-files [Dnsmasq-discuss] [PATCH] Allow expired RRSIGs when stale caching is enabled [Dnsmasq-discuss] [PATCH] Fix local host records being overridden by upstream NXDOMAIN [Dnsmasq-discuss] [PATCH] Fix arguments order for chaos subdomain check Re: [Dnsmasq-discuss] Malformed RRSIG Can Crash dnsmasq [Dnsmasq-discuss] Malformed NSEC/NSEC3 Can Hang dnsmasq [Dnsmasq-discuss] Malformed RRSIG Can Crash dnsmasq [Dnsmasq-discuss] Security - IMPORTANT Re: [Dnsmasq-discuss] Issue with circuit-id matching on dhcp requests Re: [Dnsmasq-discuss] Issue with circuit-id matching on dhcp requests Re: [Dnsmasq-discuss] Issue with circuit-id matching on dhcp requests [Dnsmasq-discuss] Issue with circuit-id matching on dhcp requests Re: [Dnsmasq-discuss] [PATCH] bpf.c: fix memory leak in arp_enumerate() on BSD Re: [Dnsmasq-discuss] [PATCH] bpf.c: fix memory leak in arp_enumerate() on BSD Re: [Dnsmasq-discuss] dnssec problem here and now Re: [Dnsmasq-discuss] dnssec problem here and now [Dnsmasq-discuss] dnssec problem here and now Re: [Dnsmasq-discuss] server= with interface parameter changes behavior over time Re: [Dnsmasq-discuss] [PATCH] bpf.c: fix memory leak in arp_enumerate() on BSD Re: [Dnsmasq-discuss] [PATCH] bpf.c: fix memory leak in arp_enumerate() on BSD Re: [Dnsmasq-discuss] [PATCH] Preserve existing log file permissions when adding group-write bit. [Dnsmasq-discuss] server= with interface parameter changes behavior over time [Dnsmasq-discuss] [PATCH] bpf.c: fix memory leak in arp_enumerate() on BSD Re: [Dnsmasq-discuss] [PATCH] Preserve existing log file permissions when adding group-write bit. Re: [Dnsmasq-discuss] [BUG] SIGSEGV when parsing invalid "--interface-name" or "--dynamic-host" options Re: [Dnsmasq-discuss] Suggestion to increase default for max-tcp-connections [Dnsmasq-discuss] server priority clarification after e86d53c [Dnsmasq-discuss] [BUG] SIGSEGV when parsing invalid "--interface-name" or "--dynamic-host" options [Dnsmasq-discuss] Suggestion to increase default for max-tcp-connections Re: [Dnsmasq-discuss] [PATCH] Preserve existing log file permissions when adding group-write bit. [Dnsmasq-discuss] [Bug] Heap buffer overflow in cache_recv_insert() due to pipe de-synchronization Re: [Dnsmasq-discuss] Regression/Feature Request for 2.92 Re: [Dnsmasq-discuss] [PATCH] DHCPv6 network range is not checked well with dhcp-sequential-ip [Dnsmasq-discuss] [Bug] Buffer underflow in hostname_issubdomain() [Dnsmasq-discuss] BUG:Heap buffer overflow in src/forward.c due to incorrect pointer arithmetic (CWE-122) Re: [Dnsmasq-discuss] Regression/Feature Request for 2.92 Re: [Dnsmasq-discuss] Regression/Feature Request for 2.92 Re: [Dnsmasq-discuss] Regression/Feature Request for 2.92 Re: [Dnsmasq-discuss] Potential privacy issue: filter-rr inefficiency Re: [Dnsmasq-discuss] TCP optimization regressions Re: [Dnsmasq-discuss] Bug: Null pointer dereference in domain-match.c at line 82 (dnsmasq 2.92test21-1-gee09f06) [Dnsmasq-discuss] [PATCH] ubus: add lease management methods [Dnsmasq-discuss] Regression/Feature Request for 2.92 [Dnsmasq-discuss] cotillon por mayor [Dnsmasq-discuss] Por Qué el Alquiler de Plataformas Elevadoras es la Clave del Éxito para Tu Empresa Re: [Dnsmasq-discuss] [PATCH] dnsmasq: failed to create inotify for /etc/resolv.conf: No space left on device [Dnsmasq-discuss] Bug: Null pointer dereference in domain-match.c at line 82 (dnsmasq 2.92test21-1-gee09f06) [Dnsmasq-discuss] TCP optimization regressions Re: [Dnsmasq-discuss] [PATCH] dnsmasq: failed to create inotify for /etc/resolv.conf: No space left on device Re: [Dnsmasq-discuss] dnsmasq 2.92 build-error against Nettle 4.0 Re: [Dnsmasq-discuss] dnsmasq 2.92 build-error against Nettle 4.0 Re: [Dnsmasq-discuss] dnsmasq 2.92 build-error against Nettle 4.0 [Dnsmasq-discuss] dnsmasq 2.92 build-error against Nettle 4.0 [Dnsmasq-discuss] Potential privacy issue: filter-rr inefficiency Re: [Dnsmasq-discuss] Bug with NS records when using dnsmasq as authoritative nameserver without specific auth-interface Re: [Dnsmasq-discuss] Bug with NS records when using dnsmasq as authoritative nameserver without specific auth-interface Re: [Dnsmasq-discuss] segfault with an empty OPTION_SNAME [Dnsmasq-discuss] Bug with NS records when using dnsmasq as authoritative nameserver without specific auth-interface Re: [Dnsmasq-discuss] segfault with an empty OPTION_SNAME [Dnsmasq-discuss] segfault with an empty OPTION_SNAME Re: [Dnsmasq-discuss] Shut down caused by device request address. Re: [Dnsmasq-discuss] Shut down caused by device request address. Re: [Dnsmasq-discuss] Shut down caused by device request address. Re: [Dnsmasq-discuss] Shut down caused by device request address. Re: [Dnsmasq-discuss] Shut down caused by device request address. [Dnsmasq-discuss] Shut down caused by device request address. Re: [Dnsmasq-discuss] [PATCH] dnsmasq: failed to create inotify for /etc/resolv.conf: No space left on device Re: [Dnsmasq-discuss] [PATCH] dnsmasq: failed to create inotify for /etc/resolv.conf: No space left on device [Dnsmasq-discuss] [PATCH] dnsmasq: failed to create inotify for /etc/resolv.conf: No space left on device Re: [Dnsmasq-discuss] dnsmasq with high availability and dynamic range [Dnsmasq-discuss] dnsmasq with high availability and dynamic range Re: [Dnsmasq-discuss] PATCH] PXE boot server (PXEBS) responses broken in 2.92 — missing else in dhcp.c Re: [Dnsmasq-discuss] Potential memory leak [Dnsmasq-discuss] PATCH] PXE boot server (PXEBS) responses broken in 2.92 — missing else in dhcp.c Re: [Dnsmasq-discuss] Potential memory leak Re: [Dnsmasq-discuss] Potential memory leak Re: [Dnsmasq-discuss] Potential memory leak Re: [Dnsmasq-discuss] Potential memory leak Re: [Dnsmasq-discuss] Potential memory leak Re: [Dnsmasq-discuss] Potential memory leak Re: [Dnsmasq-discuss] Potential memory leak Re: [Dnsmasq-discuss] Potential memory leak Re: [Dnsmasq-discuss] Potential memory leak Re: [Dnsmasq-discuss] Potential memory leak Re: [Dnsmasq-discuss] Potential memory leak Re: [Dnsmasq-discuss] Potential memory leak Re: [Dnsmasq-discuss] Potential memory leak Re: [Dnsmasq-discuss] Potential memory leak Re: [Dnsmasq-discuss] Potential memory leak Re: [Dnsmasq-discuss] Potential memory leak Re: [Dnsmasq-discuss] Potential memory leak Re: [Dnsmasq-discuss] Potential memory leak Re: [Dnsmasq-discuss] Potential memory leak [Dnsmasq-discuss] Potential memory leak
[Dnsmasq-discuss] [PATCH] Don't penalize conditional forwarders for REFUSED responses
2026-04-21 · via dnsmasq-discuss
Hi Simon,

When a conditional forwarder (server=/domain/addr) points at an authoritative-only nameserver that doesn't support recursion, three things go wrong over time:

  - process_reply() warns "nameserver X refused to do a recursive query" on every response that lacks the RA bit. For an authoritative server this is expected, not an error.

  - reply_query() clears last_server on REFUSED, which forces the next query into forwardall mode. That query sets last_server again on success, so the one after that runs with forwardall == 0 re-entering the code path where REFUSED triggers the retry and penalty. The clearing sustains this cycle.

  - reply_query() retries REFUSED through forward_query(), which bumps failed_queries and tries other servers in the group. With only one server for the domain the retry just re-sends to the same place; if that fails again, the response eventually falls through to general upstreams which return NXDOMAIN for the local domain.

The cumulative effect is that local-domain resolution degrades until dnsmasq is restarted. This is a common setup with Active Directory DNS or other authoritative-only forwarders behind conditional forwarding rules.

The attached patch adds a server->domain_len == 0 guard to all three code paths so the existing REFUSED/RA-bit handling continues to apply to general upstream servers but is skipped for domain-specific ones. SERVFAIL still triggers retries for all servers as before, since that indicates a genuine server error rather than an expected policy response.

Typical configuration that triggers the problem:

  server=/localdomain.ca/192.168.0.2    # AD DNS, authoritative only
  server=10.0.0.1                       # Unbound, recursive

The AD DNS answers localdomain.ca queries without RA, and returns REFUSED for anything outside its zone.  Without the patch, the REFUSED handling progressively penalizes 192.168.0.2 until localdomain.ca queries start going to Unbound which returns NXDOMAIN.

This has first been reported at https://github.com/pi-hole/FTL/issues/2836 but is something that needs to be fixed in dnsmasq itself, so I'm submitting the patch here.

Cheers,
Dominik
From dc7dadeb83db9f1562f3d4d9b6da21bb5928511d Mon Sep 17 00:00:00 2001
From: Dominik <[email protected]>
Date: Mon, 6 Apr 2026 10:37:36 +0200
Subject: [PATCH] Don't penalise conditional forwarders for REFUSED responses

Conditional forwarders (server=/domain/addr) are typically
authoritative-only and don't support recursion.  Three places in
forward.c treated them identically to general upstream resolvers,
causing cumulative damage when the forwarder returned REFUSED or
omitted the RA bit:

1. process_reply() logged "nameserver X refused to do a recursive
   query" whenever the RA bit was absent, even for domain-specific
   servers where this is expected.  The warning is now skipped when
   server->domain_len > 0.

2. reply_query() cleared last_server to -1 on REFUSED, which forced
   the next query into forwardall mode.  That query sets last_server
   again on success, so the one after runs with forwardall == 0 and
   re-enters the retry/penalty path on the next REFUSED.  The
   clearing sustains this cycle.  It is now skipped when
   server->domain_len > 0.

3. reply_query() retried REFUSED via forward_query(), which
   incremented failed_queries on the original server and attempted
   other servers in the same domain group.  With a single forwarder
   this just re-sent to the same server; with none left, the query
   fell through to general upstreams that returned NXDOMAIN for the
   local domain.  REFUSED from domain-specific servers now skips
   the retry path entirely (SERVFAIL still retries as before).

Taken together, these changes stop conditional forwarders from being
progressively degraded when they behave as authoritative servers
should: answering their zone without recursion, and refusing
everything else.

Signed-off-by: Dominik <[email protected]>
---
 src/forward.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/forward.c b/src/forward.c
index ab1ca76..226a234 100644
--- a/src/forward.c
+++ b/src/forward.c
@@ -763,9 +763,12 @@ static size_t process_reply(struct dns_header *header, time_t now, struct server
   if (!is_sign && !option_bool(OPT_DNSSEC_PROXY))
      header->hb4 &= ~HB4_AD;
 
-  /* Complain loudly if the upstream server is non-recursive. */
+  /* Complain loudly if the upstream server is non-recursive.
+     Skip this warning for conditional forwarders (domain-specific servers)
+     since they are expected to be authoritative-only and not support recursion. */
   if (!(header->hb4 & HB4_RA) && rcode == NOERROR &&
-      server && !(server->flags & SERV_WARNED_RECURSIVE))
+      server && !(server->flags & SERV_WARNED_RECURSIVE) &&
+      server->domain_len == 0)
     {
       (void)prettyprint_addr(&server->addr, daemon->namebuff);
       my_syslog(LOG_WARNING, _("nameserver %s refused to do a recursive query"), daemon->namebuff);
@@ -1225,7 +1228,10 @@ void reply_query(int fd, time_t now)
 
   if (RCODE(header) != REFUSED)
     daemon->serverarray[first]->last_server = c;
-  else if (daemon->serverarray[first]->last_server == c)
+  else if (daemon->serverarray[first]->last_server == c && server->domain_len == 0)
+    /* Don't clear last_server for conditional forwarders (domain-specific servers)
+       on REFUSED - they are authoritative and REFUSED is expected for
+       queries they don't handle recursively. */
     daemon->serverarray[first]->last_server = -1;
 
   /* log_query gets called indirectly all over the place, so 
@@ -1252,12 +1258,16 @@ void reply_query(int fd, time_t now)
 	return;
 #endif
       
-  if ((RCODE(header) == REFUSED || RCODE(header) == SERVFAIL) && forward->forwardall == 0)
-    /* for broken servers, attempt to send to another one. */
+  if (((RCODE(header) == REFUSED && server->domain_len == 0) || RCODE(header) == SERVFAIL) && forward->forwardall == 0)
+    /* For broken servers, attempt to send to another one.
+       Don't retry REFUSED from conditional forwarders (domain-specific servers)
+       as they are authoritative and REFUSED is an expected response when
+       they don't support recursion. Retrying would just penalize the
+       server and send to general upstreams which can't resolve the domain. */
     {
       /* Get the saved query back. */
       blockdata_retrieve(forward->stash, forward->stash_len, (void *)header);
-      
+
       forward_query(-1, NULL, NULL, 0, header, forward->stash_len, 0, now, forward, 0, 0);
       return;
     }
-- 
2.43.0

_______________________________________________
Dnsmasq-discuss mailing list
[email protected]
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss