Hey Simon,

Since commit "Fix --address=/#/...... which was lost in 2.86"
(26bbf5a314d833beaf0f147d24409969f05f3dba) --local being a
synonym for --server is broken as --local became a synonym for --
address.

The attached patch fixes this.

This was reported on the Pi-hole forums:

> I have local=/fritz.box/192.168.0.1 in my /etc/dnsmasq.d/02-
> localdns.conf config file. This worked fine until upgrading
> pihole last night. Now all queries to FQDNs such as google.com
> get responded with google.com.fritz.box and ip address
> 192.186.0.1.
> 
> Changing the line to server=/fritz.box/192.168.0.1 restores the
> previous handling. However, according to the dnsmasq manpage "-
> -local is a synonym for --server to make configuration files
> clearer in this case."

Best,
Dominik
From 57461836c48deda17c468ae3c2033d0cc3dc34ec Mon Sep 17 00:00:00 2001
From: DL6ER <dl...@dl6er.de>
Date: Tue, 5 Oct 2021 10:15:21 +0200
Subject: [PATCH] --local should behave as --server, not as --address according
 to the man page

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

diff --git a/src/option.c b/src/option.c
index 5307f01..dc1efd3 100644
--- a/src/option.c
+++ b/src/option.c
@@ -2758,7 +2758,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
 	
 	if (!arg || !*arg)
 	  flags = SERV_LITERAL_ADDRESS;
-	else if (option != 'S')
+	else if (option == 'A')
 	  {
 	    /* # as literal address means return zero address for 4 and 6 */
 	    if (strcmp(arg, "#") == 0)
@@ -2790,7 +2790,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
 		  flags &= ~SERV_FOR_NODOTS;
 
 		/* address=/#/ matches the same as without domain */
-		if (option != 'S' && domain[0] == '#' && domain[1] == 0)
+		if (option == 'A' && domain[0] == '#' && domain[1] == 0)
 		  domain[0] = 0;
 	      }
 	    
-- 
2.25.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