]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/dnsmasq/0059-Make-address-example.com-equivalent-to-server-exampl.patch
Merge branch 'next' of ssh://git.ipfire.org/pub/git/ipfire-2.x into next
[ipfire-2.x.git] / src / patches / dnsmasq / 0059-Make-address-example.com-equivalent-to-server-exampl.patch
CommitLineData
c6ce1e7e
MT
1From 979fe86bc8693f660eddea232ae39cbbb50b294c Mon Sep 17 00:00:00 2001
2From: Simon Kelley <simon@thekelleys.org.uk>
3Date: Thu, 19 Mar 2015 22:50:22 +0000
d54a2ce4 4Subject: [PATCH 59/78] Make --address=/example.com/ equivalent to
c6ce1e7e
MT
5 --server=/example.com/
6
7---
8 man/dnsmasq.8 | 7 +++++--
9 src/network.c | 4 ++--
10 src/option.c | 2 --
11 3 files changed, 7 insertions(+), 6 deletions(-)
12
13diff --git a/man/dnsmasq.8 b/man/dnsmasq.8
14index 2db780d90987..1f1dd7b69c53 100644
15--- a/man/dnsmasq.8
16+++ b/man/dnsmasq.8
17@@ -460,7 +460,7 @@ but provides some syntactic sugar to make specifying address-to-name queries eas
18 is exactly equivalent to
19 .B --server=/3.2.1.in-addr.arpa/192.168.0.1
20 .TP
21-.B \-A, --address=/<domain>/[domain/]<ipaddr>
22+.B \-A, --address=/<domain>/[domain/][<ipaddr>]
23 Specify an IP address to return for any host in the given domains.
24 Queries in the domains are never forwarded and always replied to
25 with the specified IP address which may be IPv4 or IPv6. To give
26@@ -472,7 +472,10 @@ domain specification works in the same was as for --server, with the
27 additional facility that /#/ matches any domain. Thus
28 --address=/#/1.2.3.4 will always return 1.2.3.4 for any query not
29 answered from /etc/hosts or DHCP and not sent to an upstream
30-nameserver by a more specific --server directive.
31+nameserver by a more specific --server directive. As for --server,
32+one or more domains with no address returns a no-such-domain answer, so
33+--address=/example.com/ is equivalent to --server=/example.com/ and returns
34+NXDOMAIN for example.com and all its subdomains.
35 .TP
36 .B --ipset=/<domain>/[domain/]<ipset>[,<ipset>]
37 Places the resolved IP addresses of queries for the specified domains
38diff --git a/src/network.c b/src/network.c
39index 7045253d467b..992f023c31de 100644
40--- a/src/network.c
41+++ b/src/network.c
42@@ -1459,7 +1459,7 @@ void check_servers(void)
43 }
44 }
45
46- if (!(serv->flags & SERV_NO_REBIND))
47+ if (!(serv->flags & SERV_NO_REBIND) && !(serv->flags & SERV_LITERAL_ADDRESS))
48 {
49 if (serv->flags & (SERV_HAS_DOMAIN | SERV_FOR_NODOTS | SERV_USE_RESOLV))
50 {
51@@ -1475,7 +1475,7 @@ void check_servers(void)
52 my_syslog(LOG_INFO, _("using local addresses only for %s %s"), s1, s2);
53 else if (serv->flags & SERV_USE_RESOLV)
54 my_syslog(LOG_INFO, _("using standard nameservers for %s %s"), s1, s2);
55- else if (!(serv->flags & SERV_LITERAL_ADDRESS))
56+ else
57 my_syslog(LOG_INFO, _("using nameserver %s#%d for %s %s"), daemon->namebuff, port, s1, s2);
58 }
59 #ifdef HAVE_LOOP
60diff --git a/src/option.c b/src/option.c
61index eace40bb566c..3009eb545fde 100644
62--- a/src/option.c
63+++ b/src/option.c
64@@ -2284,8 +2284,6 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
65 {
66 if (!(newlist->flags & SERV_NO_REBIND))
67 newlist->flags |= SERV_NO_ADDR; /* no server */
68- if (newlist->flags & SERV_LITERAL_ADDRESS)
69- ret_err(gen_err);
70 }
71
72 else if (strcmp(arg, "#") == 0)
73--
742.1.0
75