From 1f6cc4fa827e147cebf578c5b12c7871fa8f762e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Vavru=C5=A1a?= <marek.vavrusa@nic.cz>
Date: Wed, 3 Jun 2015 23:02:42 +0200
Subject: [PATCH] layer/iterate: mark answers with SOA proof with AA=1

---
 lib/layer/iterate.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/layer/iterate.c b/lib/layer/iterate.c
index e3d18669a..a7954b798 100644
--- a/lib/layer/iterate.c
+++ b/lib/layer/iterate.c
@@ -300,9 +300,14 @@ static int process_answer(knot_pkt_t *pkt, struct kr_request *req)
 	}
 
 	/* This answer didn't improve resolution chain, therefore must be authoritative (relaxed to negative). */
-	if (!is_authoritative(pkt, query) && (pkt_class & (PKT_NXDOMAIN|PKT_NODATA))) {
-		DEBUG_MSG("<= lame response: non-auth sent negative response\n");
-		return KNOT_STATE_FAIL;
+	if (!is_authoritative(pkt, query)) {
+		if (pkt_class & (PKT_NXDOMAIN|PKT_NODATA)) {
+			DEBUG_MSG("<= lame response: non-auth sent negative response\n");
+			return KNOT_STATE_FAIL;
+		}
+	} else {
+		/* Make sure that this is an authoritative naswer (even with AA=0) for other layers */
+		knot_wire_set_aa(pkt->wire);
 	}
 
 	/* Process answer type */
-- 
GitLab