601e9c
From fbde301c2706a5d0c9c3942fe84693f2b7a6b16c Mon Sep 17 00:00:00 2001
601e9c
From: Petr Mensik <pemensik@redhat.com>
601e9c
Date: Sat, 7 May 2022 10:05:33 +0200
601e9c
Subject: [PATCH] Use reserved RCODE, fake source version
601e9c
601e9c
Use RCODE value assigned for a private use. Previous value were possible
601e9c
returned value.
601e9c
601e9c
Fake source version to be still 1.7.x. Hide real version into micro
601e9c
version component and export it also in a proper way with _REAL
601e9c
suffixes. Should workaround any source code detection to support correct
601e9c
callback format. Fixes compilation error in libreswan.
601e9c
601e9c
Use preprocessed unbound.h to prevent failures
601e9c
601e9c
Swig complains about wrong @ variable formats. Make it use preprocessed
601e9c
header instead of a template.
601e9c
---
601e9c
 libunbound/python/libunbound.i |  4 ++--
601e9c
 libunbound/unbound.h           | 13 ++++++++++---
601e9c
 services/mesh.h                |  2 +-
601e9c
 3 files changed, 13 insertions(+), 6 deletions(-)
601e9c
601e9c
diff --git a/libunbound/python/libunbound.i b/libunbound/python/libunbound.i
601e9c
index c9549bf90..f01e9111e 100644
601e9c
--- a/libunbound/python/libunbound.i
601e9c
+++ b/libunbound/python/libunbound.i
601e9c
@@ -53,7 +53,7 @@
601e9c
    #ifdef HAVE_ARPA_INET_H
601e9c
    #include <arpa/inet.h>
601e9c
    #endif
601e9c
-   #include "libunbound/unbound.h"
601e9c
+   #include "unbound.h"
601e9c
 %}
601e9c
 
601e9c
 %pythoncode %{
601e9c
@@ -855,7 +855,7 @@ Result: ['74.125.43.147', '74.125.43.99', '74.125.43.103', '74.125.43.104']
601e9c
   //printf("resolve_stop()\n");
601e9c
 %} 
601e9c
 
601e9c
-%include "libunbound/unbound.h"
601e9c
+%include "unbound.h"
601e9c
 
601e9c
 %inline %{
601e9c
   //SWIG will see the ub_ctx as a class
601e9c
diff --git a/libunbound/unbound.h b/libunbound/unbound.h
601e9c
index c822d3f89..82660bd51 100644
601e9c
--- a/libunbound/unbound.h
601e9c
+++ b/libunbound/unbound.h
601e9c
@@ -102,9 +102,16 @@ extern "C" {
601e9c
 #endif
601e9c
 
601e9c
 /** the version of this header file */
601e9c
-#define UNBOUND_VERSION_MAJOR @UNBOUND_VERSION_MAJOR@
601e9c
-#define UNBOUND_VERSION_MINOR @UNBOUND_VERSION_MINOR@
601e9c
-#define UNBOUND_VERSION_MICRO @UNBOUND_VERSION_MICRO@
601e9c
+/* Because of RHEL compat change, callback type remains at
601e9c
+ * 1.7.3 version. To prevent source-level incompatibility,
601e9c
+ * fake still old version. Export real version in _REAL
601e9c
+ * suffix definitions. */
601e9c
+#define UNBOUND_VERSION_MAJOR 1
601e9c
+#define UNBOUND_VERSION_MINOR 7
601e9c
+#define UNBOUND_VERSION_MICRO @UNBOUND_VERSION_MAJOR@@UNBOUND_VERSION_MINOR@@UNBOUND_VERSION_MICRO@
601e9c
+#define UNBOUND_VERSION_MAJOR_REAL @UNBOUND_VERSION_MAJOR@
601e9c
+#define UNBOUND_VERSION_MINOR_REAL @UNBOUND_VERSION_MINOR@
601e9c
+#define UNBOUND_VERSION_MICRO_REAL @UNBOUND_VERSION_MICRO@
601e9c
 
601e9c
 /**
601e9c
  * The validation context is created to hold the resolver status,
601e9c
diff --git a/services/mesh.h b/services/mesh.h
601e9c
index 9c6f958ff..c0cbf355e 100644
601e9c
--- a/services/mesh.h
601e9c
+++ b/services/mesh.h
601e9c
@@ -237,7 +237,7 @@ struct mesh_reply {
601e9c
 /* RHEL 8 compatibility layer.
601e9c
  * Special rcode to send was_ratelimited to callback without adding
601e9c
  * extra parameter. It is ORed to the rcode parameter of the callback. */
601e9c
-#define LDNS_RCODE_RATELIMITED 0x100
601e9c
+#define LDNS_RCODE_RATELIMITED 0xf80
601e9c
 #define RCODE_IS_RATELIMITED(rcode) ((rcode & LDNS_RCODE_RATELIMITED) != 0)
601e9c
 #define RCODE_NOT_RATELIMITED(rcode) (rcode & ~LDNS_RCODE_RATELIMITED)
601e9c
 
601e9c
-- 
601e9c
2.34.1
601e9c