Commit b54a5e70 authored by Nick Mathewson's avatar Nick Mathewson 🦀
Browse files

Split most of dirserv.c into several new modules

In dirauth:
  * bwauth.c reads and uses bandwidth files
  * guardfraction.c reads and uses the guardfraction file
  * reachability.c tests relay reachability
  * recommend_pkg.c handles the recommended-packages lines.
  * recv_descs.c handles fingerprint files and processing incoming
    routerinfos that relays upload to us
  * voteflag.c computes flag thresholds and sets those thresholds on
    routerstatuses when computing votes

In control:
  * fmt_serverstatus.c generates the ancient "v1 server status"
    format that controllers expect.

In nodelist:
  * routerstatus_fmt.c formats routerstatus entries for a consensus,
    a vote, or for the controller.
parent 08e3b88f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -87,7 +87,9 @@
#else
#include "lib/crypt_ops/crypto_openssl_mgt.h"
#endif
#include "feature/dirauth/bwauth.h"
#include "feature/dircache/dirserv.h"
#include "feature/dirauth/guardfraction.h"
#include "feature/relay/dns.h"
#include "core/or/dos.h"
#include "feature/client/entrynodes.h"
@@ -141,6 +143,7 @@
#include "lib/evloop/procmon.h"

#include "feature/dirauth/dirvote.h"
#include "feature/dirauth/recommend_pkg.h"
#include "feature/dirauth/mode.h"

#include "core/or/connection_st.h"
+20 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ LIBTOR_APP_A_SOURCES = \
	src/feature/client/entrynodes.c		\
	src/feature/client/transports.c		\
	src/feature/control/control.c		\
	src/feature/control/fmt_serverstatus.c  \
	src/feature/dirauth/keypin.c		\
	src/feature/dircache/conscache.c	\
	src/feature/dircache/consdiffmgr.c	\
@@ -90,6 +91,7 @@ LIBTOR_APP_A_SOURCES = \
	src/feature/nodelist/routerlist.c	\
	src/feature/nodelist/routerparse.c	\
	src/feature/nodelist/routerset.c	\
	src/feature/nodelist/fmt_routerstatus.c	\
	src/feature/nodelist/torcert.c		\
	src/feature/relay/dns.c			\
	src/feature/relay/ext_orport.c		\
@@ -103,6 +105,16 @@ LIBTOR_APP_A_SOURCES = \
	src/feature/stats/geoip.c		\
	src/feature/stats/rephist.c

# These should eventually move into module_dirauth_sources, but for now
# the separation is only in the code location.
LIBTOR_APP_A_SOURCES += 			\
	src/feature/dirauth/bwauth.c		\
	src/feature/dirauth/guardfraction.c	\
	src/feature/dirauth/reachability.c	\
	src/feature/dirauth/recommend_pkg.c	\
	src/feature/dirauth/process_descs.c	\
	src/feature/dirauth/voteflags.c

if BUILD_NT_SERVICES
LIBTOR_APP_A_SOURCES += src/app/main/ntmain.c
endif
@@ -222,14 +234,21 @@ noinst_HEADERS += \
	src/feature/client/transports.h			\
	src/feature/control/control.h			\
	src/feature/control/control_connection_st.h	\
	src/feature/control/fmt_serverstatus.h		\
	src/feature/dirauth/bwauth.h			\
	src/feature/dirauth/dircollate.h		\
	src/feature/dirauth/dirvote.h			\
	src/feature/dirauth/guardfraction.h		\
	src/feature/dirauth/keypin.h			\
	src/feature/dirauth/mode.h			\
	src/feature/dirauth/ns_detached_signatures_st.h	\
	src/feature/dirauth/reachability.h		\
	src/feature/dirauth/recommend_pkg.h		\
	src/feature/dirauth/process_descs.h		\
	src/feature/dirauth/shared_random.h		\
	src/feature/dirauth/shared_random_state.h	\
	src/feature/dirauth/vote_microdesc_hash_st.h	\
	src/feature/dirauth/voteflags.h			\
	src/feature/dircache/cached_dir_st.h		\
	src/feature/dircache/conscache.h		\
	src/feature/dircache/consdiffmgr.h		\
@@ -280,6 +299,7 @@ noinst_HEADERS += \
	src/feature/nodelist/routerlist_st.h		\
	src/feature/nodelist/routerparse.h		\
	src/feature/nodelist/routerset.h		\
	src/feature/nodelist/fmt_routerstatus.h		\
	src/feature/nodelist/routerstatus_st.h		\
	src/feature/nodelist/signed_descriptor_st.h	\
	src/feature/nodelist/torcert.h			\
+5 −0
Original line number Diff line number Diff line
@@ -74,6 +74,9 @@
#include "lib/crypt_ops/crypto_rand.h"
#include "feature/dircache/directory.h"
#include "feature/dircache/dirserv.h"
#include "feature/dirauth/bwauth.h"
#include "feature/dirauth/reachability.h"
#include "feature/dirauth/process_descs.h"
#include "feature/relay/dns.h"
#include "feature/client/dnsserv.h"
#include "core/or/dos.h"
@@ -3663,7 +3666,9 @@ tor_free_all(int postfork)
  routerlist_free_all();
  networkstatus_free_all();
  addressmap_free_all();
  dirserv_free_fingerprint_list();
  dirserv_free_all();
  dirserv_clear_measured_bw_cache();
  rend_cache_free_all();
  rend_service_authorization_free_all();
  rep_hist_free_all();
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@
#include "feature/control/control.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h"
#include "feature/dircache/dirserv.h"
#include "feature/dirauth/reachability.h"
#include "feature/client/entrynodes.h"
#include "feature/stats/geoip.h"
#include "core/mainloop/main.h"
+3 −1
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@
#include "core/or/or.h"
#include "feature/client/bridges.h"
#include "app/config/config.h"
#include "feature/dircache/dirserv.h"
#include "feature/nodelist/microdesc.h"
#include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h"
@@ -39,6 +38,9 @@
#include "feature/nodelist/routerinfo_st.h"
#include "feature/nodelist/routerstatus_st.h"

/** Maximum length of an exit policy summary. */
#define MAX_EXITPOLICY_SUMMARY_LEN 1000

/** Policy that addresses for incoming SOCKS connections must match. */
static smartlist_t *socks_policy = NULL;
/** Policy that addresses for incoming directory connections must match. */
Loading