[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] dos: Add DoS subsystem to manager list



commit fd5a72078cf405ae60ebe4ca608cbe2b203d0258
Author: David Goulet <dgoulet@xxxxxxxxxxxxxx>
Date:   Tue Jan 26 15:31:21 2021 -0500

    dos: Add DoS subsystem to manager list
    
    Signed-off-by: David Goulet <dgoulet@xxxxxxxxxxxxxx>
---
 src/app/main/subsystem_list.c |  2 ++
 src/core/or/dos.h             |  2 ++
 src/core/or/dos_sys.c         | 34 ++++++++++++++++++++++++++++++++++
 src/core/or/dos_sys.h         | 22 ++++++++++++++++++++++
 src/core/or/include.am        |  2 ++
 5 files changed, 62 insertions(+)

diff --git a/src/app/main/subsystem_list.c b/src/app/main/subsystem_list.c
index cb79909e69..4b417f57e2 100644
--- 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
index b3eca058b8..62c3857409 100644
--- 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
new file mode 100644
index 0000000000..b25d45bc14
--- /dev/null
+++ 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
new file mode 100644
index 0000000000..2c9824a32a
--- /dev/null
+++ 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
index 7c42268c46..1308497092 100644
--- 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			\



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits