[tor-commits] [tor/master] Make ext_orport.c relay-mode-only.
nickm at torproject.org
nickm at torproject.org
Wed Feb 19 18:55:40 UTC 2020
commit a1a3a4d5854e1d44ab7ca7e2a117753a8284a704
Author: Nick Mathewson <nickm at torproject.org>
Date: Tue Feb 18 13:20:19 2020 -0500
Make ext_orport.c relay-mode-only.
---
changes/ticket33368 | 3 +++
src/feature/relay/ext_orport.h | 37 +++++++++++++++++++++++++++++++++++++
src/feature/relay/include.am | 2 +-
3 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/changes/ticket33368 b/changes/ticket33368
new file mode 100644
index 000000000..ecc6f66f4
--- /dev/null
+++ b/changes/ticket33368
@@ -0,0 +1,3 @@
+ o Minor features (client-only compilation):
+ - Disable more code related to the ext_orport protocol when compiling
+ without support for relay mode. Closes ticket 33368.
diff --git a/src/feature/relay/ext_orport.h b/src/feature/relay/ext_orport.h
index d44c97be8..cf13c5d42 100644
--- a/src/feature/relay/ext_orport.h
+++ b/src/feature/relay/ext_orport.h
@@ -31,6 +31,8 @@
#define EXT_OR_CONN_STATE_FLUSHING 5
#define EXT_OR_CONN_STATE_MAX_ 5
+#ifdef HAVE_MODULE_RELAY
+
int connection_ext_or_start_auth(or_connection_t *or_conn);
void connection_or_set_ext_or_identifier(or_connection_t *conn);
@@ -45,6 +47,41 @@ int init_ext_or_cookie_authentication(int is_enabled);
char *get_ext_or_auth_cookie_file_name(void);
void ext_orport_free_all(void);
+#else /* !defined(HAVE_MODULE_RELAY) */
+
+static inline int
+connection_ext_or_start_auth(or_connection_t *conn)
+{
+ (void)conn;
+ tor_assert_nonfatal_unreached();
+ return -1;
+}
+static inline int
+connection_ext_or_finished_flushing(or_connection_t *conn)
+{
+ (void)conn;
+ tor_assert_nonfatal_unreached();
+ return -1;
+}
+static inline int
+connection_ext_or_process_inbuf(or_connection_t *conn)
+{
+ (void)conn;
+ tor_assert_nonfatal_unreached();
+ return -1;
+}
+#define connection_or_set_ext_or_identifier(conn) \
+ ((void)(conn))
+#define connection_or_remove_from_ext_or_id_map(conn) \
+ ((void)(conn))
+#define connection_or_clear_ext_or_id_map() \
+ STMT_NIL
+
+#define get_ext_or_auth_cookie_file_name() \
+ (NULL)
+
+#endif /* defined(HAVE_MODULE_RELAY) */
+
#ifdef EXT_ORPORT_PRIVATE
STATIC int connection_write_ext_or_command(connection_t *conn,
uint16_t command,
diff --git a/src/feature/relay/include.am b/src/feature/relay/include.am
index a4c025ae1..1cfc0961b 100644
--- a/src/feature/relay/include.am
+++ b/src/feature/relay/include.am
@@ -2,7 +2,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 \
src/feature/relay/routerkeys.c \
@@ -12,6 +11,7 @@ LIBTOR_APP_A_SOURCES += \
# ADD_C_FILE: INSERT SOURCES HERE.
MODULE_RELAY_SOURCES = \
+ src/feature/relay/ext_orport.c \
src/feature/relay/routermode.c \
src/feature/relay/relay_config.c \
src/feature/relay/relay_periodic.c \
More information about the tor-commits
mailing list