summaryrefslogtreecommitdiff
path: root/src/ipcpd/shim-udp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipcpd/shim-udp')
-rw-r--r--src/ipcpd/shim-udp/CMakeLists.txt24
-rw-r--r--src/ipcpd/shim-udp/main.c16
2 files changed, 24 insertions, 16 deletions
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