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

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