From ae1fbbd3e50aaf5d59426abe749197afba21f2b9 Mon Sep 17 00:00:00 2001
From: Karel Slany <karel.slany@nic.cz>
Date: Wed, 13 Jul 2016 11:00:27 +0200
Subject: [PATCH] Renamed function with confusing name.

---
 lib/cookies/helper.c | 2 +-
 lib/cookies/helper.h | 8 +++++---
 lib/resolve.c        | 2 +-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/cookies/helper.c b/lib/cookies/helper.c
index 161b56c6a..4b327c22f 100644
--- a/lib/cookies/helper.c
+++ b/lib/cookies/helper.c
@@ -243,7 +243,7 @@ int kr_pkt_set_ext_rcode(knot_pkt_t *pkt, uint16_t whole_rcode)
 	return kr_ok();
 }
 
-uint8_t *kr_is_cookie_query(const knot_pkt_t *pkt)
+uint8_t *kr_no_question_cookie_query(const knot_pkt_t *pkt)
 {
 	if (!pkt || knot_wire_get_qdcount(pkt->wire) > 0) {
 		return false;
diff --git a/lib/cookies/helper.h b/lib/cookies/helper.h
index d5e16bf39..8ceee2029 100644
--- a/lib/cookies/helper.h
+++ b/lib/cookies/helper.h
@@ -68,12 +68,14 @@ KR_EXPORT
 int kr_pkt_set_ext_rcode(knot_pkt_t *pkt, uint16_t whole_rcode);
 
 /**
- * @brief Check whether packet is a server cookie request.
+ * @brief Check whether packet is a server cookie request according to
+ *        RFC7873 5.4.
  * @param pkt Packet to be examined.
- * @return Pointer to entire cookie option if is a cookie query, NULL else.
+ * @return Pointer to entire cookie option if is a server cookie query, NULL on
+ *         errors or if packet doesn't contain cookies or if QDCOUNT > 0.
  */
 KR_EXPORT
-uint8_t *kr_is_cookie_query(const knot_pkt_t *pkt);
+uint8_t *kr_no_question_cookie_query(const knot_pkt_t *pkt);
 
 /**
  * @brief Parse cookies from cookie option.
diff --git a/lib/resolve.c b/lib/resolve.c
index 934fcf565..eb0131801 100644
--- a/lib/resolve.c
+++ b/lib/resolve.c
@@ -462,7 +462,7 @@ static int resolve_query(struct kr_request *request, const knot_pkt_t *packet)
 		 * The layers don't expect to handle queries with QDCOUNT != 1
 		 * so such queries are handled directly here. */
 		struct knot_dns_cookies cookies = { 0, };
-		uint8_t *cookie_opt = kr_is_cookie_query(packet);
+		uint8_t *cookie_opt = kr_no_question_cookie_query(packet);
 		if (cookie_opt && request->ctx->cookie_ctx.clnt.enabled) {
 			if (kr_ok() != kr_parse_cookie_opt(cookie_opt,
 			                                   &cookies)) {
-- 
GitLab