Moved query logging block to not include requests from localhost.
Change-Id: Ia798397c38f5433f1758a9270962b4a09c9b0356
diff --git a/src/forward.c b/src/forward.c
index e2749f9..7d647fd 100644
--- a/src/forward.c
+++ b/src/forward.c
@@ -1294,17 +1294,6 @@
if (extract_request(header, (size_t)n, daemon->namebuff, &type))
{
- FILE *fp;
- fp = fopen("/tmp/dns_query_log.txt", "a");
- if (!fp)
- {
- my_syslog(LOG_ERR, "failed to open /tmp/dns_query_log.txt: %s", strerror(errno));
- }
- else
- {
- fprintf(fp, "%lu %s\n", now, daemon->namebuff);
- fclose(fp);
- }
#ifdef HAVE_AUTH
struct auth_zone *zone;
#endif
@@ -1318,6 +1307,20 @@
log_query(F_QUERY | F_IPV6 | F_FORWARD, daemon->namebuff,
(struct all_addr *)&source_addr.in6.sin6_addr, types);
#endif
+ if (strcmp("127.0.0.1", daemon->addrbuff) != 0)
+ {
+ FILE *fp;
+ fp = fopen("/tmp/dns_query_log.txt", "a");
+ if (!fp)
+ {
+ my_syslog(LOG_ERR, "failed to open /tmp/dns_query_log.txt: %s", strerror(errno));
+ }
+ else
+ {
+ fprintf(fp, "%lu %s\n", now, daemon->namebuff);
+ fclose(fp);
+ }
+ }
#ifdef HAVE_AUTH
/* find queries for zones we're authoritative for, and answer them directly */