commit fd5a72078cf405ae60ebe4ca608cbe2b203d0258
parent 05a762426681ce5e37c7f222c2337a4a1915286c
Author: David Goulet <dgoulet@torproject.org>
Date: Tue, 26 Jan 2021 15:31:21 -0500
dos: Add DoS subsystem to manager list
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat:
5 files changed, 62 insertions(+), 0 deletions(-)
diff --git a/src/app/main/subsystem_list.c b/src/app/main/subsystem_list.c
@@ -14,6 +14,7 @@
#include "lib/cc/torint.h"
#include "core/mainloop/mainloop_sys.h"
+#include "core/or/dos_sys.h"
#include "core/or/or_sys.h"
#include "feature/control/btrack_sys.h"
#include "lib/compress/compress_sys.h"
@@ -64,6 +65,7 @@ const subsys_fns_t *tor_subsystems[] = {
&sys_mainloop,
&sys_or,
+ &sys_dos,
&sys_relay,
&sys_hs,
diff --git a/src/core/or/dos.h b/src/core/or/dos.h
@@ -9,6 +9,8 @@
#ifndef TOR_DOS_H
#define TOR_DOS_H
+#include "core/or/or.h"
+
/* Structure that keeps stats of client connection per-IP. */
typedef struct cc_client_stats_t {
/* Number of allocated circuits remaining for this address. It is
diff --git a/src/core/or/dos_sys.c b/src/core/or/dos_sys.c
@@ -0,0 +1,34 @@
+/* Copyright (c) 2021, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * @file dos_sys.c
+ * @brief Subsystem definitions for DOS module.
+ **/
+
+#include "lib/subsys/subsys.h"
+
+#include "core/or/dos.h"
+#include "core/or/dos_sys.h"
+
+static int
+subsys_dos_initialize(void)
+{
+ return 0;
+}
+
+static void
+subsys_dos_shutdown(void)
+{
+}
+
+const struct subsys_fns_t sys_dos = {
+ SUBSYS_DECLARE_LOCATION(),
+
+ .name = "dos",
+ .supported = true,
+ .level = DOS_SUBSYS_LEVEL,
+
+ .initialize = subsys_dos_initialize,
+ .shutdown = subsys_dos_shutdown,
+};
diff --git a/src/core/or/dos_sys.h b/src/core/or/dos_sys.h
@@ -0,0 +1,22 @@
+/* Copyright (c) 2021, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * @file dos_sys.h
+ * @brief Header for core/or/dos_sys.c
+ **/
+
+#ifndef TOR_CORE_OR_DOS_SYS_H
+#define TOR_CORE_OR_DOS_SYS_H
+
+extern const struct subsys_fns_t sys_dos;
+
+/**
+ * Subsystem level for the metrics system.
+ *
+ * Defined here so that it can be shared between the real and stub
+ * definitions.
+ **/
+#define DOS_SUBSYS_LEVEL (21)
+
+#endif /* !defined(TOR_CORE_OR_DOS_SYS_H) */
diff --git a/src/core/or/include.am b/src/core/or/include.am
@@ -18,6 +18,7 @@ LIBTOR_APP_A_SOURCES += \
src/core/or/connection_edge.c \
src/core/or/connection_or.c \
src/core/or/dos.c \
+ src/core/or/dos_sys.c \
src/core/or/extendinfo.c \
src/core/or/onion.c \
src/core/or/ocirc_event.c \
@@ -64,6 +65,7 @@ noinst_HEADERS += \
src/core/or/crypt_path_st.h \
src/core/or/destroy_cell_queue_st.h \
src/core/or/dos.h \
+ src/core/or/dos_sys.h \
src/core/or/edge_connection_st.h \
src/core/or/extendinfo.h \
src/core/or/half_edge_st.h \