From 267686c21f4b31346839ae1d4085d4990fcdc63c Mon Sep 17 00:00:00 2001
From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Tue, 14 Feb 2017 13:55:46 +0100
Subject: [PATCH] Use A(AAA) when querying for domain on cache expire
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

When cache entry is (halfly) expired we send query to get an update. So
far we were sending all queries using PTR records but for cached domains
it should be A(AAA) instead.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
---
 cache.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/cache.c b/cache.c
index dd263d2..756ae68 100644
--- a/cache.c
+++ b/cache.c
@@ -89,7 +89,12 @@ cache_gc_timer(struct uloop_timeout *timeout)
 			continue;
 		}
 		s->refresh += 50;
-		dns_send_question(s->iface, s->entry, TYPE_PTR, 0);
+		if (cache_service_is_host(s)) {
+			dns_send_question(s->iface, s->entry, TYPE_A, 0);
+			dns_send_question(s->iface, s->entry, TYPE_AAAA, 0);
+		} else {
+			dns_send_question(s->iface, s->entry, TYPE_PTR, 0);
+		}
 	}
 
 	uloop_timeout_set(timeout, 10000);
-- 
2.25.1