summaryrefslogtreecommitdiff
path: root/src/feature/relay
diff options
context:
space:
mode:
Diffstat (limited to 'src/feature/relay')
-rw-r--r--src/feature/relay/dns.h39
-rw-r--r--src/feature/relay/include.am2
2 files changed, 40 insertions, 1 deletions
diff --git a/src/feature/relay/dns.h b/src/feature/relay/dns.h
index a2275c724a..4e5766af0c 100644
--- a/src/feature/relay/dns.h
+++ b/src/feature/relay/dns.h
@@ -12,6 +12,8 @@
#ifndef TOR_DNS_H
#define TOR_DNS_H
+#ifdef HAVE_MODULE_RELAY
+
int dns_init(void);
int has_dns_init_failed(void);
void dns_free_all(void);
@@ -29,6 +31,43 @@ size_t dns_cache_total_allocation(void);
void dump_dns_mem_usage(int severity);
size_t dns_cache_handle_oom(time_t now, size_t min_remove_bytes);
+#else /* !defined(HAVE_MODULE_RELAY) */
+
+#define dns_init() (0)
+#define dns_seems_to_be_broken() (0)
+#define has_dns_init_failed() (0)
+#define dns_cache_total_allocation() (0)
+
+#define dns_reset_correctness_checks() STMT_NIL
+
+#define assert_connection_edge_not_dns_pending(conn) \
+ ((void)(conn))
+#define dump_dns_mem_usage(severity)\
+ ((void)(severity))
+#define dns_cache_handle_oom(now, bytes) \
+ ((void)(now), (void)(bytes), 0)
+
+#define connection_dns_remove(conn) \
+ STMT_BEGIN \
+ (void)(conn); \
+ tor_assert_nonfatal_unreached(); \
+ STMT_END
+
+static inline int
+dns_reset(void)
+{
+ return 0;
+}
+static inline int
+dns_resolve(edge_connection_t *exitconn)
+{
+ (void)exitconn;
+ tor_assert_nonfatal_unreached();
+ return -1;
+}
+
+#endif /* defined(HAVE_MODULE_RELAY) */
+
#ifdef DNS_PRIVATE
#include "feature/relay/dns_structs.h"
diff --git a/src/feature/relay/include.am b/src/feature/relay/include.am
index a4c025ae12..ad81e60d75 100644
--- a/src/feature/relay/include.am
+++ b/src/feature/relay/include.am
@@ -1,7 +1,6 @@
# Legacy shared relay code: migrate to the relay module over time
LIBTOR_APP_A_SOURCES += \
- src/feature/relay/dns.c \
src/feature/relay/ext_orport.c \
src/feature/relay/onion_queue.c \
src/feature/relay/router.c \
@@ -12,6 +11,7 @@ LIBTOR_APP_A_SOURCES += \
# ADD_C_FILE: INSERT SOURCES HERE.
MODULE_RELAY_SOURCES = \
+ src/feature/relay/dns.c \
src/feature/relay/routermode.c \
src/feature/relay/relay_config.c \
src/feature/relay/relay_periodic.c \