commit 50369f8981e8ce0894753daeea3dc28ab01f2667
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 13:45:15 2018 -0400
Extract networkstatus_t and ..sr_info_t into their own headers
---
src/or/consdiffmgr.c | 1 +
src/or/control.c | 1 +
src/or/dirauth/dircollate.c | 1 +
src/or/dirauth/dirvote.c | 1 +
src/or/dirauth/shared_random.c | 2 +
src/or/directory.c | 1 +
src/or/hs_cache.c | 2 +
src/or/hs_common.c | 1 +
src/or/hs_service.c | 1 +
src/or/include.am | 2 +
src/or/main.c | 1 +
src/or/microdesc.c | 1 +
src/or/networkstatus.c | 1 +
src/or/networkstatus_sr_info_st.h | 23 ++++++++++
src/or/networkstatus_st.h | 95 +++++++++++++++++++++++++++++++++++++++
src/or/nodelist.c | 1 +
src/or/or.h | 95 +--------------------------------------
src/or/rendcommon.c | 1 +
src/or/rendservice.c | 1 +
src/or/rephist.c | 1 +
src/or/routerlist.c | 1 +
src/or/routerparse.c | 1 +
src/or/shared_random_client.c | 2 +
src/or/voting_schedule.c | 2 +
src/test/fuzz/fuzz_vrs.c | 1 +
src/test/test_address_set.c | 2 +
src/test/test_channel.c | 1 +
src/test/test_channelpadding.c | 1 +
src/test/test_consdiffmgr.c | 2 +
src/test/test_dir.c | 1 +
src/test/test_dir_common.c | 1 +
src/test/test_dir_handle_get.c | 1 +
src/test/test_dos.c | 1 +
src/test/test_entrynodes.c | 1 +
src/test/test_guardfraction.c | 1 +
src/test/test_hs_cache.c | 1 +
src/test/test_hs_client.c | 1 +
src/test/test_hs_common.c | 1 +
src/test/test_hs_service.c | 1 +
src/test/test_microdesc.c | 2 +
src/test/test_nodelist.c | 1 +
src/test/test_routerlist.c | 1 +
src/test/test_shared_random.c | 1 +
43 files changed, 168 insertions(+), 93 deletions(-)
diff --git a/src/or/consdiffmgr.c b/src/or/consdiffmgr.c
index b90660e6c..f1b7601ca 100644
--- a/src/or/consdiffmgr.c
+++ b/src/or/consdiffmgr.c
@@ -23,6 +23,7 @@
#include "routerparse.h"
#include "workqueue.h"
+#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
/**
diff --git a/src/or/control.c b/src/or/control.c
index ee79dfcd5..0afd6cf97 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -84,6 +84,7 @@
#include "control_connection_st.h"
#include "cpath_build_state_st.h"
#include "entry_connection_st.h"
+#include "networkstatus_st.h"
#include "node_st.h"
#include "or_connection_st.h"
#include "or_circuit_st.h"
diff --git a/src/or/dirauth/dircollate.c b/src/or/dirauth/dircollate.c
index 388885fe0..81f0bf31e 100644
--- a/src/or/dirauth/dircollate.c
+++ b/src/or/dirauth/dircollate.c
@@ -25,6 +25,7 @@
#include "dircollate.h"
#include "dirvote.h"
+#include "networkstatus_st.h"
#include "vote_routerstatus_st.h"
static void dircollator_collate_by_ed25519(dircollator_t *dc);
diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c
index 5dee8a879..aa30a11f5 100644
--- a/src/or/dirauth/dirvote.c
+++ b/src/or/dirauth/dirvote.c
@@ -30,6 +30,7 @@
#include "dir_server_st.h"
#include "document_signature_st.h"
+#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "node_st.h"
#include "vote_microdesc_hash_st.h"
diff --git a/src/or/dirauth/shared_random.c b/src/or/dirauth/shared_random.c
index 6dd1f330e..137f695db 100644
--- a/src/or/dirauth/shared_random.c
+++ b/src/or/dirauth/shared_random.c
@@ -105,6 +105,8 @@
#include "dirauth/dirvote.h"
#include "dirauth/mode.h"
+#include "networkstatus_st.h"
+
/* String prefix of shared random values in votes/consensuses. */
static const char previous_srv_str[] = "shared-rand-previous-value";
static const char current_srv_str[] = "shared-rand-current-value";
diff --git a/src/or/directory.c b/src/or/directory.c
index 8392dd81f..b5a07f6b3 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -57,6 +57,7 @@
#include "dir_connection_st.h"
#include "dir_server_st.h"
#include "entry_connection_st.h"
+#include "networkstatus_st.h"
#include "node_st.h"
#include "rend_service_descriptor_st.h"
diff --git a/src/or/hs_cache.c b/src/or/hs_cache.c
index ecc845d17..092d944b8 100644
--- a/src/or/hs_cache.c
+++ b/src/or/hs_cache.c
@@ -21,6 +21,8 @@
#include "hs_cache.h"
+#include "networkstatus_st.h"
+
static int cached_client_descriptor_has_expired(time_t now,
const hs_cache_client_descriptor_t *cached_desc);
diff --git a/src/or/hs_common.c b/src/or/hs_common.c
index c5f59059e..e5d15a1b1 100644
--- a/src/or/hs_common.c
+++ b/src/or/hs_common.c
@@ -34,6 +34,7 @@
#include "dirauth/shared_random_state.h"
#include "edge_connection_st.h"
+#include "networkstatus_st.h"
#include "node_st.h"
#include "origin_circuit_st.h"
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index 90e607225..007c84caf 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -41,6 +41,7 @@
#include "dir_connection_st.h"
#include "edge_connection_st.h"
+#include "networkstatus_st.h"
#include "node_st.h"
#include "origin_circuit_st.h"
diff --git a/src/or/include.am b/src/or/include.am
index 6ced3e155..e6f23e916 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -248,6 +248,8 @@ ORHEADERS = \
src/or/main.h \
src/or/microdesc.h \
src/or/networkstatus.h \
+ src/or/networkstatus_st.h \
+ src/or/networkstatus_sr_info_st.h \
src/or/networkstatus_voter_info_st.h \
src/or/nodelist.h \
src/or/node_st.h \
diff --git a/src/or/main.c b/src/or/main.c
index 0daebfc4f..73c23ee98 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -123,6 +123,7 @@
#include "dirauth/shared_random.h"
#include "entry_connection_st.h"
+#include "networkstatus_st.h"
#include "or_connection_st.h"
#include "port_cfg_st.h"
#include "socks_request_st.h"
diff --git a/src/or/microdesc.c b/src/or/microdesc.c
index f06c4bd2a..208f35b1c 100644
--- a/src/or/microdesc.c
+++ b/src/or/microdesc.c
@@ -22,6 +22,7 @@
#include "routerlist.h"
#include "routerparse.h"
+#include "networkstatus_st.h"
#include "node_st.h"
/** A data structure to hold a bunch of cached microdescriptors. There are
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 11021a7ea..8ad1bb25b 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -77,6 +77,7 @@
#include "dir_connection_st.h"
#include "dir_server_st.h"
#include "document_signature_st.h"
+#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "node_st.h"
#include "vote_microdesc_hash_st.h"
diff --git a/src/or/networkstatus_sr_info_st.h b/src/or/networkstatus_sr_info_st.h
new file mode 100644
index 000000000..3b2690f0a
--- /dev/null
+++ b/src/or/networkstatus_sr_info_st.h
@@ -0,0 +1,23 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef NETWORKSTATUS_SR_INFO_ST_H
+#define NETWORKSTATUS_SR_INFO_ST_H
+
+struct networkstatus_sr_info_t {
+ /* Indicate if the dirauth partitipates in the SR protocol with its vote.
+ * This is tied to the SR flag in the vote. */
+ unsigned int participate:1;
+ /* Both vote and consensus: Current and previous SRV. If list is empty,
+ * this means none were found in either the consensus or vote. */
+ struct sr_srv_t *previous_srv;
+ struct sr_srv_t *current_srv;
+ /* Vote only: List of commitments. */
+ smartlist_t *commits;
+};
+
+#endif
+
diff --git a/src/or/networkstatus_st.h b/src/or/networkstatus_st.h
new file mode 100644
index 000000000..81965395a
--- /dev/null
+++ b/src/or/networkstatus_st.h
@@ -0,0 +1,95 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef NETWORKSTATUS_ST_H
+#define NETWORKSTATUS_ST_H
+
+#include "networkstatus_sr_info_st.h"
+
+/** A common structure to hold a v3 network status vote, or a v3 network
+ * status consensus. */
+struct networkstatus_t {
+ networkstatus_type_t type; /**< Vote, consensus, or opinion? */
+ consensus_flavor_t flavor; /**< If a consensus, what kind? */
+ unsigned int has_measured_bws : 1;/**< True iff this networkstatus contains
+ * measured= bandwidth values. */
+
+ time_t published; /**< Vote only: Time when vote was written. */
+ time_t valid_after; /**< Time after which this vote or consensus applies. */
+ time_t fresh_until; /**< Time before which this is the most recent vote or
+ * consensus. */
+ time_t valid_until; /**< Time after which this vote or consensus should not
+ * be used. */
+
+ /** Consensus only: what method was used to produce this consensus? */
+ int consensus_method;
+ /** Vote only: what methods is this voter willing to use? */
+ smartlist_t *supported_methods;
+
+ /** List of 'package' lines describing hashes of downloadable packages */
+ smartlist_t *package_lines;
+
+ /** How long does this vote/consensus claim that authorities take to
+ * distribute their votes to one another? */
+ int vote_seconds;
+ /** How long does this vote/consensus claim that authorities take to
+ * distribute their consensus signatures to one another? */
+ int dist_seconds;
+
+ /** Comma-separated list of recommended client software, or NULL if this
+ * voter has no opinion. */
+ char *client_versions;
+ char *server_versions;
+
+ /** Lists of subprotocol versions which are _recommended_ for relays and
+ * clients, or which are _require_ for relays and clients. Tor shouldn't
+ * make any more network connections if a required protocol is missing.
+ */
+ char *recommended_relay_protocols;
+ char *recommended_client_protocols;
+ char *required_relay_protocols;
+ char *required_client_protocols;
+
+ /** List of flags that this vote/consensus applies to routers. If a flag is
+ * not listed here, the voter has no opinion on what its value should be. */
+ smartlist_t *known_flags;
+
+ /** List of key=value strings for the parameters in this vote or
+ * consensus, sorted by key. */
+ smartlist_t *net_params;
+
+ /** List of key=value strings for the bw weight parameters in the
+ * consensus. */
+ smartlist_t *weight_params;
+
+ /** List of networkstatus_voter_info_t. For a vote, only one element
+ * is included. For a consensus, one element is included for every voter
+ * whose vote contributed to the consensus. */
+ smartlist_t *voters;
+
+ struct authority_cert_t *cert; /**< Vote only: the voter's certificate. */
+
+ /** Digests of this document, as signed. */
+ common_digests_t digests;
+ /** A SHA3-256 digest of the document, not including signatures: used for
+ * consensus diffs */
+ uint8_t digest_sha3_as_signed[DIGEST256_LEN];
+
+ /** List of router statuses, sorted by identity digest. For a vote,
+ * the elements are vote_routerstatus_t; for a consensus, the elements
+ * are routerstatus_t. */
+ smartlist_t *routerstatus_list;
+
+ /** If present, a map from descriptor digest to elements of
+ * routerstatus_list. */
+ digestmap_t *desc_digest_map;
+
+ /** Contains the shared random protocol data from a vote or consensus. */
+ networkstatus_sr_info_t sr_info;
+};
+
+#endif
+
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index 72eada57c..45a63388f 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -69,6 +69,7 @@
#include "dirauth/mode.h"
#include "dir_server_st.h"
+#include "networkstatus_st.h"
#include "node_st.h"
static void nodelist_drop_node(node_t *node, int remove_from_ht);
diff --git a/src/or/or.h b/src/or/or.h
index 1069e30d0..43fe09f23 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1862,18 +1862,7 @@ typedef struct vote_microdesc_hash_t vote_microdesc_hash_t;
typedef struct vote_routerstatus_t vote_routerstatus_t;
typedef struct document_signature_t document_signature_t;
typedef struct networkstatus_voter_info_t networkstatus_voter_info_t;
-
-typedef struct networkstatus_sr_info_t {
- /* Indicate if the dirauth partitipates in the SR protocol with its vote.
- * This is tied to the SR flag in the vote. */
- unsigned int participate:1;
- /* Both vote and consensus: Current and previous SRV. If list is empty,
- * this means none were found in either the consensus or vote. */
- struct sr_srv_t *previous_srv;
- struct sr_srv_t *current_srv;
- /* Vote only: List of commitments. */
- smartlist_t *commits;
-} networkstatus_sr_info_t;
+typedef struct networkstatus_sr_info_t networkstatus_sr_info_t;
/** Enumerates the possible seriousness values of a networkstatus document. */
typedef enum {
@@ -1893,87 +1882,7 @@ typedef enum {
/** How many different consensus flavors are there? */
#define N_CONSENSUS_FLAVORS ((int)(FLAV_MICRODESC)+1)
-/** A common structure to hold a v3 network status vote, or a v3 network
- * status consensus. */
-typedef struct networkstatus_t {
- networkstatus_type_t type; /**< Vote, consensus, or opinion? */
- consensus_flavor_t flavor; /**< If a consensus, what kind? */
- unsigned int has_measured_bws : 1;/**< True iff this networkstatus contains
- * measured= bandwidth values. */
-
- time_t published; /**< Vote only: Time when vote was written. */
- time_t valid_after; /**< Time after which this vote or consensus applies. */
- time_t fresh_until; /**< Time before which this is the most recent vote or
- * consensus. */
- time_t valid_until; /**< Time after which this vote or consensus should not
- * be used. */
-
- /** Consensus only: what method was used to produce this consensus? */
- int consensus_method;
- /** Vote only: what methods is this voter willing to use? */
- smartlist_t *supported_methods;
-
- /** List of 'package' lines describing hashes of downloadable packages */
- smartlist_t *package_lines;
-
- /** How long does this vote/consensus claim that authorities take to
- * distribute their votes to one another? */
- int vote_seconds;
- /** How long does this vote/consensus claim that authorities take to
- * distribute their consensus signatures to one another? */
- int dist_seconds;
-
- /** Comma-separated list of recommended client software, or NULL if this
- * voter has no opinion. */
- char *client_versions;
- char *server_versions;
-
- /** Lists of subprotocol versions which are _recommended_ for relays and
- * clients, or which are _require_ for relays and clients. Tor shouldn't
- * make any more network connections if a required protocol is missing.
- */
- char *recommended_relay_protocols;
- char *recommended_client_protocols;
- char *required_relay_protocols;
- char *required_client_protocols;
-
- /** List of flags that this vote/consensus applies to routers. If a flag is
- * not listed here, the voter has no opinion on what its value should be. */
- smartlist_t *known_flags;
-
- /** List of key=value strings for the parameters in this vote or
- * consensus, sorted by key. */
- smartlist_t *net_params;
-
- /** List of key=value strings for the bw weight parameters in the
- * consensus. */
- smartlist_t *weight_params;
-
- /** List of networkstatus_voter_info_t. For a vote, only one element
- * is included. For a consensus, one element is included for every voter
- * whose vote contributed to the consensus. */
- smartlist_t *voters;
-
- struct authority_cert_t *cert; /**< Vote only: the voter's certificate. */
-
- /** Digests of this document, as signed. */
- common_digests_t digests;
- /** A SHA3-256 digest of the document, not including signatures: used for
- * consensus diffs */
- uint8_t digest_sha3_as_signed[DIGEST256_LEN];
-
- /** List of router statuses, sorted by identity digest. For a vote,
- * the elements are vote_routerstatus_t; for a consensus, the elements
- * are routerstatus_t. */
- smartlist_t *routerstatus_list;
-
- /** If present, a map from descriptor digest to elements of
- * routerstatus_list. */
- digestmap_t *desc_digest_map;
-
- /** Contains the shared random protocol data from a vote or consensus. */
- networkstatus_sr_info_t sr_info;
-} networkstatus_t;
+typedef struct networkstatus_t networkstatus_t;
/** A set of signatures for a networkstatus consensus. Unless otherwise
* noted, all fields are as for networkstatus_t. */
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index 0ab42fb42..694b52db1 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -33,6 +33,7 @@
#include "cpath_build_state_st.h"
#include "crypt_path_st.h"
+#include "networkstatus_st.h"
#include "origin_circuit_st.h"
#include "rend_encoded_v2_service_descriptor_st.h"
#include "rend_intro_point_st.h"
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 4a8b7a0e1..8552fedd3 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -40,6 +40,7 @@
#include "crypt_path_st.h"
#include "crypt_path_reference_st.h"
#include "edge_connection_st.h"
+#include "networkstatus_st.h"
#include "origin_circuit_st.h"
#include "rend_authorized_client_st.h"
#include "rend_encoded_v2_service_descriptor_st.h"
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 909cd043b..efc338c5e 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -89,6 +89,7 @@
#include "connection_or.h"
#include "statefile.h"
+#include "networkstatus_st.h"
#include "or_circuit_st.h"
static void bw_arrays_init(void);
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 5a8d19f6f..0f9318153 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -128,6 +128,7 @@
#include "dir_connection_st.h"
#include "dir_server_st.h"
#include "document_signature_st.h"
+#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "node_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 73721bf23..ab64b1c82 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -82,6 +82,7 @@
#include "dirauth/dirvote.h"
#include "document_signature_st.h"
+#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "rend_authorized_client_st.h"
#include "rend_intro_point_st.h"
diff --git a/src/or/shared_random_client.c b/src/or/shared_random_client.c
index 3aef83cef..14997b21b 100644
--- a/src/or/shared_random_client.c
+++ b/src/or/shared_random_client.c
@@ -17,6 +17,8 @@
#include "util.h"
#include "util_format.h"
+#include "networkstatus_st.h"
+
/* Convert a given srv object to a string for the control port. This doesn't
* fail and the srv object MUST be valid. */
static char *
diff --git a/src/or/voting_schedule.c b/src/or/voting_schedule.c
index 1d66b5e22..983cabbbf 100644
--- a/src/or/voting_schedule.c
+++ b/src/or/voting_schedule.c
@@ -15,6 +15,8 @@
#include "config.h"
#include "networkstatus.h"
+#include "networkstatus_st.h"
+
/* =====
* Vote scheduling
* ===== */
diff --git a/src/test/fuzz/fuzz_vrs.c b/src/test/fuzz/fuzz_vrs.c
index 7225fd545..a59767494 100644
--- a/src/test/fuzz/fuzz_vrs.c
+++ b/src/test/fuzz/fuzz_vrs.c
@@ -8,6 +8,7 @@
#include "microdesc.h"
#include "networkstatus.h"
+#include "networkstatus_st.h"
#include "vote_routerstatus_st.h"
#include "fuzzing.h"
diff --git a/src/test/test_address_set.c b/src/test/test_address_set.c
index f7441a649..441d14927 100644
--- a/src/test/test_address_set.c
+++ b/src/test/test_address_set.c
@@ -10,6 +10,8 @@
#include "routerlist.h"
#include "torcert.h"
+#include "networkstatus_st.h"
+
#include "test.h"
static networkstatus_t *dummy_ns = NULL;
diff --git a/src/test/test_channel.c b/src/test/test_channel.c
index c41afff5d..8177f92a1 100644
--- a/src/test/test_channel.c
+++ b/src/test/test_channel.c
@@ -20,6 +20,7 @@
#include "scheduler.h"
#include "networkstatus.h"
+#include "networkstatus_st.h"
#include "origin_circuit_st.h"
/* Test suite stuff */
diff --git a/src/test/test_channelpadding.c b/src/test/test_channelpadding.c
index b8e3492ea..2b4ff59a3 100644
--- a/src/test/test_channelpadding.c
+++ b/src/test/test_channelpadding.c
@@ -20,6 +20,7 @@
#include "networkstatus.h"
#include "log_test_helpers.h"
+#include "networkstatus_st.h"
#include "or_connection_st.h"
int channelpadding_get_netflow_inactive_timeout_ms(channel_t *chan);
diff --git a/src/test/test_consdiffmgr.c b/src/test/test_consdiffmgr.c
index 3b91baca3..dc223274b 100644
--- a/src/test/test_consdiffmgr.c
+++ b/src/test/test_consdiffmgr.c
@@ -14,6 +14,8 @@
#include "routerparse.h"
#include "workqueue.h"
+#include "networkstatus_st.h"
+
#include "test.h"
#include "log_test_helpers.h"
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index f5a3b6f65..10169a70c 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -46,6 +46,7 @@
#include "voting_schedule.h"
#include "document_signature_st.h"
+#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "port_cfg_st.h"
#include "tor_version_st.h"
diff --git a/src/test/test_dir_common.c b/src/test/test_dir_common.c
index fca132c9f..3fad1c3af 100644
--- a/src/test/test_dir_common.c
+++ b/src/test/test_dir_common.c
@@ -14,6 +14,7 @@
#include "test_dir_common.h"
#include "voting_schedule.h"
+#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "vote_microdesc_hash_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/test/test_dir_handle_get.c b/src/test/test_dir_handle_get.c
index ff9740b91..2e9eb3b74 100644
--- a/src/test/test_dir_handle_get.c
+++ b/src/test/test_dir_handle_get.c
@@ -36,6 +36,7 @@
#include "dir_connection_st.h"
#include "dir_server_st.h"
+#include "networkstatus_st.h"
#include "rend_encoded_v2_service_descriptor_st.h"
#ifdef _WIN32
diff --git a/src/test/test_dos.c b/src/test/test_dos.c
index fcc537499..714533908 100644
--- a/src/test/test_dos.c
+++ b/src/test/test_dos.c
@@ -16,6 +16,7 @@
#include "nodelist.h"
#include "routerlist.h"
+#include "networkstatus_st.h"
#include "or_connection_st.h"
#include "test.h"
diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c
index cf9da232c..572263773 100644
--- a/src/test/test_entrynodes.c
+++ b/src/test/test_entrynodes.c
@@ -33,6 +33,7 @@
#include "cpath_build_state_st.h"
#include "crypt_path_st.h"
#include "dir_connection_st.h"
+#include "networkstatus_st.h"
#include "node_st.h"
#include "origin_circuit_st.h"
diff --git a/src/test/test_guardfraction.c b/src/test/test_guardfraction.c
index 24bf58f94..38f237c5d 100644
--- a/src/test/test_guardfraction.c
+++ b/src/test/test_guardfraction.c
@@ -15,6 +15,7 @@
#include "routerparse.h"
#include "networkstatus.h"
+#include "networkstatus_st.h"
#include "vote_microdesc_hash_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/test/test_hs_cache.c b/src/test/test_hs_cache.c
index b2f892c7f..415f6f30e 100644
--- a/src/test/test_hs_cache.c
+++ b/src/test/test_hs_cache.c
@@ -19,6 +19,7 @@
#include "proto_http.h"
#include "dir_connection_st.h"
+#include "networkstatus_st.h"
#include "hs_test_helpers.h"
#include "test_helpers.h"
diff --git a/src/test/test_hs_client.c b/src/test/test_hs_client.c
index b75e743d3..ca87d5e92 100644
--- a/src/test/test_hs_client.c
+++ b/src/test/test_hs_client.c
@@ -41,6 +41,7 @@
#include "crypt_path_st.h"
#include "dir_connection_st.h"
#include "entry_connection_st.h"
+#include "networkstatus_st.h"
#include "origin_circuit_st.h"
#include "socks_request_st.h"
diff --git a/src/test/test_hs_common.c b/src/test/test_hs_common.c
index 21a109d2b..1cfa4a240 100644
--- a/src/test/test_hs_common.c
+++ b/src/test/test_hs_common.c
@@ -33,6 +33,7 @@
#include "util.h"
#include "voting_schedule.h"
+#include "networkstatus_st.h"
#include "node_st.h"
/** Test the validation of HS v3 addresses */
diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c
index 83a9d3cb5..ab27b4dc4 100644
--- a/src/test/test_hs_service.c
+++ b/src/test/test_hs_service.c
@@ -55,6 +55,7 @@
#include "cpath_build_state_st.h"
#include "crypt_path_st.h"
+#include "networkstatus_st.h"
#include "node_st.h"
#include "origin_circuit_st.h"
diff --git a/src/test/test_microdesc.c b/src/test/test_microdesc.c
index 4b168f49e..27fdf4a9d 100644
--- a/src/test/test_microdesc.c
+++ b/src/test/test_microdesc.c
@@ -13,6 +13,8 @@
#include "routerparse.h"
#include "torcert.h"
+#include "networkstatus_st.h"
+
#include "test.h"
#ifdef _WIN32
diff --git a/src/test/test_nodelist.c b/src/test/test_nodelist.c
index a3f2de29f..4a876f355 100644
--- a/src/test/test_nodelist.c
+++ b/src/test/test_nodelist.c
@@ -12,6 +12,7 @@
#include "nodelist.h"
#include "torcert.h"
+#include "networkstatus_st.h"
#include "node_st.h"
#include "test.h"
diff --git a/src/test/test_routerlist.c b/src/test/test_routerlist.c
index bf97499ee..45d63a806 100644
--- a/src/test/test_routerlist.c
+++ b/src/test/test_routerlist.c
@@ -35,6 +35,7 @@
#include "statefile.h"
#include "dir_connection_st.h"
+#include "networkstatus_st.h"
#include "node_st.h"
#include "test.h"
diff --git a/src/test/test_shared_random.c b/src/test/test_shared_random.c
index baafb9813..a1b4d60a2 100644
--- a/src/test/test_shared_random.c
+++ b/src/test/test_shared_random.c
@@ -23,6 +23,7 @@
#include "voting_schedule.h"
#include "dir_server_st.h"
+#include "networkstatus_st.h"
static authority_cert_t *mock_cert;