From 822d8ad7038b09802fa379eeccf8f53ea7667fe1 Mon Sep 17 00:00:00 2001 From: Jim Hague Date: Tue, 3 Mar 2020 17:28:34 +0000 Subject: [PATCH 1/3] Revise recent lookup3.c update to restore building on Windows. As we're now building with CMake, and CMake can supply endianness, just insist on using that. --- src/util/lookup3.c | 57 ++++++++++------------------------------------ 1 file changed, 12 insertions(+), 45 deletions(-) diff --git a/src/util/lookup3.c b/src/util/lookup3.c index bb25eb43..5a826193 100644 --- a/src/util/lookup3.c +++ b/src/util/lookup3.c @@ -53,21 +53,18 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy. #include "util/storage/lookup3.h" #include /* defines printf for tests */ #include /* defines time_t for timings in the test */ -/*#include defines uint32_t etc (from config.h) */ -#include /* attempt to define endianness */ -#ifdef HAVE_SYS_TYPES_H -# include /* attempt to define endianness (solaris) */ -#endif -#if defined(linux) || defined(__OpenBSD__) -# ifdef HAVE_ENDIAN_H -# include /* attempt to define endianness */ -# else -# include /* on older OpenBSD */ -# endif -#endif -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) -#include /* attempt to define endianness */ -#endif + +#if defined(HAVE_TARGET_ENDIANNESS) +# if defined(TARGET_IS_BIG_ENDIAN) +# define HASH_LITTLE_ENDIAN 0 +# define HASH_BIG_ENDIAN 1 +# else +# define HASH_LITTLE_ENDIAN 1 +# define HASH_BIG_ENDIAN 0 +# endif +#else +# error "Target endianness required." +#endif /* defined(HAVE_TARGET_ENDIANNESS) */ /* random initial value */ static uint32_t raninit = (uint32_t)0xdeadbeef; @@ -78,36 +75,6 @@ hash_set_raninit(uint32_t v) raninit = v; } -/* - * My best guess at if you are big-endian or little-endian. This may - * need adjustment. - */ -#if (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && \ - __BYTE_ORDER == __LITTLE_ENDIAN) || \ - (defined(i386) || defined(__i386__) || defined(__i486__) || \ - defined(__i586__) || defined(__i686__) || defined(vax) || defined(MIPSEL) || defined(__x86)) -# define HASH_LITTLE_ENDIAN 1 -# define HASH_BIG_ENDIAN 0 -#elif (defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && \ - __BYTE_ORDER == __BIG_ENDIAN) || \ - (defined(sparc) || defined(__sparc) || defined(__sparc__) || defined(POWERPC) || defined(mc68000) || defined(sel)) -# define HASH_LITTLE_ENDIAN 0 -# define HASH_BIG_ENDIAN 1 -#elif defined(_MACHINE_ENDIAN_H_) -/* test for machine_endian_h protects failure if some are empty strings */ -# if defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && _BYTE_ORDER == _BIG_ENDIAN -# define HASH_LITTLE_ENDIAN 0 -# define HASH_BIG_ENDIAN 1 -# endif -# if defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN) && _BYTE_ORDER == _LITTLE_ENDIAN -# define HASH_LITTLE_ENDIAN 1 -# define HASH_BIG_ENDIAN 0 -# endif /* _MACHINE_ENDIAN_H_ */ -#else -# define HASH_LITTLE_ENDIAN 0 -# define HASH_BIG_ENDIAN 0 -#endif - #define hashsize(n) ((uint32_t)1<<(n)) #define hashmask(n) (hashsize(n)-1) #define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) From f01e7188c8c5253449ff6774b195b9d1152eeeb7 Mon Sep 17 00:00:00 2001 From: Jim Hague Date: Wed, 4 Mar 2020 09:45:52 +0000 Subject: [PATCH 2/3] CMake libunbound fixups. 1. ub_ctx_set_stub is in unbound.h, not unbound-events.h. 2. Only bother looking for unbound event API if enabled. 3. If building stub only, ensure all libunbound items are off. This is necessary in case we first configure without stub only, and then change to stub only. Fixes #463 --- CMakeLists.txt | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d22d3ca..10d10b99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -489,9 +489,19 @@ if (NOT ENABLE_STUB_ONLY) set(CMAKE_REQUIRED_INCLUDES ${LIBUNBOUND_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES ${LIBUNBOUND_LIBRARIES}) - check_include_file(unbound-event.h HAVE_UNBOUND_EVENT_H) - check_symbol_exists(ub_ctx_create_ub_event "unbound-event.h" HAVE_UNBOUND_EVENT_API) - check_symbol_exists(ub_ctx_set_stub "unbound-event.h" HAVE_UB_CTX_SET_STUB) + + check_symbol_exists(ub_ctx_set_stub "unbound.h" HAVE_UB_CTX_SET_STUB) + + if (ENABLE_UNBOUND_EVENT_API) + check_include_file(unbound-event.h HAVE_UNBOUND_EVENT_H) + check_symbol_exists(ub_ctx_create_ub_event "unbound-event.h" HAVE_UNBOUND_EVENT_API) + endif () +else () + # Ensure we're not using libunbound items. + set(HAVE_LIBUNBOUND 0) + set(HAVE_UNBOUND_EVENT_H 0) + set(HAVE_UNBOUND_EVENT_API 0) + set(HAVE_UB_CTX_SET_STUB 0) endif () # Event loop extension From e96e33493244d54dd7cc816791fdc8a544ad9031 Mon Sep 17 00:00:00 2001 From: Jim Hague Date: Wed, 4 Mar 2020 15:30:26 +0000 Subject: [PATCH 3/3] Point ssl_dane submodule back at getdnsapi version. --- .gitmodules | 4 ++-- src/ssl_dane | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 28d6a265..26a1f354 100644 --- a/.gitmodules +++ b/.gitmodules @@ -12,5 +12,5 @@ branch = develop [submodule "src/ssl_dane"] path = src/ssl_dane - url = https://github.com/banburybill/ssl_dane - branch = feature/windows-native-build + url = https://github.com/getdnsapi/ssl_dane + branch = getdns diff --git a/src/ssl_dane b/src/ssl_dane index 18783810..afd5b886 160000 --- a/src/ssl_dane +++ b/src/ssl_dane @@ -1 +1 @@ -Subproject commit 187838104f3cfc9634148ae41a717e00c0d68e67 +Subproject commit afd5b88687f05554513d9caf000f08904e32e6a4