473297bcdc5c09d91331700e8545aeabdd95ff4c
[openwrt/staging/stintel.git] /
1 From cbb5b17ad8e03e08ade62376a4f6a2066e55960d Mon Sep 17 00:00:00 2001
2 From: Simon Kelley <simon@thekelleys.org.uk>
3 Date: Tue, 23 Oct 2018 23:45:57 +0100
4 Subject: [PATCH 05/32] Fix logging in cf5984367bc6a949e3803a576512c5a7bc48ebab
5
6 Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
7 ---
8 src/rfc1035.c | 27 ++++++++++++++++++---------
9 1 file changed, 18 insertions(+), 9 deletions(-)
10
11 --- a/src/rfc1035.c
12 +++ b/src/rfc1035.c
13 @@ -1335,7 +1335,6 @@ size_t answer_request(struct dns_header
14 {
15 unsigned long ttl = daemon->local_ttl;
16 int ok = 1;
17 - log_query(F_CONFIG | F_RRNAME, name, NULL, "<TXT>");
18 #ifndef NO_ID
19 /* Dynamically generate stat record */
20 if (t->stat != 0)
21 @@ -1345,11 +1344,14 @@ size_t answer_request(struct dns_header
22 ok = 0;
23 }
24 #endif
25 - if (ok && add_resource_record(header, limit, &trunc, nameoffset, &ansp,
26 - ttl, NULL,
27 - T_TXT, t->class, "t", t->len, t->txt))
28 - anscount++;
29 -
30 + if (ok)
31 + {
32 + log_query(F_CONFIG | F_RRNAME, name, NULL, "<TXT>");
33 + if (add_resource_record(header, limit, &trunc, nameoffset, &ansp,
34 + ttl, NULL,
35 + T_TXT, t->class, "t", t->len, t->txt))
36 + anscount++;
37 + }
38 }
39 }
40 }
41 @@ -1357,12 +1359,19 @@ size_t answer_request(struct dns_header
42
43 if (qclass == C_CHAOS)
44 {
45 - /* don't forward *.bind and *.server chaos queries */
46 + /* don't forward *.bind and *.server chaos queries - always reply with NOTIMP */
47 if (hostname_issubdomain("bind", name) || hostname_issubdomain("server", name))
48 {
49 if (!ans)
50 - notimp = 1, auth = 0;
51 - ans = 1;
52 + {
53 + notimp = 1, auth = 0;
54 + if (!dryrun)
55 + {
56 + addr.addr.rcode.rcode = NOTIMP;
57 + log_query(F_CONFIG | F_RCODE, name, &addr, NULL);
58 + }
59 + ans = 1;
60 + }
61 }
62 }
63