summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-09-13 17:00:55 +0200
committerdimitri staessens <dimitri.staessens@ugent.be>2017-09-13 17:22:28 +0200
commit0ed2ae85935be59b3fee5663a9906c4260cd64cc (patch)
treebddca1ad5b5a08ad6fb0a9ec096984e42afe0d38
parent888d3dbe7c3844d2efe9d6bc9823630db5d47a3b (diff)
downloadouroboros-0ed2ae85935be59b3fee5663a9906c4260cd64cc.tar.gz
ouroboros-0ed2ae85935be59b3fee5663a9906c4260cd64cc.zip
build: Fix DDNS tool detection for shim-udp
This fixes output when detecting DDNS tools and homogenizes output and the APIs used to pass variables between the build system and the sources. Fixes some minor issues and typos).
-rw-r--r--CMakeLists.txt2
-rw-r--r--include/ouroboros/wrap/CMakeLists.txt8
-rw-r--r--src/ipcpd/config.h.in1
-rw-r--r--src/ipcpd/shim-udp/CMakeLists.txt24
-rw-r--r--src/ipcpd/shim-udp/main.c16
-rw-r--r--src/lib/CMakeLists.txt11
6 files changed, 36 insertions, 26 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index db583144..642c391c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -85,7 +85,7 @@ endif ()
enable_testing()
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
-find_package(ProtobufC REQUIRED)
+find_package(ProtobufC REQUIRED QUIET)
include_directories(${PROTOBUF_C_INCLUDE_DIRS})
add_subdirectory(include)
diff --git a/include/ouroboros/wrap/CMakeLists.txt b/include/ouroboros/wrap/CMakeLists.txt
index 44c652d5..4ec42b9a 100644
--- a/include/ouroboros/wrap/CMakeLists.txt
+++ b/include/ouroboros/wrap/CMakeLists.txt
@@ -1,18 +1,20 @@
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_BINARY_DIR}/include)
-find_package(SWIG)
+find_package(SWIG QUIET)
if (NOT SWIG_FOUND)
- message(STATUS "SWIG not found: Bindings for other languages disabled")
+ message(STATUS "Install SWIG to enable bindings for other languages")
else ()
+ message(STATUS "SWIG support enabled")
include(${SWIG_USE_FILE})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_SWIG_FLAGS "")
- find_package(PythonLibs)
+ find_package(PythonLibs QUIET)
if (NOT PYTHONLIBS_FOUND)
message(STATUS "Python not found: Python bindings will not be built")
else ()
+ message(STATUS "Python found: Python bindings will be built")
include_directories(${PYTHON_INCLUDE_PATH})
# Python assumes C99 since Python 3.6
diff --git a/src/ipcpd/config.h.in b/src/ipcpd/config.h.in
index 0bef20be..6fb409b7 100644
--- a/src/ipcpd/config.h.in
+++ b/src/ipcpd/config.h.in
@@ -40,6 +40,7 @@
#define PFT_SIZE @PFT_SIZE@
/* shim-udp */
+#cmakedefine HAVE_DDNS
#define NSUPDATE_EXEC "@NSUPDATE_EXECUTABLE@"
#define NSLOOKUP_EXEC "@NSLOOKUP_EXECUTABLE@"
diff --git a/src/ipcpd/shim-udp/CMakeLists.txt b/src/ipcpd/shim-udp/CMakeLists.txt
index eff3f5d0..fb57778e 100644
--- a/src/ipcpd/shim-udp/CMakeLists.txt
+++ b/src/ipcpd/shim-udp/CMakeLists.txt
@@ -38,17 +38,25 @@ find_program(NSLOOKUP_EXECUTABLE
mark_as_advanced(NSLOOKUP_EXECUTABLE NSUPDATE_EXECUTABLE)
-include(AddCompileFlags)
-if (NOT NSUPDATE_EXECUTABLE)
- message(STATUS "Could not find nsupdate. Disabling DDNS functionality.")
-elseif (NOT NSLOOKUP_EXECUTABLE)
- message(STATUS "Could not find nslookup. Disabling DNS lookups.")
+if (NSLOOKUP_EXECUTABLE AND NSUPDATE_EXECUTABLE)
+ set(DISABLE_DDNS FALSE CACHE BOOL "Disable DDNS support")
+ if (NOT DISABLE_DNS)
+ message(STATUS "DDNS support enabled")
+ set(HAVE_DDNS TRUE CACHE INTERNAL "")
+ else ()
+ message(STATUS "DDNS support disabled by user")
+ endif ()
else ()
- message(STATUS "Found nsupdate: ${NSUPDATE_EXECUTABLE}")
- message(STATUS "Found nslookup: ${NSLOOKUP_EXECUTABLE}")
- add_compile_flags(ipcpd-shim-udp -DCONFIG_OUROBOROS_ENABLE_DNS)
+ if (NSLOOKUP_EXECUTABLE)
+ message(STATUS "Install nsupdate to enable DDNS support")
+ elseif (NSUPDATE_EXECUTABLE)
+ message(STATUS "Install nslookup to enable DDNS support")
+ else ()
+ message(STATUS "Install nslookup and nsupdate to enable DDNS support")
+ endif ()
endif ()
+include(AddCompileFlags)
if (CMAKE_BUILD_TYPE MATCHES Debug)
add_compile_flags(ipcpd-shim-udp -DCONFIG_OUROBOROS_DEBUG)
endif (CMAKE_BUILD_TYPE MATCHES Debug)
diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c
index a64c39c4..8f4bd80d 100644
--- a/src/ipcpd/shim-udp/main.c
+++ b/src/ipcpd/shim-udp/main.c
@@ -632,7 +632,7 @@ static int ipcp_udp_bootstrap(const struct ipcp_config * conf)
return 0;
}
-#ifdef CONFIG_OUROBOROS_ENABLE_DNS
+#ifdef HAVE_DDNS
/* FIXME: Dependency on nsupdate to be removed in the end */
/* NOTE: Disgusted with this crap */
static int ddns_send(char * cmd)
@@ -757,7 +757,7 @@ static uint32_t ddns_resolve(char * name,
static int ipcp_udp_reg(const uint8_t * hash)
{
-#ifdef CONFIG_OUROBOROS_ENABLE_DNS
+#ifdef HAVE_DDNS
char ipstr[INET_ADDRSTRLEN];
char dnsstr[INET_ADDRSTRLEN];
char cmd[1000];
@@ -776,7 +776,7 @@ static int ipcp_udp_reg(const uint8_t * hash)
return -1;
}
-#ifdef CONFIG_OUROBOROS_ENABLE_DNS
+#ifdef HAVE_DDNS
/* register application with DNS server */
dns_addr = udp_data.dns_addr;
@@ -810,7 +810,7 @@ static int ipcp_udp_reg(const uint8_t * hash)
static int ipcp_udp_unreg(const uint8_t * hash)
{
-#ifdef CONFIG_OUROBOROS_ENABLE_DNS
+#ifdef HAVE_DDNS
char dnsstr[INET_ADDRSTRLEN];
/* max DNS name length + max IP length + max command length */
char cmd[100];
@@ -822,7 +822,7 @@ static int ipcp_udp_unreg(const uint8_t * hash)
ipcp_hash_str(hashstr, hash);
-#ifdef CONFIG_OUROBOROS_ENABLE_DNS
+#ifdef HAVE_DDNS
/* unregister application with DNS server */
dns_addr = udp_data.dns_addr;
@@ -850,7 +850,7 @@ static int ipcp_udp_query(const uint8_t * hash)
{
uint32_t ip_addr = 0;
struct hostent * h;
-#ifdef CONFIG_OUROBOROS_ENABLE_DNS
+#ifdef HAVE_DDNS
uint32_t dns_addr = 0;
#endif
char hashstr[ipcp_dir_hash_strlen() + 1];
@@ -862,7 +862,7 @@ static int ipcp_udp_query(const uint8_t * hash)
if (shim_data_dir_has(udp_data.shim_data, hash))
return 0;
-#ifdef CONFIG_OUROBOROS_ENABLE_DNS
+#ifdef HAVE_DDNS
dns_addr = udp_data.dns_addr;
if (dns_addr != 0) {
@@ -880,7 +880,7 @@ static int ipcp_udp_query(const uint8_t * hash)
}
ip_addr = *((uint32_t *) (h->h_addr_list[0]));
-#ifdef CONFIG_OUROBOROS_ENABLE_DNS
+#ifdef HAVE_DDNS
}
#endif
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index f126a52a..5a09c52e 100644
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -41,7 +41,7 @@ if (HAVE_ROBUST_MUTEX)
endif ()
endif ()
-find_library(LIBGCRYPT_LIBRARIES gcrypt)
+find_library(LIBGCRYPT_LIBRARIES gcrypt QUIET)
if (LIBGCRYPT_LIBRARIES)
find_path(LIBGCRYPT_INCLUDE_DIR gcrypt.h
HINTS /usr/include /usr/local/include)
@@ -50,18 +50,17 @@ if (LIBGCRYPT_LIBRARIES)
REGEX "^#define GCRYPT_VERSION ")
string(REGEX REPLACE "^#define GCRYPT_VERSION \"(.*)\".*$" "\\1"
GCVER "${GCSTR}")
- message(STATUS "Found libgcrypt: ${LIBGCRYPT_LIBRARIES} "
- "(found version \"${GCVER}\")")
if (NOT GCVER VERSION_LESS "1.7.0")
set (DISABLE_LIBGCRYPT FALSE CACHE BOOL "Disable libgcrypt support")
if (NOT DISABLE_LIBGCRYPT)
message(STATUS "libgcrypt support enabled")
set(HAVE_LIBGCRYPT TRUE)
else ()
- message(STATUS "libgcrpyt support disabled by user")
+ message(STATUS "libgcrypt support disabled by user")
endif()
else ()
- message(STATUS "Install version > \"1.7.0\" to enable libgcrypt support")
+ message(STATUS "Install version > \"1.7.0\" to enable libgcrypt support "
+ "(found version \"${GCVER})\"")
endif()
endif ()
endif ()
@@ -71,7 +70,7 @@ if (NOT HAVE_LIBGCRYPT)
set(LIBGCRYPT_INCLUDE_DIR "")
endif ()
-find_package(OpenSSL)
+find_package(OpenSSL QUIET)
if (OPENSSL_FOUND)
set (DISABLE_OPENSSL FALSE CACHE BOOL "Disable OpenSSL support")
if (NOT DISABLE_OPENSSL)