Hey Simon, CC list,

the --rev-server option is currently broken in the released
version of dnsmasq for any non-dividable-by-eight CIDR
subnets.

It got broken in commit 1db9943 when resolving upstream
servers by name was extended to --rev-server without
accounting for the fact that rev-server is a special edge-
case. Re-using one and the same upstream server for each of
the x.y.z.in-addr.arpa is actually a wanted feature and
should not be suppressed.

A very simple patch for this is attached.

The offending commit on our mirror:
https://github.com/pi-hole/dnsmasq/commit/1db9943c6879c160a5fbef885d5ceadd3668b74d

The proposed fix:
https://github.com/pi-hole/dnsmasq/pull/13

Best,
Dominik
From 6f39ec984e00aad03c045f2b7f9e814f671099bf Mon Sep 17 00:00:00 2001
From: DL6ER <dl...@dl6er.de>
Date: Fri, 3 Mar 2023 18:05:26 +0100
Subject: [PATCH] Fix --rev-server option. It was broken in
 1db9943c6879c160a5fbef885d5ceadd3668b74d when resolving upstream servers by
 name was extended to --rev-server without accounting for the fact that
 re-using one and the same upstream server for each of the x.y.z.in-addr.arpa
 is actually a wanted feature

Signed-off-by: DL6ER <dl...@dl6er.de>
---
 src/option.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/option.c b/src/option.c
index 1090bca..2e208ba 100644
--- a/src/option.c
+++ b/src/option.c
@@ -1159,6 +1159,9 @@ static char *domain_rev4(int from_file, char *server, struct in_addr *addr4, int
 	}
       else
 	{
+	  /* Always reset server as valid here, so we can add the same upstream
+	     server address multiple times for each x.y.z.in-addr.arpa  */
+	  sdetails.valid = 1;
 	  while (parse_server_next(&sdetails))
 	    {
 	      if ((string = parse_server_addr(&sdetails)))
@@ -1244,6 +1247,9 @@ static char *domain_rev6(int from_file, char *server, struct in6_addr *addr6, in
 	}
       else
 	{
+	  /* Always reset server as valid here, so we can add the same upstream
+	     server address multiple times for each x.y.z.ip6.arpa  */
+	  sdetails.valid = 1;
 	  while (parse_server_next(&sdetails))
 	    {
 	      if ((string = parse_server_addr(&sdetails)))
-- 
2.34.1

_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss

Reply via email to