dos: Add DoS subsystem to manager list

Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
David Goulet
2021-01-26 15:31:21 -05:00
parent 05a7624266
commit fd5a72078c
5 changed files with 62 additions and 0 deletions
+2
View File
@@ -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,
+2
View File
@@ -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
+34
View File
@@ -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,
};
+22
View File
@@ -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) */
+2
View File
@@ -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 \