Blame SOURCES/unbound-1.15-soversion2-compat.patch

ccb6a3
From 605d66f0b6b8f7c308010f455058299d25c1d2ee Mon Sep 17 00:00:00 2001
75038b
From: Petr Mensik <pemensik@redhat.com>
75038b
Date: Fri, 6 May 2022 16:36:39 +0200
75038b
Subject: [PATCH] Rework ABI breaking change to compatible way
75038b
75038b
Upstream commit 749d1b9ebc6fcb79824afd0471a1cfc12ca861b1 introduced
75038b
was_ratelimited variable to every async callback. Such change led to ABI
75038b
break and increase of soname of libunbound.
75038b
75038b
Use rcode to pass that boolean inside rcode variable. Allows keeping
75038b
original callback prototype, but does not lose data. Extra integer bit
75038b
operations should be very small price. Much better than ABI break.
75038b
75038b
Make current version compatible back to .2 version.
75038b
---
ccb6a3
 unbound-1.16.2/configure.ac               |  2 +-
ccb6a3
 unbound-1.16.2/daemon/worker.c            |  6 ++--
ccb6a3
 unbound-1.16.2/libunbound/libworker.c     | 34 +++++++++++++++--------
ccb6a3
 unbound-1.16.2/libunbound/unbound-event.h |  3 +-
ccb6a3
 unbound-1.16.2/libunbound/unbound.h       | 13 +++++----
ccb6a3
 unbound-1.16.2/libunbound/worker.h        |  6 ++--
ccb6a3
 unbound-1.16.2/services/authzone.c        | 11 ++++----
ccb6a3
 unbound-1.16.2/services/authzone.h        |  9 ++----
ccb6a3
 unbound-1.16.2/services/mesh.c            | 17 ++++++++----
ccb6a3
 unbound-1.16.2/services/mesh.h            |  9 +++++-
ccb6a3
 unbound-1.16.2/smallapp/worker_cb.c       |  6 ++--
ccb6a3
 unbound-1.16.2/validator/autotrust.c      |  2 +-
ccb6a3
 unbound-1.16.2/validator/autotrust.h      |  2 +-
75038b
 13 files changed, 72 insertions(+), 48 deletions(-)
75038b
ccb6a3
diff --git a/unbound-1.16.2/configure.ac b/unbound-1.16.2/configure.ac
ccb6a3
index 224501b..71f066c 100644
ccb6a3
--- a/unbound-1.16.2/configure.ac
ccb6a3
+++ b/unbound-1.16.2/configure.ac
75038b
@@ -19,7 +19,7 @@ AC_SUBST(UNBOUND_VERSION_MICRO, [VERSION_MICRO])
75038b
 
75038b
 LIBUNBOUND_CURRENT=9
ccb6a3
 LIBUNBOUND_REVISION=18
75038b
-LIBUNBOUND_AGE=1
75038b
+LIBUNBOUND_AGE=7
75038b
 # 1.0.0 had 0:12:0
75038b
 # 1.0.1 had 0:13:0
75038b
 # 1.0.2 had 0:14:0
ccb6a3
diff --git a/unbound-1.16.2/daemon/worker.c b/unbound-1.16.2/daemon/worker.c
ccb6a3
index 010c4dc..2b87a41 100644
ccb6a3
--- a/unbound-1.16.2/daemon/worker.c
ccb6a3
+++ b/unbound-1.16.2/daemon/worker.c
75038b
@@ -2268,21 +2268,21 @@ void libworker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
75038b
 
75038b
 void libworker_fg_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode),
75038b
 	sldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s),
75038b
-	char* ATTR_UNUSED(why_bogus), int ATTR_UNUSED(was_ratelimited))
75038b
+	char* ATTR_UNUSED(why_bogus))
75038b
 {
75038b
 	log_assert(0);
75038b
 }
75038b
 
75038b
 void libworker_bg_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode),
75038b
 	sldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s),
75038b
-	char* ATTR_UNUSED(why_bogus), int ATTR_UNUSED(was_ratelimited))
75038b
+	char* ATTR_UNUSED(why_bogus))
75038b
 {
75038b
 	log_assert(0);
75038b
 }
75038b
 
75038b
 void libworker_event_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode),
75038b
 	sldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s),
75038b
-	char* ATTR_UNUSED(why_bogus), int ATTR_UNUSED(was_ratelimited))
75038b
+	char* ATTR_UNUSED(why_bogus))
75038b
 {
75038b
 	log_assert(0);
75038b
 }
ccb6a3
diff --git a/unbound-1.16.2/libunbound/libworker.c b/unbound-1.16.2/libunbound/libworker.c
75038b
index 11bf5f9..6895119 100644
ccb6a3
--- a/unbound-1.16.2/libunbound/libworker.c
ccb6a3
+++ b/unbound-1.16.2/libunbound/libworker.c
75038b
@@ -549,9 +549,10 @@ libworker_enter_result(struct ub_result* res, sldns_buffer* buf,
75038b
 /** fillup fg results */
75038b
 static void
75038b
 libworker_fillup_fg(struct ctx_query* q, int rcode, sldns_buffer* buf, 
75038b
-	enum sec_status s, char* why_bogus, int was_ratelimited)
75038b
+	enum sec_status s, char* why_bogus)
75038b
 {
75038b
-	q->res->was_ratelimited = was_ratelimited;
75038b
+	q->res->was_ratelimited = RCODE_IS_RATELIMITED(rcode);
75038b
+	rcode = RCODE_NOT_RATELIMITED(rcode);
75038b
 	if(why_bogus)
75038b
 		q->res->why_bogus = strdup(why_bogus);
75038b
 	if(rcode != 0) {
75038b
@@ -575,13 +576,13 @@ libworker_fillup_fg(struct ctx_query* q, int rcode, sldns_buffer* buf,
75038b
 
75038b
 void
75038b
 libworker_fg_done_cb(void* arg, int rcode, sldns_buffer* buf, enum sec_status s,
75038b
-	char* why_bogus, int was_ratelimited)
75038b
+	char* why_bogus)
75038b
 {
75038b
 	struct ctx_query* q = (struct ctx_query*)arg;
75038b
 	/* fg query is done; exit comm base */
75038b
 	comm_base_exit(q->w->base);
75038b
 
75038b
-	libworker_fillup_fg(q, rcode, buf, s, why_bogus, was_ratelimited);
75038b
+	libworker_fillup_fg(q, rcode, buf, s, why_bogus);
75038b
 }
75038b
 
75038b
 /** setup qinfo and edns */
75038b
@@ -634,7 +635,7 @@ int libworker_fg(struct ub_ctx* ctx, struct ctx_query* q)
75038b
 		NULL, 0, NULL, 0, NULL)) {
75038b
 		regional_free_all(w->env->scratch);
75038b
 		libworker_fillup_fg(q, LDNS_RCODE_NOERROR, 
75038b
-			w->back->udp_buff, sec_status_insecure, NULL, 0);
75038b
+			w->back->udp_buff, sec_status_insecure, NULL);
75038b
 		libworker_delete(w);
75038b
 		free(qinfo.qname);
75038b
 		return UB_NOERROR;
75038b
@@ -643,7 +644,7 @@ int libworker_fg(struct ub_ctx* ctx, struct ctx_query* q)
75038b
 		w->env, &qinfo, &edns, NULL, w->back->udp_buff, w->env->scratch)) {
75038b
 		regional_free_all(w->env->scratch);
75038b
 		libworker_fillup_fg(q, LDNS_RCODE_NOERROR, 
75038b
-			w->back->udp_buff, sec_status_insecure, NULL, 0);
75038b
+			w->back->udp_buff, sec_status_insecure, NULL);
75038b
 		libworker_delete(w);
75038b
 		free(qinfo.qname);
75038b
 		return UB_NOERROR;
75038b
@@ -665,7 +666,7 @@ int libworker_fg(struct ub_ctx* ctx, struct ctx_query* q)
75038b
 
75038b
 void
75038b
 libworker_event_done_cb(void* arg, int rcode, sldns_buffer* buf,
75038b
-	enum sec_status s, char* why_bogus, int was_ratelimited)
75038b
+	enum sec_status s, char* why_bogus)
75038b
 {
75038b
 	struct ctx_query* q = (struct ctx_query*)arg;
75038b
 	ub_event_callback_type cb = q->cb_event;
75038b
@@ -688,7 +689,7 @@ libworker_event_done_cb(void* arg, int rcode, sldns_buffer* buf,
75038b
 		else if(s == sec_status_secure)
75038b
 			sec = 2;
75038b
 		(*cb)(cb_arg, rcode, (buf?(void*)sldns_buffer_begin(buf):NULL),
75038b
-			(buf?(int)sldns_buffer_limit(buf):0), sec, why_bogus, was_ratelimited);
75038b
+			(buf?(int)sldns_buffer_limit(buf):0), sec, why_bogus);
75038b
 	}
75038b
 }
75038b
 
75038b
@@ -715,7 +716,7 @@ int libworker_attach_mesh(struct ub_ctx* ctx, struct ctx_query* q,
75038b
 		regional_free_all(w->env->scratch);
75038b
 		free(qinfo.qname);
75038b
 		libworker_event_done_cb(q, LDNS_RCODE_NOERROR,
75038b
-			w->back->udp_buff, sec_status_insecure, NULL, 0);
75038b
+			w->back->udp_buff, sec_status_insecure, NULL);
75038b
 		return UB_NOERROR;
75038b
 	}
75038b
 	if(ctx->env->auth_zones && auth_zones_answer(ctx->env->auth_zones,
75038b
@@ -723,7 +724,7 @@ int libworker_attach_mesh(struct ub_ctx* ctx, struct ctx_query* q,
75038b
 		regional_free_all(w->env->scratch);
75038b
 		free(qinfo.qname);
75038b
 		libworker_event_done_cb(q, LDNS_RCODE_NOERROR,
75038b
-			w->back->udp_buff, sec_status_insecure, NULL, 0);
75038b
+			w->back->udp_buff, sec_status_insecure, NULL);
75038b
 		return UB_NOERROR;
75038b
 	}
75038b
 	/* process new query */
75038b
@@ -788,12 +789,23 @@ add_bg_result(struct libworker* w, struct ctx_query* q, sldns_buffer* pkt,
75038b
 	}
75038b
 }
75038b
 
75038b
+
75038b
+void
75038b
+libworker_bg_done_cb_compat(void* arg, int rcode, sldns_buffer* buf, enum sec_status s,
75038b
+	char* why_bogus)
75038b
+{
75038b
+	rcode = RCODE_NOT_RATELIMITED(rcode);
75038b
+	libworker_bg_done_cb(arg, rcode, buf, s, why_bogus);
75038b
+}
75038b
+
75038b
 void
75038b
 libworker_bg_done_cb(void* arg, int rcode, sldns_buffer* buf, enum sec_status s,
75038b
-	char* why_bogus, int was_ratelimited)
75038b
+	char* why_bogus)
75038b
 {
75038b
+	int was_ratelimited = RCODE_IS_RATELIMITED(rcode);
75038b
 	struct ctx_query* q = (struct ctx_query*)arg;
75038b
 
75038b
+	rcode = RCODE_NOT_RATELIMITED(rcode);
75038b
 	if(q->cancelled || q->w->back->want_to_quit) {
75038b
 		if(q->w->is_bg_thread) {
75038b
 			/* delete it now */
ccb6a3
diff --git a/unbound-1.16.2/libunbound/unbound-event.h b/unbound-1.16.2/libunbound/unbound-event.h
75038b
index a5d5c03..70aa4c8 100644
ccb6a3
--- a/unbound-1.16.2/libunbound/unbound-event.h
ccb6a3
+++ b/unbound-1.16.2/libunbound/unbound-event.h
75038b
@@ -170,7 +170,8 @@ struct ub_event {
75038b
 	struct ub_event_vmt* vmt;
75038b
 };
75038b
 
75038b
-typedef void (*ub_event_callback_type)(void*, int, void*, int, int, char*, int);
75038b
+/* Uses define LDNS_RCODE_RATELIMITED from services/mesh.h */
75038b
+typedef void (*ub_event_callback_type)(void*, int, void*, int, int, char*);
75038b
 
75038b
 /**
75038b
  * Create a resolving and validation context.
ccb6a3
diff --git a/unbound-1.16.2/libunbound/unbound.h b/unbound-1.16.2/libunbound/unbound.h
ccb6a3
index c779d18..f6d5c7c 100644
ccb6a3
--- a/unbound-1.16.2/libunbound/unbound.h
ccb6a3
+++ b/unbound-1.16.2/libunbound/unbound.h
75038b
@@ -203,18 +203,19 @@ struct ub_result {
75038b
 	 */
75038b
 	char* why_bogus;
75038b
 
75038b
+	/**
75038b
+	 * TTL for the result, in seconds.  If the security is bogus, then
75038b
+	 * you also cannot trust this value.
75038b
+	 */
75038b
+	int ttl;
75038b
+
75038b
 	/**
75038b
 	 * If the query or one of its subqueries was ratelimited.  Useful if
75038b
 	 * ratelimiting is enabled and answer to the client is SERVFAIL as a
75038b
 	 * result.
75038b
+	 * RHEL8 Change, moved after ttl.
75038b
 	 */
75038b
 	int was_ratelimited;
75038b
-
75038b
-	/**
75038b
-	 * TTL for the result, in seconds.  If the security is bogus, then
75038b
-	 * you also cannot trust this value.
75038b
-	 */
75038b
-	int ttl;
75038b
 };
75038b
 
75038b
 /**
ccb6a3
diff --git a/unbound-1.16.2/libunbound/worker.h b/unbound-1.16.2/libunbound/worker.h
75038b
index 0fa5bfa..8b64b4d 100644
ccb6a3
--- a/unbound-1.16.2/libunbound/worker.h
ccb6a3
+++ b/unbound-1.16.2/libunbound/worker.h
75038b
@@ -90,15 +90,15 @@ void libworker_handle_control_cmd(struct tube* tube, uint8_t* msg, size_t len,
75038b
 
75038b
 /** mesh callback with fg results */
75038b
 void libworker_fg_done_cb(void* arg, int rcode, sldns_buffer* buf, 
75038b
-	enum sec_status s, char* why_bogus, int was_ratelimited);
75038b
+	enum sec_status s, char* why_bogus);
75038b
 
75038b
 /** mesh callback with bg results */
75038b
 void libworker_bg_done_cb(void* arg, int rcode, sldns_buffer* buf, 
75038b
-	enum sec_status s, char* why_bogus, int was_ratelimited);
75038b
+	enum sec_status s, char* why_bogus);
75038b
 
75038b
 /** mesh callback with event results */
75038b
 void libworker_event_done_cb(void* arg, int rcode, struct sldns_buffer* buf, 
75038b
-	enum sec_status s, char* why_bogus, int was_ratelimited);
75038b
+	enum sec_status s, char* why_bogus);
75038b
 
75038b
 /**
75038b
  * Worker signal handler function. User argument is the worker itself.
ccb6a3
diff --git a/unbound-1.16.2/services/authzone.c b/unbound-1.16.2/services/authzone.c
ccb6a3
index b9e0b11..c72949f 100644
ccb6a3
--- a/unbound-1.16.2/services/authzone.c
ccb6a3
+++ b/unbound-1.16.2/services/authzone.c
ccb6a3
@@ -5656,8 +5656,7 @@ xfr_master_add_addrs(struct auth_master* m, struct ub_packed_rrset_key* rrset,
75038b
 
75038b
 /** callback for task_transfer lookup of host name, of A or AAAA */
75038b
 void auth_xfer_transfer_lookup_callback(void* arg, int rcode, sldns_buffer* buf,
75038b
-	enum sec_status ATTR_UNUSED(sec), char* ATTR_UNUSED(why_bogus),
75038b
-	int ATTR_UNUSED(was_ratelimited))
75038b
+	enum sec_status ATTR_UNUSED(sec), char* ATTR_UNUSED(why_bogus))
75038b
 {
75038b
 	struct auth_xfer* xfr = (struct auth_xfer*)arg;
75038b
 	struct module_env* env;
ccb6a3
@@ -5669,6 +5668,7 @@ void auth_xfer_transfer_lookup_callback(void* arg, int rcode, sldns_buffer* buf,
75038b
 		return; /* stop on quit */
75038b
 	}
75038b
 
75038b
+	rcode = RCODE_NOT_RATELIMITED(rcode);
75038b
 	/* process result */
75038b
 	if(rcode == LDNS_RCODE_NOERROR) {
75038b
 		uint16_t wanted_qtype = LDNS_RR_TYPE_A;
ccb6a3
@@ -6717,8 +6717,7 @@ xfr_probe_send_or_end(struct auth_xfer* xfr, struct module_env* env)
75038b
 
75038b
 /** callback for task_probe lookup of host name, of A or AAAA */
75038b
 void auth_xfer_probe_lookup_callback(void* arg, int rcode, sldns_buffer* buf,
75038b
-	enum sec_status ATTR_UNUSED(sec), char* ATTR_UNUSED(why_bogus),
75038b
-	int ATTR_UNUSED(was_ratelimited))
75038b
+	enum sec_status ATTR_UNUSED(sec), char* ATTR_UNUSED(why_bogus))
75038b
 {
75038b
 	struct auth_xfer* xfr = (struct auth_xfer*)arg;
75038b
 	struct module_env* env;
ccb6a3
@@ -6730,6 +6729,7 @@ void auth_xfer_probe_lookup_callback(void* arg, int rcode, sldns_buffer* buf,
75038b
 		return; /* stop on quit */
75038b
 	}
75038b
 
75038b
+	rcode = RCODE_NOT_RATELIMITED(rcode);
75038b
 	/* process result */
75038b
 	if(rcode == LDNS_RCODE_NOERROR) {
75038b
 		uint16_t wanted_qtype = LDNS_RR_TYPE_A;
ccb6a3
@@ -8212,7 +8212,7 @@ auth_zone_verify_zonemd_key_with_ds(struct auth_zone* z,
75038b
 
75038b
 /** callback for ZONEMD lookup of DNSKEY */
75038b
 void auth_zonemd_dnskey_lookup_callback(void* arg, int rcode, sldns_buffer* buf,
75038b
-	enum sec_status sec, char* why_bogus, int ATTR_UNUSED(was_ratelimited))
75038b
+	enum sec_status sec, char* why_bogus)
75038b
 {
75038b
 	struct auth_zone* z = (struct auth_zone*)arg;
75038b
 	struct module_env* env;
ccb6a3
@@ -8234,6 +8234,7 @@ void auth_zonemd_dnskey_lookup_callback(void* arg, int rcode, sldns_buffer* buf,
75038b
 	if(z->zonemd_callback_qtype == LDNS_RR_TYPE_DS)
75038b
 		typestr = "DS";
75038b
 	downprot = env->cfg->harden_algo_downgrade;
75038b
+	rcode = RCODE_NOT_RATELIMITED(rcode);
75038b
 
75038b
 	/* process result */
75038b
 	if(sec == sec_status_bogus) {
ccb6a3
diff --git a/unbound-1.16.2/services/authzone.h b/unbound-1.16.2/services/authzone.h
75038b
index 07614ed..b339fc1 100644
ccb6a3
--- a/unbound-1.16.2/services/authzone.h
ccb6a3
+++ b/unbound-1.16.2/services/authzone.h
75038b
@@ -690,12 +690,10 @@ void auth_xfer_probe_timer_callback(void* arg);
75038b
 void auth_xfer_transfer_timer_callback(void* arg);
75038b
 /** mesh callback for task_probe on lookup of host names */
75038b
 void auth_xfer_probe_lookup_callback(void* arg, int rcode,
75038b
-	struct sldns_buffer* buf, enum sec_status sec, char* why_bogus,
75038b
-	int was_ratelimited);
75038b
+	struct sldns_buffer* buf, enum sec_status sec, char* why_bogus);
75038b
 /** mesh callback for task_transfer on lookup of host names */
75038b
 void auth_xfer_transfer_lookup_callback(void* arg, int rcode,
75038b
-	struct sldns_buffer* buf, enum sec_status sec, char* why_bogus,
75038b
-	int was_ratelimited);
75038b
+	struct sldns_buffer* buf, enum sec_status sec, char* why_bogus);
75038b
 
75038b
 /*
75038b
  * Compares two 32-bit serial numbers as defined in RFC1982.  Returns
75038b
@@ -774,8 +772,7 @@ void auth_zone_verify_zonemd(struct auth_zone* z, struct module_env* env,
75038b
 
75038b
 /** mesh callback for zonemd on lookup of dnskey */
75038b
 void auth_zonemd_dnskey_lookup_callback(void* arg, int rcode,
75038b
-	struct sldns_buffer* buf, enum sec_status sec, char* why_bogus,
75038b
-	int was_ratelimited);
75038b
+	struct sldns_buffer* buf, enum sec_status sec, char* why_bogus);
75038b
 
75038b
 /**
75038b
  * Check the ZONEMD records that need online DNSSEC chain lookups,
ccb6a3
diff --git a/unbound-1.16.2/services/mesh.c b/unbound-1.16.2/services/mesh.c
ccb6a3
index 30bcf7c..fc3c690 100644
ccb6a3
--- a/unbound-1.16.2/services/mesh.c
ccb6a3
+++ b/unbound-1.16.2/services/mesh.c
75038b
@@ -63,6 +63,7 @@
75038b
 #include "util/data/dname.h"
75038b
 #include "respip/respip.h"
75038b
 #include "services/listen_dnsport.h"
75038b
+#include "libunbound/unbound-event.h"
75038b
 
75038b
 #ifdef CLIENT_SUBNET
75038b
 #include "edns-subnet/subnetmod.h"
ccb6a3
@@ -1012,7 +1013,7 @@ mesh_state_cleanup(struct mesh_state* mstate)
75038b
 			mstate->cb_list = cb->next;
75038b
 			fptr_ok(fptr_whitelist_mesh_cb(cb->cb));
75038b
 			(*cb->cb)(cb->cb_arg, LDNS_RCODE_SERVFAIL, NULL,
75038b
-				sec_status_unchecked, NULL, 0);
75038b
+				sec_status_unchecked, NULL);
75038b
 			log_assert(mesh->num_reply_addrs > 0);
75038b
 			mesh->num_reply_addrs--;
75038b
 		}
ccb6a3
@@ -1268,8 +1269,9 @@ mesh_do_callback(struct mesh_state* m, int rcode, struct reply_info* rep,
75038b
 					r->edns.opt_list_inplace_cb_out = NULL;
75038b
 		}
75038b
 		fptr_ok(fptr_whitelist_mesh_cb(r->cb));
75038b
-		(*r->cb)(r->cb_arg, rcode, r->buf, sec_status_unchecked, NULL,
75038b
-			was_ratelimited);
75038b
+		if (was_ratelimited)
75038b
+			rcode |= LDNS_RCODE_RATELIMITED;
75038b
+		(*r->cb)(r->cb_arg, rcode, r->buf, sec_status_unchecked, NULL);
75038b
 	} else {
75038b
 		size_t udp_size = r->edns.udp_size;
75038b
 		sldns_buffer_clear(r->buf);
ccb6a3
@@ -1287,11 +1289,14 @@ mesh_do_callback(struct mesh_state* m, int rcode, struct reply_info* rep,
75038b
 		{
75038b
 			fptr_ok(fptr_whitelist_mesh_cb(r->cb));
75038b
 			(*r->cb)(r->cb_arg, LDNS_RCODE_SERVFAIL, r->buf,
75038b
-				sec_status_unchecked, NULL, 0);
75038b
+				sec_status_unchecked, NULL);
75038b
 		} else {
75038b
 			fptr_ok(fptr_whitelist_mesh_cb(r->cb));
75038b
-			(*r->cb)(r->cb_arg, LDNS_RCODE_NOERROR, r->buf,
75038b
-				rep->security, reason, was_ratelimited);
75038b
+			rcode = LDNS_RCODE_NOERROR;
75038b
+			if (was_ratelimited)
75038b
+				rcode |= LDNS_RCODE_RATELIMITED;
75038b
+			(*r->cb)(r->cb_arg, rcode, r->buf,
75038b
+				rep->security, reason);
75038b
 		}
75038b
 	}
75038b
 	free(reason);
ccb6a3
diff --git a/unbound-1.16.2/services/mesh.h b/unbound-1.16.2/services/mesh.h
75038b
index 3be9b63..5050d6c 100644
ccb6a3
--- a/unbound-1.16.2/services/mesh.h
ccb6a3
+++ b/unbound-1.16.2/services/mesh.h
75038b
@@ -234,13 +234,20 @@ struct mesh_reply {
75038b
 	struct http2_stream* h2_stream;
75038b
 };
75038b
 
75038b
+/* RHEL 8 compatibility layer.
75038b
+ * Special rcode to send was_ratelimited to callback without adding
75038b
+ * extra parameter. It is ORed to the rcode parameter of the callback. */
75038b
+#define LDNS_RCODE_RATELIMITED 0x100
75038b
+#define RCODE_IS_RATELIMITED(rcode) ((rcode & LDNS_RCODE_RATELIMITED) != 0)
75038b
+#define RCODE_NOT_RATELIMITED(rcode) (rcode & ~LDNS_RCODE_RATELIMITED)
75038b
+
75038b
 /** 
75038b
  * Mesh result callback func.
75038b
  * called as func(cb_arg, rcode, buffer_with_reply, security, why_bogus,
75038b
  *		was_ratelimited);
75038b
  */
75038b
 typedef void (*mesh_cb_func_type)(void* cb_arg, int rcode, struct sldns_buffer*,
75038b
-	enum sec_status, char* why_bogus, int was_ratelimited);
75038b
+	enum sec_status, char* why_bogus);
75038b
 
75038b
 /**
75038b
  * Callback to result routine
ccb6a3
diff --git a/unbound-1.16.2/smallapp/worker_cb.c b/unbound-1.16.2/smallapp/worker_cb.c
75038b
index c689817..c7b1653 100644
ccb6a3
--- a/unbound-1.16.2/smallapp/worker_cb.c
ccb6a3
+++ b/unbound-1.16.2/smallapp/worker_cb.c
75038b
@@ -159,21 +159,21 @@ void libworker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
75038b
 
75038b
 void libworker_fg_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode), 
75038b
 	struct sldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s),
75038b
-	char* ATTR_UNUSED(why_bogus), int ATTR_UNUSED(was_ratelimited))
75038b
+	char* ATTR_UNUSED(why_bogus))
75038b
 {
75038b
 	log_assert(0);
75038b
 }
75038b
 
75038b
 void libworker_bg_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode), 
75038b
 	struct sldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s),
75038b
-	char* ATTR_UNUSED(why_bogus), int ATTR_UNUSED(was_ratelimited))
75038b
+	char* ATTR_UNUSED(why_bogus))
75038b
 {
75038b
 	log_assert(0);
75038b
 }
75038b
 
75038b
 void libworker_event_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode), 
75038b
 	struct sldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s),
75038b
-	char* ATTR_UNUSED(why_bogus), int ATTR_UNUSED(was_ratelimited))
75038b
+	char* ATTR_UNUSED(why_bogus))
75038b
 {
75038b
 	log_assert(0);
75038b
 }
ccb6a3
diff --git a/unbound-1.16.2/validator/autotrust.c b/unbound-1.16.2/validator/autotrust.c
75038b
index 3cdf9ce..40b3e35 100644
ccb6a3
--- a/unbound-1.16.2/validator/autotrust.c
ccb6a3
+++ b/unbound-1.16.2/validator/autotrust.c
75038b
@@ -2331,7 +2331,7 @@ autr_debug_print(struct val_anchors* anchors)
75038b
 
75038b
 void probe_answer_cb(void* arg, int ATTR_UNUSED(rcode), 
75038b
 	sldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(sec),
75038b
-	char* ATTR_UNUSED(why_bogus), int ATTR_UNUSED(was_ratelimited))
75038b
+	char* ATTR_UNUSED(why_bogus))
75038b
 {
75038b
 	/* retry was set before the query was done,
75038b
 	 * re-querytime is set when query succeeded, but that may not
ccb6a3
diff --git a/unbound-1.16.2/validator/autotrust.h b/unbound-1.16.2/validator/autotrust.h
75038b
index 057f2b6..c549798 100644
ccb6a3
--- a/unbound-1.16.2/validator/autotrust.h
ccb6a3
+++ b/unbound-1.16.2/validator/autotrust.h
75038b
@@ -206,6 +206,6 @@ void autr_debug_print(struct val_anchors* anchors);
75038b
 
75038b
 /** callback for query answer to 5011 probe */
75038b
 void probe_answer_cb(void* arg, int rcode, struct sldns_buffer* buf, 
75038b
-	enum sec_status sec, char* errinf, int was_ratelimited);
75038b
+	enum sec_status sec, char* errinf);
75038b
 
75038b
 #endif /* VALIDATOR_AUTOTRUST_H */
75038b
-- 
ccb6a3
2.37.1
75038b