tor-commits
Threads by month
- ----- 2025 -----
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
June 2018
- 16 participants
- 2190 discussions

18 Jun '18
commit 03fc83ab6da6b73b930e422c57089ad5a4907c83
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 14:53:07 2018 -0400
Extract signed_descriptor_t into its own header.
---
src/or/authority_cert_st.h | 2 ++
src/or/extrainfo_st.h | 2 ++
src/or/include.am | 1 +
src/or/or.h | 48 +----------------------------------
src/or/routerinfo_st.h | 2 ++
src/or/signed_descriptor_st.h | 59 +++++++++++++++++++++++++++++++++++++++++++
6 files changed, 67 insertions(+), 47 deletions(-)
diff --git a/src/or/authority_cert_st.h b/src/or/authority_cert_st.h
index b1dbcddbe..bc274a1c6 100644
--- a/src/or/authority_cert_st.h
+++ b/src/or/authority_cert_st.h
@@ -7,6 +7,8 @@
#ifndef AUTHORITY_CERT_ST_H
#define AUTHORITY_CERT_ST_H
+#include "signed_descriptor_st.h"
+
/** Certificate for v3 directory protocol: binds long-term authority identity
* keys to medium-term authority signing keys. */
struct authority_cert_t {
diff --git a/src/or/extrainfo_st.h b/src/or/extrainfo_st.h
index d65397849..c4d84b8ee 100644
--- a/src/or/extrainfo_st.h
+++ b/src/or/extrainfo_st.h
@@ -7,6 +7,8 @@
#ifndef EXTRAINFO_ST_H
#define EXTRAINFO_ST_H
+#include "signed_descriptor_st.h"
+
/** Information needed to keep and cache a signed extra-info document. */
struct extrainfo_t {
signed_descriptor_t cache_info;
diff --git a/src/or/include.am b/src/or/include.am
index 468b231f7..cb9f4994e 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -307,6 +307,7 @@ ORHEADERS = \
src/or/scheduler.h \
src/or/server_port_cfg_st.h \
src/or/shared_random_client.h \
+ src/or/signed_descriptor_st.h \
src/or/socks_request_st.h \
src/or/statefile.h \
src/or/status.h \
diff --git a/src/or/or.h b/src/or/or.h
index 208ec6d33..3dd1b6fe5 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1511,53 +1511,7 @@ typedef struct download_status_t {
* create any that are larger than this. */
#define ROUTER_ANNOTATION_BUF_LEN 256
-/** Information need to cache an onion router's descriptor. */
-typedef struct signed_descriptor_t {
- /** Pointer to the raw server descriptor, preceded by annotations. Not
- * necessarily NUL-terminated. If saved_location is SAVED_IN_CACHE, this
- * pointer is null. */
- char *signed_descriptor_body;
- /** Length of the annotations preceding the server descriptor. */
- size_t annotations_len;
- /** Length of the server descriptor. */
- size_t signed_descriptor_len;
- /** Digest of the server descriptor, computed as specified in
- * dir-spec.txt. */
- char signed_descriptor_digest[DIGEST_LEN];
- /** Identity digest of the router. */
- char identity_digest[DIGEST_LEN];
- /** Declared publication time of the descriptor. */
- time_t published_on;
- /** For routerdescs only: digest of the corresponding extrainfo. */
- char extra_info_digest[DIGEST_LEN];
- /** For routerdescs only: A SHA256-digest of the extrainfo (if any) */
- char extra_info_digest256[DIGEST256_LEN];
- /** Certificate for ed25519 signing key. */
- struct tor_cert_st *signing_key_cert;
- /** For routerdescs only: Status of downloading the corresponding
- * extrainfo. */
- download_status_t ei_dl_status;
- /** Where is the descriptor saved? */
- saved_location_t saved_location;
- /** If saved_location is SAVED_IN_CACHE or SAVED_IN_JOURNAL, the offset of
- * this descriptor in the corresponding file. */
- off_t saved_offset;
- /** What position is this descriptor within routerlist->routers or
- * routerlist->old_routers? -1 for none. */
- int routerlist_index;
- /** The valid-until time of the most recent consensus that listed this
- * descriptor. 0 for "never listed in a consensus, so far as we know." */
- time_t last_listed_as_valid_until;
- /* If true, we do not ever try to save this object in the cache. */
- unsigned int do_not_cache : 1;
- /* If true, this item is meant to represent an extrainfo. */
- unsigned int is_extrainfo : 1;
- /* If true, we got an extrainfo for this item, and the digest was right,
- * but it was incompatible. */
- unsigned int extrainfo_is_bogus : 1;
- /* If true, we are willing to transmit this item unencrypted. */
- unsigned int send_unencrypted : 1;
-} signed_descriptor_t;
+typedef struct signed_descriptor_t signed_descriptor_t;
/** A signed integer representing a country code. */
typedef int16_t country_t;
diff --git a/src/or/routerinfo_st.h b/src/or/routerinfo_st.h
index 800a8cbe3..11ee3e350 100644
--- a/src/or/routerinfo_st.h
+++ b/src/or/routerinfo_st.h
@@ -7,6 +7,8 @@
#ifndef ROUTERINFO_ST_H
#define ROUTERINFO_ST_H
+#include "signed_descriptor_st.h"
+
/** Information about another onion router in the network. */
struct routerinfo_t {
signed_descriptor_t cache_info;
diff --git a/src/or/signed_descriptor_st.h b/src/or/signed_descriptor_st.h
new file mode 100644
index 000000000..0159e9176
--- /dev/null
+++ b/src/or/signed_descriptor_st.h
@@ -0,0 +1,59 @@
+/* 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 SIGNED_DESCRIPTOR_ST_H
+#define SIGNED_DESCRIPTOR_ST_H
+
+/** Information need to cache an onion router's descriptor. */
+struct signed_descriptor_t {
+ /** Pointer to the raw server descriptor, preceded by annotations. Not
+ * necessarily NUL-terminated. If saved_location is SAVED_IN_CACHE, this
+ * pointer is null. */
+ char *signed_descriptor_body;
+ /** Length of the annotations preceding the server descriptor. */
+ size_t annotations_len;
+ /** Length of the server descriptor. */
+ size_t signed_descriptor_len;
+ /** Digest of the server descriptor, computed as specified in
+ * dir-spec.txt. */
+ char signed_descriptor_digest[DIGEST_LEN];
+ /** Identity digest of the router. */
+ char identity_digest[DIGEST_LEN];
+ /** Declared publication time of the descriptor. */
+ time_t published_on;
+ /** For routerdescs only: digest of the corresponding extrainfo. */
+ char extra_info_digest[DIGEST_LEN];
+ /** For routerdescs only: A SHA256-digest of the extrainfo (if any) */
+ char extra_info_digest256[DIGEST256_LEN];
+ /** Certificate for ed25519 signing key. */
+ struct tor_cert_st *signing_key_cert;
+ /** For routerdescs only: Status of downloading the corresponding
+ * extrainfo. */
+ download_status_t ei_dl_status;
+ /** Where is the descriptor saved? */
+ saved_location_t saved_location;
+ /** If saved_location is SAVED_IN_CACHE or SAVED_IN_JOURNAL, the offset of
+ * this descriptor in the corresponding file. */
+ off_t saved_offset;
+ /** What position is this descriptor within routerlist->routers or
+ * routerlist->old_routers? -1 for none. */
+ int routerlist_index;
+ /** The valid-until time of the most recent consensus that listed this
+ * descriptor. 0 for "never listed in a consensus, so far as we know." */
+ time_t last_listed_as_valid_until;
+ /* If true, we do not ever try to save this object in the cache. */
+ unsigned int do_not_cache : 1;
+ /* If true, this item is meant to represent an extrainfo. */
+ unsigned int is_extrainfo : 1;
+ /* If true, we got an extrainfo for this item, and the digest was right,
+ * but it was incompatible. */
+ unsigned int extrainfo_is_bogus : 1;
+ /* If true, we are willing to transmit this item unencrypted. */
+ unsigned int send_unencrypted : 1;
+};
+
+#endif
+
1
0

18 Jun '18
commit def1f20e1f9e4544eaf2c0e387b240ec52958a9e
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 14:33:03 2018 -0400
Extract routerstatus_t into its own header.
---
src/or/bridges.c | 1 +
src/or/circuitbuild.c | 1 +
src/or/dir_server_st.h | 1 +
src/or/hs_common.c | 1 +
src/or/hs_control.c | 1 +
src/or/hs_service.c | 1 +
src/or/include.am | 1 +
src/or/microdesc.c | 1 +
src/or/nodelist.c | 1 +
src/or/or.h | 68 +-----------------------------------
src/or/policies.c | 1 +
src/or/rendclient.c | 1 +
src/or/rendcommon.c | 1 +
src/or/rendservice.c | 1 +
src/or/routerset.c | 1 +
src/or/routerstatus_st.h | 78 ++++++++++++++++++++++++++++++++++++++++++
src/or/vote_routerstatus_st.h | 2 ++
src/test/test_address_set.c | 1 +
src/test/test_channel.c | 1 +
src/test/test_channelpadding.c | 1 +
src/test/test_dos.c | 1 +
src/test/test_entrynodes.c | 1 +
src/test/test_hs_common.c | 1 +
src/test/test_hs_control.c | 1 +
src/test/test_microdesc.c | 1 +
src/test/test_nodelist.c | 1 +
src/test/test_policy.c | 1 +
src/test/test_routerlist.c | 1 +
src/test/test_routerset.c | 1 +
29 files changed, 107 insertions(+), 67 deletions(-)
diff --git a/src/or/bridges.c b/src/or/bridges.c
index d5a9d05b4..3108e1495 100644
--- a/src/or/bridges.c
+++ b/src/or/bridges.c
@@ -28,6 +28,7 @@
#include "transports.h"
#include "node_st.h"
+#include "routerstatus_st.h"
/** Information about a configured bridge. Currently this just matches the
* ones in the torrc file, but one day we may be able to learn about new
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 42ce1cfda..4944a70ce 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -70,6 +70,7 @@
#include "node_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
+#include "routerstatus_st.h"
static channel_t * channel_connect_for_circuit(const tor_addr_t *addr,
uint16_t port,
diff --git a/src/or/dir_server_st.h b/src/or/dir_server_st.h
index d2222c26f..b9d3f1c55 100644
--- a/src/or/dir_server_st.h
+++ b/src/or/dir_server_st.h
@@ -9,6 +9,7 @@
#include "torint.h"
#include "or.h"
+#include "routerstatus_st.h"
/** Represents information about a single trusted or fallback directory
* server. */
diff --git a/src/or/hs_common.c b/src/or/hs_common.c
index e5d15a1b1..c63d4330d 100644
--- a/src/or/hs_common.c
+++ b/src/or/hs_common.c
@@ -37,6 +37,7 @@
#include "networkstatus_st.h"
#include "node_st.h"
#include "origin_circuit_st.h"
+#include "routerstatus_st.h"
/* Trunnel */
#include "ed25519_cert.h"
diff --git a/src/or/hs_control.c b/src/or/hs_control.c
index 4f3dd62c6..3ad7fb151 100644
--- a/src/or/hs_control.c
+++ b/src/or/hs_control.c
@@ -16,6 +16,7 @@
#include "nodelist.h"
#include "node_st.h"
+#include "routerstatus_st.h"
/* Send on the control port the "HS_DESC REQUESTED [...]" event.
*
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index 007c84caf..ef809a69f 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -44,6 +44,7 @@
#include "networkstatus_st.h"
#include "node_st.h"
#include "origin_circuit_st.h"
+#include "routerstatus_st.h"
/* Trunnel */
#include "ed25519_cert.h"
diff --git a/src/or/include.am b/src/or/include.am
index afacd7772..602b811be 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -301,6 +301,7 @@ ORHEADERS = \
src/or/routerkeys.h \
src/or/routerset.h \
src/or/routerparse.h \
+ src/or/routerstatus_st.h \
src/or/scheduler.h \
src/or/server_port_cfg_st.h \
src/or/shared_random_client.h \
diff --git a/src/or/microdesc.c b/src/or/microdesc.c
index 208f35b1c..f125cf405 100644
--- a/src/or/microdesc.c
+++ b/src/or/microdesc.c
@@ -24,6 +24,7 @@
#include "networkstatus_st.h"
#include "node_st.h"
+#include "routerstatus_st.h"
/** A data structure to hold a bunch of cached microdescriptors. There are
* two active files in the cache: a "cache file" that we mmap, and a "journal
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index 26b1788a3..b542fd516 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -72,6 +72,7 @@
#include "networkstatus_st.h"
#include "node_st.h"
#include "routerlist_st.h"
+#include "routerstatus_st.h"
static void nodelist_drop_node(node_t *node, int remove_from_ht);
#define node_free(val) \
diff --git a/src/or/or.h b/src/or/or.h
index d07e594d7..0d564b1e2 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1694,73 +1694,7 @@ typedef struct {
} routerinfo_t;
typedef struct extrainfo_t extrainfo_t;
-
-/** Contents of a single router entry in a network status object.
- */
-typedef struct routerstatus_t {
- time_t published_on; /**< When was this router published? */
- char nickname[MAX_NICKNAME_LEN+1]; /**< The nickname this router says it
- * has. */
- char identity_digest[DIGEST_LEN]; /**< Digest of the router's identity
- * key. */
- /** Digest of the router's most recent descriptor or microdescriptor.
- * If it's a descriptor, we only use the first DIGEST_LEN bytes. */
- char descriptor_digest[DIGEST256_LEN];
- uint32_t addr; /**< IPv4 address for this router, in host order. */
- uint16_t or_port; /**< IPv4 OR port for this router. */
- uint16_t dir_port; /**< Directory port for this router. */
- tor_addr_t ipv6_addr; /**< IPv6 address for this router. */
- uint16_t ipv6_orport; /**< IPv6 OR port for this router. */
- unsigned int is_authority:1; /**< True iff this router is an authority. */
- unsigned int is_exit:1; /**< True iff this router is a good exit. */
- unsigned int is_stable:1; /**< True iff this router stays up a long time. */
- unsigned int is_fast:1; /**< True iff this router has good bandwidth. */
- /** True iff this router is called 'running' in the consensus. We give it
- * this funny name so that we don't accidentally use this bit as a view of
- * whether we think the router is *currently* running. If that's what you
- * want to know, look at is_running in node_t. */
- unsigned int is_flagged_running:1;
- unsigned int is_named:1; /**< True iff "nickname" belongs to this router. */
- unsigned int is_unnamed:1; /**< True iff "nickname" belongs to another
- * router. */
- unsigned int is_valid:1; /**< True iff this router isn't invalid. */
- unsigned int is_possible_guard:1; /**< True iff this router would be a good
- * choice as an entry guard. */
- unsigned int is_bad_exit:1; /**< True iff this node is a bad choice for
- * an exit node. */
- unsigned int is_hs_dir:1; /**< True iff this router is a v2-or-later hidden
- * service directory. */
- unsigned int is_v2_dir:1; /** True iff this router publishes an open DirPort
- * or it claims to accept tunnelled dir requests.
- */
-
- unsigned int has_bandwidth:1; /**< The vote/consensus had bw info */
- unsigned int has_exitsummary:1; /**< The vote/consensus had exit summaries */
- unsigned int bw_is_unmeasured:1; /**< This is a consensus entry, with
- * the Unmeasured flag set. */
-
- /** Flags to summarize the protocol versions for this routerstatus_t. */
- protover_summary_flags_t pv;
-
- uint32_t bandwidth_kb; /**< Bandwidth (capacity) of the router as reported in
- * the vote/consensus, in kilobytes/sec. */
-
- /** The consensus has guardfraction information for this router. */
- unsigned int has_guardfraction:1;
- /** The guardfraction value of this router. */
- uint32_t guardfraction_percentage;
-
- char *exitsummary; /**< exit policy summary -
- * XXX weasel: this probably should not stay a string. */
-
- /* ---- The fields below aren't derived from the networkstatus; they
- * hold local information only. */
-
- time_t last_dir_503_at; /**< When did this router last tell us that it
- * was too busy to serve directory info? */
- download_status_t dl_status;
-
-} routerstatus_t;
+typedef struct routerstatus_t routerstatus_t;
/** A single entry in a parsed policy summary, describing a range of ports. */
typedef struct short_policy_entry_t {
diff --git a/src/or/policies.c b/src/or/policies.c
index 78cbcd5cd..0c1e3497e 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -33,6 +33,7 @@
#include "dir_server_st.h"
#include "node_st.h"
#include "port_cfg_st.h"
+#include "routerstatus_st.h"
/** Policy that addresses for incoming SOCKS connections must match. */
static smartlist_t *socks_policy = NULL;
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index a48f83fa9..323612785 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -40,6 +40,7 @@
#include "origin_circuit_st.h"
#include "rend_intro_point_st.h"
#include "rend_service_descriptor_st.h"
+#include "routerstatus_st.h"
static extend_info_t *rend_client_get_random_intro_impl(
const rend_cache_entry_t *rend_query,
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index 694b52db1..904969946 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -38,6 +38,7 @@
#include "rend_encoded_v2_service_descriptor_st.h"
#include "rend_intro_point_st.h"
#include "rend_service_descriptor_st.h"
+#include "routerstatus_st.h"
/** Return 0 if one and two are the same service ids, else -1 or 1 */
int
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 8552fedd3..170d78147 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -46,6 +46,7 @@
#include "rend_encoded_v2_service_descriptor_st.h"
#include "rend_intro_point_st.h"
#include "rend_service_descriptor_st.h"
+#include "routerstatus_st.h"
struct rend_service_t;
static origin_circuit_t *find_intro_circuit(rend_intro_point_t *intro,
diff --git a/src/or/routerset.c b/src/or/routerset.c
index 8a6ff3b58..1033702f3 100644
--- a/src/or/routerset.c
+++ b/src/or/routerset.c
@@ -37,6 +37,7 @@
#include "routerset.h"
#include "node_st.h"
+#include "routerstatus_st.h"
/** Return a new empty routerset. */
routerset_t *
diff --git a/src/or/routerstatus_st.h b/src/or/routerstatus_st.h
new file mode 100644
index 000000000..9c25e88b6
--- /dev/null
+++ b/src/or/routerstatus_st.h
@@ -0,0 +1,78 @@
+/* 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 ROUTERSTATUS_ST_H
+#define ROUTERSTATUS_ST_H
+
+/** Contents of a single router entry in a network status object.
+ */
+struct routerstatus_t {
+ time_t published_on; /**< When was this router published? */
+ char nickname[MAX_NICKNAME_LEN+1]; /**< The nickname this router says it
+ * has. */
+ char identity_digest[DIGEST_LEN]; /**< Digest of the router's identity
+ * key. */
+ /** Digest of the router's most recent descriptor or microdescriptor.
+ * If it's a descriptor, we only use the first DIGEST_LEN bytes. */
+ char descriptor_digest[DIGEST256_LEN];
+ uint32_t addr; /**< IPv4 address for this router, in host order. */
+ uint16_t or_port; /**< IPv4 OR port for this router. */
+ uint16_t dir_port; /**< Directory port for this router. */
+ tor_addr_t ipv6_addr; /**< IPv6 address for this router. */
+ uint16_t ipv6_orport; /**< IPv6 OR port for this router. */
+ unsigned int is_authority:1; /**< True iff this router is an authority. */
+ unsigned int is_exit:1; /**< True iff this router is a good exit. */
+ unsigned int is_stable:1; /**< True iff this router stays up a long time. */
+ unsigned int is_fast:1; /**< True iff this router has good bandwidth. */
+ /** True iff this router is called 'running' in the consensus. We give it
+ * this funny name so that we don't accidentally use this bit as a view of
+ * whether we think the router is *currently* running. If that's what you
+ * want to know, look at is_running in node_t. */
+ unsigned int is_flagged_running:1;
+ unsigned int is_named:1; /**< True iff "nickname" belongs to this router. */
+ unsigned int is_unnamed:1; /**< True iff "nickname" belongs to another
+ * router. */
+ unsigned int is_valid:1; /**< True iff this router isn't invalid. */
+ unsigned int is_possible_guard:1; /**< True iff this router would be a good
+ * choice as an entry guard. */
+ unsigned int is_bad_exit:1; /**< True iff this node is a bad choice for
+ * an exit node. */
+ unsigned int is_hs_dir:1; /**< True iff this router is a v2-or-later hidden
+ * service directory. */
+ unsigned int is_v2_dir:1; /** True iff this router publishes an open DirPort
+ * or it claims to accept tunnelled dir requests.
+ */
+
+ unsigned int has_bandwidth:1; /**< The vote/consensus had bw info */
+ unsigned int has_exitsummary:1; /**< The vote/consensus had exit summaries */
+ unsigned int bw_is_unmeasured:1; /**< This is a consensus entry, with
+ * the Unmeasured flag set. */
+
+ /** Flags to summarize the protocol versions for this routerstatus_t. */
+ protover_summary_flags_t pv;
+
+ uint32_t bandwidth_kb; /**< Bandwidth (capacity) of the router as reported in
+ * the vote/consensus, in kilobytes/sec. */
+
+ /** The consensus has guardfraction information for this router. */
+ unsigned int has_guardfraction:1;
+ /** The guardfraction value of this router. */
+ uint32_t guardfraction_percentage;
+
+ char *exitsummary; /**< exit policy summary -
+ * XXX weasel: this probably should not stay a string. */
+
+ /* ---- The fields below aren't derived from the networkstatus; they
+ * hold local information only. */
+
+ time_t last_dir_503_at; /**< When did this router last tell us that it
+ * was too busy to serve directory info? */
+ download_status_t dl_status;
+
+};
+
+#endif
+
diff --git a/src/or/vote_routerstatus_st.h b/src/or/vote_routerstatus_st.h
index 71c204fad..7ac9a6003 100644
--- a/src/or/vote_routerstatus_st.h
+++ b/src/or/vote_routerstatus_st.h
@@ -7,6 +7,8 @@
#ifndef VOTE_ROUTERSTATUS_ST_H
#define VOTE_ROUTERSTATUS_ST_H
+#include "routerstatus_st.h"
+
/** The claim about a single router, made in a vote. */
struct vote_routerstatus_t {
routerstatus_t status; /**< Underlying 'status' object for this router.
diff --git a/src/test/test_address_set.c b/src/test/test_address_set.c
index 441d14927..a704e6fb3 100644
--- a/src/test/test_address_set.c
+++ b/src/test/test_address_set.c
@@ -11,6 +11,7 @@
#include "torcert.h"
#include "networkstatus_st.h"
+#include "routerstatus_st.h"
#include "test.h"
diff --git a/src/test/test_channel.c b/src/test/test_channel.c
index 8177f92a1..fbc964ecc 100644
--- a/src/test/test_channel.c
+++ b/src/test/test_channel.c
@@ -22,6 +22,7 @@
#include "networkstatus_st.h"
#include "origin_circuit_st.h"
+#include "routerstatus_st.h"
/* Test suite stuff */
#include "log_test_helpers.h"
diff --git a/src/test/test_channelpadding.c b/src/test/test_channelpadding.c
index 2b4ff59a3..206b57ad1 100644
--- a/src/test/test_channelpadding.c
+++ b/src/test/test_channelpadding.c
@@ -22,6 +22,7 @@
#include "networkstatus_st.h"
#include "or_connection_st.h"
+#include "routerstatus_st.h"
int channelpadding_get_netflow_inactive_timeout_ms(channel_t *chan);
int64_t channelpadding_compute_time_until_pad_for_netflow(channel_t *chan);
diff --git a/src/test/test_dos.c b/src/test/test_dos.c
index 714533908..bc77bd8cd 100644
--- a/src/test/test_dos.c
+++ b/src/test/test_dos.c
@@ -18,6 +18,7 @@
#include "networkstatus_st.h"
#include "or_connection_st.h"
+#include "routerstatus_st.h"
#include "test.h"
#include "log_test_helpers.h"
diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c
index 572263773..d16af591d 100644
--- a/src/test/test_entrynodes.c
+++ b/src/test/test_entrynodes.c
@@ -36,6 +36,7 @@
#include "networkstatus_st.h"
#include "node_st.h"
#include "origin_circuit_st.h"
+#include "routerstatus_st.h"
#include "test_helpers.h"
#include "log_test_helpers.h"
diff --git a/src/test/test_hs_common.c b/src/test/test_hs_common.c
index 1cfa4a240..ea5fb4979 100644
--- a/src/test/test_hs_common.c
+++ b/src/test/test_hs_common.c
@@ -35,6 +35,7 @@
#include "networkstatus_st.h"
#include "node_st.h"
+#include "routerstatus_st.h"
/** Test the validation of HS v3 addresses */
static void
diff --git a/src/test/test_hs_control.c b/src/test/test_hs_control.c
index 1fcea44f4..f72037337 100644
--- a/src/test/test_hs_control.c
+++ b/src/test/test_hs_control.c
@@ -17,6 +17,7 @@
#include "nodelist.h"
#include "node_st.h"
+#include "routerstatus_st.h"
#include "test_helpers.h"
diff --git a/src/test/test_microdesc.c b/src/test/test_microdesc.c
index 27fdf4a9d..1fdac0924 100644
--- a/src/test/test_microdesc.c
+++ b/src/test/test_microdesc.c
@@ -14,6 +14,7 @@
#include "torcert.h"
#include "networkstatus_st.h"
+#include "routerstatus_st.h"
#include "test.h"
diff --git a/src/test/test_nodelist.c b/src/test/test_nodelist.c
index 4a876f355..018f109e5 100644
--- a/src/test/test_nodelist.c
+++ b/src/test/test_nodelist.c
@@ -14,6 +14,7 @@
#include "networkstatus_st.h"
#include "node_st.h"
+#include "routerstatus_st.h"
#include "test.h"
diff --git a/src/test/test_policy.c b/src/test/test_policy.c
index 673336eae..71c623070 100644
--- a/src/test/test_policy.c
+++ b/src/test/test_policy.c
@@ -12,6 +12,7 @@
#include "node_st.h"
#include "port_cfg_st.h"
+#include "routerstatus_st.h"
/* Helper: assert that short_policy parses and writes back out as itself,
or as <b>expected</b> if that's provided. */
diff --git a/src/test/test_routerlist.c b/src/test/test_routerlist.c
index 1c2ba9d67..41f7c09bd 100644
--- a/src/test/test_routerlist.c
+++ b/src/test/test_routerlist.c
@@ -38,6 +38,7 @@
#include "dir_connection_st.h"
#include "networkstatus_st.h"
#include "node_st.h"
+#include "routerstatus_st.h"
#include "test.h"
#include "test_dir_common.h"
diff --git a/src/test/test_routerset.c b/src/test/test_routerset.c
index 0e1ad3fdf..21db9bb3b 100644
--- a/src/test/test_routerset.c
+++ b/src/test/test_routerset.c
@@ -11,6 +11,7 @@
#include "nodelist.h"
#include "node_st.h"
+#include "routerstatus_st.h"
#include "test.h"
1
0

[tor/master] Add a changes file for splitting structures out of or.h
by nickm@torproject.org 18 Jun '18
by nickm@torproject.org 18 Jun '18
18 Jun '18
commit 3edc48c07b35ea0708ad4149a725a60887c13326
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 15:48:03 2018 -0400
Add a changes file for splitting structures out of or.h
---
changes/split_or_h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/changes/split_or_h b/changes/split_or_h
new file mode 100644
index 000000000..53d54ca6d
--- /dev/null
+++ b/changes/split_or_h
@@ -0,0 +1,5 @@
+ o Code simplification and refactoring:
+ - Many structures have been removed from the centralized "or.h" header,
+ and moved into their own headers. This will allow us to reduce
+ the number of places in the code that rely on each structure's
+ contents and layout. Closes ticket 26383.
1
0
commit 00f1d1653e4ff703cfbcf82060b229ca8a39030d
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 14:21:25 2018 -0400
Extract extrainfo_t into its own header
---
src/or/control.c | 1 +
src/or/dirserv.c | 1 +
src/or/extrainfo_st.h | 28 ++++++++++++++++++++++++++++
src/or/include.am | 1 +
src/or/or.h | 17 +----------------
src/or/router.c | 1 +
src/or/routerlist.c | 1 +
src/or/routerparse.c | 1 +
src/test/test_dir.c | 1 +
9 files changed, 36 insertions(+), 16 deletions(-)
diff --git a/src/or/control.c b/src/or/control.c
index 55670e65e..c1d14b7a4 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 "extrainfo_st.h"
#include "networkstatus_st.h"
#include "node_st.h"
#include "or_connection_st.h"
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index d92bc8e1f..b76fa25d6 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -37,6 +37,7 @@
#include "dirauth/dirvote.h"
#include "dir_connection_st.h"
+#include "extrainfo_st.h"
#include "node_st.h"
#include "routerlist_st.h"
#include "tor_version_st.h"
diff --git a/src/or/extrainfo_st.h b/src/or/extrainfo_st.h
new file mode 100644
index 000000000..d65397849
--- /dev/null
+++ b/src/or/extrainfo_st.h
@@ -0,0 +1,28 @@
+/* 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 EXTRAINFO_ST_H
+#define EXTRAINFO_ST_H
+
+/** Information needed to keep and cache a signed extra-info document. */
+struct extrainfo_t {
+ signed_descriptor_t cache_info;
+ /** SHA256 digest of this document */
+ uint8_t digest256[DIGEST256_LEN];
+ /** The router's nickname. */
+ char nickname[MAX_NICKNAME_LEN+1];
+ /** True iff we found the right key for this extra-info, verified the
+ * signature, and found it to be bad. */
+ unsigned int bad_sig : 1;
+ /** If present, we didn't have the right key to verify this extra-info,
+ * so this is a copy of the signature in the document. */
+ char *pending_sig;
+ /** Length of pending_sig. */
+ size_t pending_sig_len;
+};
+
+#endif
+
diff --git a/src/or/include.am b/src/or/include.am
index e73432d3c..afacd7772 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -225,6 +225,7 @@ ORHEADERS = \
src/or/entry_connection_st.h \
src/or/entry_port_cfg_st.h \
src/or/ext_orport.h \
+ src/or/extrainfo_st.h \
src/or/fallback_dirs.inc \
src/or/fp_pair.h \
src/or/geoip.h \
diff --git a/src/or/or.h b/src/or/or.h
index 1f7c4be50..d07e594d7 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1693,22 +1693,7 @@ typedef struct {
uint8_t purpose;
} routerinfo_t;
-/** Information needed to keep and cache a signed extra-info document. */
-typedef struct extrainfo_t {
- signed_descriptor_t cache_info;
- /** SHA256 digest of this document */
- uint8_t digest256[DIGEST256_LEN];
- /** The router's nickname. */
- char nickname[MAX_NICKNAME_LEN+1];
- /** True iff we found the right key for this extra-info, verified the
- * signature, and found it to be bad. */
- unsigned int bad_sig : 1;
- /** If present, we didn't have the right key to verify this extra-info,
- * so this is a copy of the signature in the document. */
- char *pending_sig;
- /** Length of pending_sig. */
- size_t pending_sig_len;
-} extrainfo_t;
+typedef struct extrainfo_t extrainfo_t;
/** Contents of a single router entry in a network status object.
*/
diff --git a/src/or/router.c b/src/or/router.c
index 961fab129..28dd360d3 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -43,6 +43,7 @@
#include "crypt_path_st.h"
#include "dir_connection_st.h"
#include "dir_server_st.h"
+#include "extrainfo_st.h"
#include "node_st.h"
#include "origin_circuit_st.h"
#include "port_cfg_st.h"
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 3170ce601..425ad8273 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -129,6 +129,7 @@
#include "dir_connection_st.h"
#include "dir_server_st.h"
#include "document_signature_st.h"
+#include "extrainfo_st.h"
#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "node_st.h"
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 34c851a1b..7a19460df 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -83,6 +83,7 @@
#include "authority_cert_st.h"
#include "document_signature_st.h"
+#include "extrainfo_st.h"
#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "ns_detached_signatures_st.h"
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index ecce48942..c25665d3e 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -47,6 +47,7 @@
#include "authority_cert_st.h"
#include "document_signature_st.h"
+#include "extrainfo_st.h"
#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "ns_detached_signatures_st.h"
1
0
commit 958df2829a9248cf8518aafd9e19da48ce14cf64
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 15:06:00 2018 -0400
Extract cached_dir_t into a new header.
---
src/or/cached_dir_st.h | 25 +++++++++++++++++++++++++
src/or/control.c | 1 +
src/or/dirauth/dirvote.c | 1 +
src/or/directory.c | 1 +
src/or/dirserv.c | 1 +
src/or/include.am | 1 +
src/or/or.h | 14 +-------------
7 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/src/or/cached_dir_st.h b/src/or/cached_dir_st.h
new file mode 100644
index 000000000..4f930b6fb
--- /dev/null
+++ b/src/or/cached_dir_st.h
@@ -0,0 +1,25 @@
+/* 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 CACHED_DIR_ST_H
+#define CACHED_DIR_ST_H
+
+/** A cached_dir_t represents a cacheable directory object, along with its
+ * compressed form. */
+struct cached_dir_t {
+ char *dir; /**< Contents of this object, NUL-terminated. */
+ char *dir_compressed; /**< Compressed contents of this object. */
+ size_t dir_len; /**< Length of <b>dir</b> (not counting its NUL). */
+ size_t dir_compressed_len; /**< Length of <b>dir_compressed</b>. */
+ time_t published; /**< When was this object published. */
+ common_digests_t digests; /**< Digests of this object (networkstatus only) */
+ /** Sha3 digest (also ns only) */
+ uint8_t digest_sha3_as_signed[DIGEST256_LEN];
+ int refcnt; /**< Reference count for this cached_dir_t. */
+};
+
+#endif
+
diff --git a/src/or/control.c b/src/or/control.c
index 520b6178f..075b62a58 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -81,6 +81,7 @@
#include "routerparse.h"
#include "shared_random_client.h"
+#include "cached_dir_st.h"
#include "control_connection_st.h"
#include "cpath_build_state_st.h"
#include "entry_connection_st.h"
diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c
index 94a6139f5..c39708f4e 100644
--- a/src/or/dirauth/dirvote.c
+++ b/src/or/dirauth/dirvote.c
@@ -29,6 +29,7 @@
#include "dirauth/shared_random_state.h"
#include "authority_cert_st.h"
+#include "cached_dir_st.h"
#include "dir_server_st.h"
#include "document_signature_st.h"
#include "microdesc_st.h"
diff --git a/src/or/directory.c b/src/or/directory.c
index f6d6d28d4..2394b75b2 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -55,6 +55,7 @@
#include "dirauth/shared_random.h"
#include "authority_cert_st.h"
+#include "cached_dir_st.h"
#include "dir_connection_st.h"
#include "dir_server_st.h"
#include "entry_connection_st.h"
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index e54782d19..68f411b48 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -36,6 +36,7 @@
#include "dirauth/dirvote.h"
+#include "cached_dir_st.h"
#include "dir_connection_st.h"
#include "extrainfo_st.h"
#include "microdesc_st.h"
diff --git a/src/or/include.am b/src/or/include.am
index c28e95f05..cc059ef51 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -195,6 +195,7 @@ ORHEADERS = \
src/or/circuitstats.h \
src/or/circuituse.h \
src/or/circuit_st.h \
+ src/or/cached_dir_st.h \
src/or/command.h \
src/or/config.h \
src/or/confparse.h \
diff --git a/src/or/or.h b/src/or/or.h
index 9668760cc..958c1e2bb 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1384,19 +1384,7 @@ typedef struct addr_policy_t {
uint16_t prt_max; /**< Highest port number to accept/reject. */
} addr_policy_t;
-/** A cached_dir_t represents a cacheable directory object, along with its
- * compressed form. */
-typedef struct cached_dir_t {
- char *dir; /**< Contents of this object, NUL-terminated. */
- char *dir_compressed; /**< Compressed contents of this object. */
- size_t dir_len; /**< Length of <b>dir</b> (not counting its NUL). */
- size_t dir_compressed_len; /**< Length of <b>dir_compressed</b>. */
- time_t published; /**< When was this object published. */
- common_digests_t digests; /**< Digests of this object (networkstatus only) */
- /** Sha3 digest (also ns only) */
- uint8_t digest_sha3_as_signed[DIGEST256_LEN];
- int refcnt; /**< Reference count for this cached_dir_t. */
-} cached_dir_t;
+typedef struct cached_dir_t cached_dir_t;
/** Enum used to remember where a signed_descriptor_t is stored and how to
* manage the memory for signed_descriptor_body. */
1
0
commit 3191ba389d12146b786ffd8af842a80e58c8c802
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 15:37:05 2018 -0400
Move extend_info_t into its own header.
---
src/or/bridges.c | 1 +
src/or/channeltls.c | 1 +
src/or/circpathbias.c | 1 +
src/or/circuitbuild.c | 1 +
src/or/circuitlist.c | 1 +
src/or/circuituse.c | 1 +
src/or/connection_edge.c | 1 +
src/or/extend_info_st.h | 28 ++++++++++++++++++++++++++++
src/or/hs_client.c | 1 +
src/or/hs_descriptor.c | 2 ++
src/or/hs_service.c | 1 +
src/or/include.am | 1 +
src/or/onion.c | 1 +
src/or/or.h | 19 +------------------
src/or/relay.c | 1 +
src/or/rendcache.c | 1 +
src/or/rendclient.c | 1 +
src/or/rendcommon.c | 1 +
src/or/rendservice.c | 1 +
src/or/router.c | 1 +
src/or/routerparse.c | 1 +
src/or/routerset.c | 1 +
src/test/rend_test_helpers.c | 1 +
src/test/test.c | 1 +
src/test/test_circuitbuild.c | 2 ++
src/test/test_circuitstats.c | 1 +
src/test/test_hs_client.c | 1 +
src/test/test_rendcache.c | 1 +
src/test/test_routerset.c | 1 +
29 files changed, 58 insertions(+), 18 deletions(-)
diff --git a/src/or/bridges.c b/src/or/bridges.c
index 013c45cd5..793f292a5 100644
--- a/src/or/bridges.c
+++ b/src/or/bridges.c
@@ -27,6 +27,7 @@
#include "routerset.h"
#include "transports.h"
+#include "extend_info_st.h"
#include "node_st.h"
#include "routerinfo_st.h"
#include "routerstatus_st.h"
diff --git a/src/or/channeltls.c b/src/or/channeltls.c
index e2b6cabd4..c345364cd 100644
--- a/src/or/channeltls.c
+++ b/src/or/channeltls.c
@@ -62,6 +62,7 @@
#include "cell_st.h"
#include "cell_queue_st.h"
+#include "extend_info_st.h"
#include "or_connection_st.h"
#include "or_handshake_certs_st.h"
#include "or_handshake_state_st.h"
diff --git a/src/or/circpathbias.c b/src/or/circpathbias.c
index a36d67526..6586fe447 100644
--- a/src/or/circpathbias.c
+++ b/src/or/circpathbias.c
@@ -38,6 +38,7 @@
#include "cell_st.h"
#include "cpath_build_state_st.h"
#include "crypt_path_st.h"
+#include "extend_info_st.h"
#include "origin_circuit_st.h"
static void pathbias_count_successful_close(origin_circuit_t *circ);
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 41afb7543..dfe293d4e 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -68,6 +68,7 @@
#include "cell_st.h"
#include "cpath_build_state_st.h"
#include "entry_connection_st.h"
+#include "extend_info_st.h"
#include "node_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index 46974aea4..95463fde3 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -96,6 +96,7 @@
#include "crypt_path_reference_st.h"
#include "dir_connection_st.h"
#include "edge_connection_st.h"
+#include "extend_info_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index 370e2c0b7..60ffe95b1 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -60,6 +60,7 @@
#include "cpath_build_state_st.h"
#include "dir_connection_st.h"
#include "entry_connection_st.h"
+#include "extend_info_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
#include "socks_request_st.h"
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 4f1b5d2d5..7ceb97e7c 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -101,6 +101,7 @@
#include "cpath_build_state_st.h"
#include "dir_connection_st.h"
#include "entry_connection_st.h"
+#include "extend_info_st.h"
#include "node_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
diff --git a/src/or/extend_info_st.h b/src/or/extend_info_st.h
new file mode 100644
index 000000000..42c638d6d
--- /dev/null
+++ b/src/or/extend_info_st.h
@@ -0,0 +1,28 @@
+/* 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 EXTEND_INFO_ST_H
+#define EXTEND_INFO_ST_H
+
+/** Information on router used when extending a circuit. We don't need a
+ * full routerinfo_t to extend: we only need addr:port:keyid to build an OR
+ * connection, and onion_key to create the onionskin. Note that for onehop
+ * general-purpose tunnels, the onion_key is NULL. */
+struct extend_info_t {
+ char nickname[MAX_HEX_NICKNAME_LEN+1]; /**< This router's nickname for
+ * display. */
+ /** Hash of this router's RSA identity key. */
+ char identity_digest[DIGEST_LEN];
+ /** Ed25519 identity for this router, if any. */
+ ed25519_public_key_t ed_identity;
+ uint16_t port; /**< OR port. */
+ tor_addr_t addr; /**< IP address. */
+ crypto_pk_t *onion_key; /**< Current onionskin key. */
+ curve25519_public_key_t curve25519_onion_key;
+};
+
+#endif
+
diff --git a/src/or/hs_client.c b/src/or/hs_client.c
index 18276bfb8..2237699bc 100644
--- a/src/or/hs_client.c
+++ b/src/or/hs_client.c
@@ -38,6 +38,7 @@
#include "cpath_build_state_st.h"
#include "dir_connection_st.h"
#include "entry_connection_st.h"
+#include "extend_info_st.h"
#include "origin_circuit_st.h"
/* Return a human-readable string for the client fetch status code. */
diff --git a/src/or/hs_descriptor.c b/src/or/hs_descriptor.c
index 096122392..bda4dd64b 100644
--- a/src/or/hs_descriptor.c
+++ b/src/or/hs_descriptor.c
@@ -67,6 +67,8 @@
#include "hs_config.h"
#include "torcert.h" /* tor_cert_encode_ed22519() */
+#include "extend_info_st.h"
+
/* Constant string value used for the descriptor format. */
#define str_hs_desc "hs-descriptor"
#define str_desc_cert "descriptor-signing-key-cert"
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index ef809a69f..46fb3bf68 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 "extend_info_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 ec8e27556..06e61e00d 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -230,6 +230,7 @@ ORHEADERS = \
src/or/entry_connection_st.h \
src/or/entry_port_cfg_st.h \
src/or/ext_orport.h \
+ src/or/extend_info_st.h \
src/or/extrainfo_st.h \
src/or/fallback_dirs.inc \
src/or/fp_pair.h \
diff --git a/src/or/onion.c b/src/or/onion.c
index ac2f40a55..c84cb13ad 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -78,6 +78,7 @@
#include "router.h"
#include "cell_st.h"
+#include "extend_info_st.h"
#include "or_circuit_st.h"
// trunnel
diff --git a/src/or/or.h b/src/or/or.h
index 66c863a82..b164cf0e7 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1502,24 +1502,7 @@ typedef enum store_type_t {
typedef struct desc_store_t desc_store_t;
typedef struct routerlist_t routerlist_t;
-
-/** Information on router used when extending a circuit. We don't need a
- * full routerinfo_t to extend: we only need addr:port:keyid to build an OR
- * connection, and onion_key to create the onionskin. Note that for onehop
- * general-purpose tunnels, the onion_key is NULL. */
-typedef struct extend_info_t {
- char nickname[MAX_HEX_NICKNAME_LEN+1]; /**< This router's nickname for
- * display. */
- /** Hash of this router's RSA identity key. */
- char identity_digest[DIGEST_LEN];
- /** Ed25519 identity for this router, if any. */
- ed25519_public_key_t ed_identity;
- uint16_t port; /**< OR port. */
- tor_addr_t addr; /**< IP address. */
- crypto_pk_t *onion_key; /**< Current onionskin key. */
- curve25519_public_key_t curve25519_onion_key;
-} extend_info_t;
-
+typedef struct extend_info_t extend_info_t;
typedef struct authority_cert_t authority_cert_t;
/** Bitfield enum type listing types of information that directory authorities
diff --git a/src/or/relay.c b/src/or/relay.c
index 62c9204db..6af7c8d1d 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -88,6 +88,7 @@
#include "dir_connection_st.h"
#include "destroy_cell_queue_st.h"
#include "entry_connection_st.h"
+#include "extend_info_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
#include "routerinfo_st.h"
diff --git a/src/or/rendcache.c b/src/or/rendcache.c
index 093cbe7ce..196ae9ad1 100644
--- a/src/or/rendcache.c
+++ b/src/or/rendcache.c
@@ -15,6 +15,7 @@
#include "routerparse.h"
#include "rendcommon.h"
+#include "extend_info_st.h"
#include "rend_intro_point_st.h"
#include "rend_service_descriptor_st.h"
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index 323612785..4154030b8 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -37,6 +37,7 @@
#include "crypt_path_st.h"
#include "dir_connection_st.h"
#include "entry_connection_st.h"
+#include "extend_info_st.h"
#include "origin_circuit_st.h"
#include "rend_intro_point_st.h"
#include "rend_service_descriptor_st.h"
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index 904969946..80cb79846 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 "extend_info_st.h"
#include "networkstatus_st.h"
#include "origin_circuit_st.h"
#include "rend_encoded_v2_service_descriptor_st.h"
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 170d78147..e207707e9 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 "extend_info_st.h"
#include "networkstatus_st.h"
#include "origin_circuit_st.h"
#include "rend_authorized_client_st.h"
diff --git a/src/or/router.c b/src/or/router.c
index ddbfb0313..614860f61 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -43,6 +43,7 @@
#include "crypt_path_st.h"
#include "dir_connection_st.h"
#include "dir_server_st.h"
+#include "extend_info_st.h"
#include "extrainfo_st.h"
#include "node_st.h"
#include "origin_circuit_st.h"
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 040745f65..31c545edf 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -83,6 +83,7 @@
#include "authority_cert_st.h"
#include "document_signature_st.h"
+#include "extend_info_st.h"
#include "extrainfo_st.h"
#include "microdesc_st.h"
#include "networkstatus_st.h"
diff --git a/src/or/routerset.c b/src/or/routerset.c
index 415fa0ce7..6da1c201b 100644
--- a/src/or/routerset.c
+++ b/src/or/routerset.c
@@ -36,6 +36,7 @@
#include "routerparse.h"
#include "routerset.h"
+#include "extend_info_st.h"
#include "node_st.h"
#include "routerinfo_st.h"
#include "routerstatus_st.h"
diff --git a/src/test/rend_test_helpers.c b/src/test/rend_test_helpers.c
index fb2e4cf50..ec252c39b 100644
--- a/src/test/rend_test_helpers.c
+++ b/src/test/rend_test_helpers.c
@@ -7,6 +7,7 @@
#include "rendcommon.h"
#include "rend_test_helpers.h"
+#include "extend_info_st.h"
#include "rend_intro_point_st.h"
#include "rend_service_descriptor_st.h"
diff --git a/src/test/test.c b/src/test/test.c
index 871498aa0..14456d866 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -62,6 +62,7 @@ double fabs(double x);
#include "statefile.h"
#include "crypto_curve25519.h"
+#include "extend_info_st.h"
#include "or_circuit_st.h"
#include "rend_encoded_v2_service_descriptor_st.h"
#include "rend_intro_point_st.h"
diff --git a/src/test/test_circuitbuild.c b/src/test/test_circuitbuild.c
index a5282df69..b09f7bf55 100644
--- a/src/test/test_circuitbuild.c
+++ b/src/test/test_circuitbuild.c
@@ -12,6 +12,8 @@
#include "config.h"
#include "circuitbuild.h"
+#include "extend_info_st.h"
+
/* Dummy nodes smartlist for testing */
static smartlist_t dummy_nodes;
/* Dummy exit extend_info for testing */
diff --git a/src/test/test_circuitstats.c b/src/test/test_circuitstats.c
index 9f6f4626d..b8056e0d1 100644
--- a/src/test/test_circuitstats.c
+++ b/src/test/test_circuitstats.c
@@ -19,6 +19,7 @@
#include "cpath_build_state_st.h"
#include "crypt_path_st.h"
+#include "extend_info_st.h"
#include "origin_circuit_st.h"
void test_circuitstats_timeout(void *arg);
diff --git a/src/test/test_hs_client.c b/src/test/test_hs_client.c
index ca87d5e92..64c098dbb 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 "extend_info_st.h"
#include "networkstatus_st.h"
#include "origin_circuit_st.h"
#include "socks_request_st.h"
diff --git a/src/test/test_rendcache.c b/src/test/test_rendcache.c
index 22af3473b..6bc803828 100644
--- a/src/test/test_rendcache.c
+++ b/src/test/test_rendcache.c
@@ -12,6 +12,7 @@
#include "config.h"
#include "hs_common.h"
+#include "extend_info_st.h"
#include "rend_encoded_v2_service_descriptor_st.h"
#include "rend_intro_point_st.h"
#include "rend_service_descriptor_st.h"
diff --git a/src/test/test_routerset.c b/src/test/test_routerset.c
index 004b88ac8..11a1ff2af 100644
--- a/src/test/test_routerset.c
+++ b/src/test/test_routerset.c
@@ -10,6 +10,7 @@
#include "policies.h"
#include "nodelist.h"
+#include "extend_info_st.h"
#include "node_st.h"
#include "routerinfo_st.h"
#include "routerstatus_st.h"
1
0

18 Jun '18
commit 1e4e9db8157e8691327fe9ee9de5df6fe9891040
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 14:14:11 2018 -0400
Extract authority_cert_t into its own header
---
src/or/authority_cert_st.h | 30 ++++++++++++++++++++++++++++++
src/or/dirauth/dirvote.c | 1 +
src/or/dirauth/shared_random.c | 1 +
src/or/directory.c | 1 +
src/or/include.am | 1 +
src/or/networkstatus.c | 1 +
src/or/or.h | 19 +------------------
src/or/router.c | 1 +
src/or/routerlist.c | 1 +
src/or/routerparse.c | 1 +
src/test/test_dir.c | 1 +
src/test/test_dir_common.c | 1 +
src/test/test_routerlist.c | 1 +
13 files changed, 42 insertions(+), 18 deletions(-)
diff --git a/src/or/authority_cert_st.h b/src/or/authority_cert_st.h
new file mode 100644
index 000000000..b1dbcddbe
--- /dev/null
+++ b/src/or/authority_cert_st.h
@@ -0,0 +1,30 @@
+/* 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 AUTHORITY_CERT_ST_H
+#define AUTHORITY_CERT_ST_H
+
+/** Certificate for v3 directory protocol: binds long-term authority identity
+ * keys to medium-term authority signing keys. */
+struct authority_cert_t {
+ /** Information relating to caching this cert on disk and looking it up. */
+ signed_descriptor_t cache_info;
+ /** This authority's long-term authority identity key. */
+ crypto_pk_t *identity_key;
+ /** This authority's medium-term signing key. */
+ crypto_pk_t *signing_key;
+ /** The digest of <b>signing_key</b> */
+ char signing_key_digest[DIGEST_LEN];
+ /** The listed expiration time of this certificate. */
+ time_t expires;
+ /** This authority's IPv4 address, in host order. */
+ uint32_t addr;
+ /** This authority's directory port. */
+ uint16_t dir_port;
+};
+
+#endif
+
diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c
index 1f95b985c..29134868c 100644
--- a/src/or/dirauth/dirvote.c
+++ b/src/or/dirauth/dirvote.c
@@ -28,6 +28,7 @@
#include "dirauth/mode.h"
#include "dirauth/shared_random_state.h"
+#include "authority_cert_st.h"
#include "dir_server_st.h"
#include "document_signature_st.h"
#include "networkstatus_st.h"
diff --git a/src/or/dirauth/shared_random.c b/src/or/dirauth/shared_random.c
index 137f695db..c042acda1 100644
--- a/src/or/dirauth/shared_random.c
+++ b/src/or/dirauth/shared_random.c
@@ -105,6 +105,7 @@
#include "dirauth/dirvote.h"
#include "dirauth/mode.h"
+#include "authority_cert_st.h"
#include "networkstatus_st.h"
/* String prefix of shared random values in votes/consensuses. */
diff --git a/src/or/directory.c b/src/or/directory.c
index b5a07f6b3..f3080bc1f 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -54,6 +54,7 @@
#include "dirauth/mode.h"
#include "dirauth/shared_random.h"
+#include "authority_cert_st.h"
#include "dir_connection_st.h"
#include "dir_server_st.h"
#include "entry_connection_st.h"
diff --git a/src/or/include.am b/src/or/include.am
index 396cfea5a..e73432d3c 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -181,6 +181,7 @@ endif
ORHEADERS = \
src/or/addressmap.h \
+ src/or/authority_cert_st.h \
src/or/auth_dirs.inc \
src/or/bridges.h \
src/or/channel.h \
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 6f7223b60..1951414a8 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -74,6 +74,7 @@
#include "dirauth/mode.h"
#include "dirauth/shared_random.h"
+#include "authority_cert_st.h"
#include "dir_connection_st.h"
#include "dir_server_st.h"
#include "document_signature_st.h"
diff --git a/src/or/or.h b/src/or/or.h
index a8ddcd240..1f7c4be50 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1911,24 +1911,7 @@ typedef struct extend_info_t {
curve25519_public_key_t curve25519_onion_key;
} extend_info_t;
-/** Certificate for v3 directory protocol: binds long-term authority identity
- * keys to medium-term authority signing keys. */
-typedef struct authority_cert_t {
- /** Information relating to caching this cert on disk and looking it up. */
- signed_descriptor_t cache_info;
- /** This authority's long-term authority identity key. */
- crypto_pk_t *identity_key;
- /** This authority's medium-term signing key. */
- crypto_pk_t *signing_key;
- /** The digest of <b>signing_key</b> */
- char signing_key_digest[DIGEST_LEN];
- /** The listed expiration time of this certificate. */
- time_t expires;
- /** This authority's IPv4 address, in host order. */
- uint32_t addr;
- /** This authority's directory port. */
- uint16_t dir_port;
-} authority_cert_t;
+typedef struct authority_cert_t authority_cert_t;
/** Bitfield enum type listing types of information that directory authorities
* can be authoritative about, and that directory caches may or may not cache.
diff --git a/src/or/router.c b/src/or/router.c
index 6d8f61d71..961fab129 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -39,6 +39,7 @@
#include "dirauth/mode.h"
+#include "authority_cert_st.h"
#include "crypt_path_st.h"
#include "dir_connection_st.h"
#include "dir_server_st.h"
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 102f3125a..3170ce601 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -125,6 +125,7 @@
#include "dirauth/dirvote.h"
#include "dirauth/mode.h"
+#include "authority_cert_st.h"
#include "dir_connection_st.h"
#include "dir_server_st.h"
#include "document_signature_st.h"
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index ea1320de7..34c851a1b 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -81,6 +81,7 @@
#include "dirauth/dirvote.h"
+#include "authority_cert_st.h"
#include "document_signature_st.h"
#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 9412f879d..ecce48942 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -45,6 +45,7 @@
#include "log_test_helpers.h"
#include "voting_schedule.h"
+#include "authority_cert_st.h"
#include "document_signature_st.h"
#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
diff --git a/src/test/test_dir_common.c b/src/test/test_dir_common.c
index 3fad1c3af..c23282ba8 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 "authority_cert_st.h"
#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "vote_microdesc_hash_st.h"
diff --git a/src/test/test_routerlist.c b/src/test/test_routerlist.c
index 45d63a806..1c2ba9d67 100644
--- a/src/test/test_routerlist.c
+++ b/src/test/test_routerlist.c
@@ -34,6 +34,7 @@
#include "dirauth/shared_random.h"
#include "statefile.h"
+#include "authority_cert_st.h"
#include "dir_connection_st.h"
#include "networkstatus_st.h"
#include "node_st.h"
1
0
commit 9d6276bca895101d5e76be52300b982b95284c69
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 14:38:30 2018 -0400
Extract microdesc_t into its own header.
---
src/or/circuitbuild.c | 1 +
src/or/control.c | 1 +
src/or/dirauth/dirvote.c | 1 +
src/or/dirserv.c | 1 +
src/or/include.am | 1 +
src/or/microdesc.c | 1 +
src/or/microdesc_st.h | 71 +++++++++++++++++++++++++++++++++++++++++++++
src/or/nodelist.c | 1 +
src/or/or.h | 62 +--------------------------------------
src/or/policies.c | 1 +
src/or/routerparse.c | 1 +
src/test/test_address_set.c | 1 +
src/test/test_entrynodes.c | 1 +
src/test/test_hs_common.c | 1 +
src/test/test_microdesc.c | 1 +
src/test/test_nodelist.c | 1 +
16 files changed, 86 insertions(+), 61 deletions(-)
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 4944a70ce..b871bd10c 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -70,6 +70,7 @@
#include "node_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
+#include "microdesc_st.h"
#include "routerstatus_st.h"
static channel_t * channel_connect_for_circuit(const tor_addr_t *addr,
diff --git a/src/or/control.c b/src/or/control.c
index c1d14b7a4..642d38774 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -90,6 +90,7 @@
#include "or_connection_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
+#include "microdesc_st.h"
#include "rend_authorized_client_st.h"
#include "rend_encoded_v2_service_descriptor_st.h"
#include "rend_service_descriptor_st.h"
diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c
index 29134868c..73fa07bfe 100644
--- a/src/or/dirauth/dirvote.c
+++ b/src/or/dirauth/dirvote.c
@@ -31,6 +31,7 @@
#include "authority_cert_st.h"
#include "dir_server_st.h"
#include "document_signature_st.h"
+#include "microdesc_st.h"
#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "node_st.h"
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index b76fa25d6..8cfccda61 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -38,6 +38,7 @@
#include "dir_connection_st.h"
#include "extrainfo_st.h"
+#include "microdesc_st.h"
#include "node_st.h"
#include "routerlist_st.h"
#include "tor_version_st.h"
diff --git a/src/or/include.am b/src/or/include.am
index 602b811be..564af4ba4 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -250,6 +250,7 @@ ORHEADERS = \
src/or/listener_connection_st.h \
src/or/main.h \
src/or/microdesc.h \
+ src/or/microdesc_st.h \
src/or/networkstatus.h \
src/or/networkstatus_st.h \
src/or/networkstatus_sr_info_st.h \
diff --git a/src/or/microdesc.c b/src/or/microdesc.c
index f125cf405..a194fb3b0 100644
--- a/src/or/microdesc.c
+++ b/src/or/microdesc.c
@@ -22,6 +22,7 @@
#include "routerlist.h"
#include "routerparse.h"
+#include "microdesc_st.h"
#include "networkstatus_st.h"
#include "node_st.h"
#include "routerstatus_st.h"
diff --git a/src/or/microdesc_st.h b/src/or/microdesc_st.h
new file mode 100644
index 000000000..f10a9ed7f
--- /dev/null
+++ b/src/or/microdesc_st.h
@@ -0,0 +1,71 @@
+/* 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 MICRODESC_ST_H
+#define MICRODESC_ST_H
+
+/** A microdescriptor is the smallest amount of information needed to build a
+ * circuit through a router. They are generated by the directory authorities,
+ * using information from the uploaded routerinfo documents. They are not
+ * self-signed, but are rather authenticated by having their hash in a signed
+ * networkstatus document. */
+struct microdesc_t {
+ /** Hashtable node, used to look up the microdesc by its digest. */
+ HT_ENTRY(microdesc_t) node;
+
+ /* Cache information */
+
+ /** When was this microdescriptor last listed in a consensus document?
+ * Once a microdesc has been unlisted long enough, we can drop it.
+ */
+ time_t last_listed;
+ /** Where is this microdescriptor currently stored? */
+ saved_location_bitfield_t saved_location : 3;
+ /** If true, do not attempt to cache this microdescriptor on disk. */
+ unsigned int no_save : 1;
+ /** If true, this microdesc has an entry in the microdesc_map */
+ unsigned int held_in_map : 1;
+ /** Reference count: how many node_ts have a reference to this microdesc? */
+ unsigned int held_by_nodes;
+
+ /** If saved_location == SAVED_IN_CACHE, this field holds the offset of the
+ * microdescriptor in the cache. */
+ off_t off;
+
+ /* The string containing the microdesc. */
+
+ /** A pointer to the encoded body of the microdescriptor. If the
+ * saved_location is SAVED_IN_CACHE, then the body is a pointer into an
+ * mmap'd region. Otherwise, it is a malloc'd string. The string might not
+ * be NUL-terminated; take the length from <b>bodylen</b>. */
+ char *body;
+ /** The length of the microdescriptor in <b>body</b>. */
+ size_t bodylen;
+ /** A SHA256-digest of the microdescriptor. */
+ char digest[DIGEST256_LEN];
+
+ /* Fields in the microdescriptor. */
+
+ /** As routerinfo_t.onion_pkey */
+ crypto_pk_t *onion_pkey;
+ /** As routerinfo_t.onion_curve25519_pkey */
+ curve25519_public_key_t *onion_curve25519_pkey;
+ /** Ed25519 identity key, if included. */
+ ed25519_public_key_t *ed25519_identity_pkey;
+ /** As routerinfo_t.ipv6_addr */
+ tor_addr_t ipv6_addr;
+ /** As routerinfo_t.ipv6_orport */
+ uint16_t ipv6_orport;
+ /** As routerinfo_t.family */
+ smartlist_t *family;
+ /** IPv4 exit policy summary */
+ short_policy_t *exit_policy;
+ /** IPv6 exit policy summary */
+ short_policy_t *ipv6_exit_policy;
+};
+
+#endif
+
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index b542fd516..91d100336 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 "microdesc_st.h"
#include "networkstatus_st.h"
#include "node_st.h"
#include "routerlist_st.h"
diff --git a/src/or/or.h b/src/or/or.h
index 0d564b1e2..40d7dfee3 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1715,67 +1715,7 @@ typedef struct short_policy_t {
short_policy_entry_t entries[FLEXIBLE_ARRAY_MEMBER];
} short_policy_t;
-/** A microdescriptor is the smallest amount of information needed to build a
- * circuit through a router. They are generated by the directory authorities,
- * using information from the uploaded routerinfo documents. They are not
- * self-signed, but are rather authenticated by having their hash in a signed
- * networkstatus document. */
-typedef struct microdesc_t {
- /** Hashtable node, used to look up the microdesc by its digest. */
- HT_ENTRY(microdesc_t) node;
-
- /* Cache information */
-
- /** When was this microdescriptor last listed in a consensus document?
- * Once a microdesc has been unlisted long enough, we can drop it.
- */
- time_t last_listed;
- /** Where is this microdescriptor currently stored? */
- saved_location_bitfield_t saved_location : 3;
- /** If true, do not attempt to cache this microdescriptor on disk. */
- unsigned int no_save : 1;
- /** If true, this microdesc has an entry in the microdesc_map */
- unsigned int held_in_map : 1;
- /** Reference count: how many node_ts have a reference to this microdesc? */
- unsigned int held_by_nodes;
-
- /** If saved_location == SAVED_IN_CACHE, this field holds the offset of the
- * microdescriptor in the cache. */
- off_t off;
-
- /* The string containing the microdesc. */
-
- /** A pointer to the encoded body of the microdescriptor. If the
- * saved_location is SAVED_IN_CACHE, then the body is a pointer into an
- * mmap'd region. Otherwise, it is a malloc'd string. The string might not
- * be NUL-terminated; take the length from <b>bodylen</b>. */
- char *body;
- /** The length of the microdescriptor in <b>body</b>. */
- size_t bodylen;
- /** A SHA256-digest of the microdescriptor. */
- char digest[DIGEST256_LEN];
-
- /* Fields in the microdescriptor. */
-
- /** As routerinfo_t.onion_pkey */
- crypto_pk_t *onion_pkey;
- /** As routerinfo_t.onion_curve25519_pkey */
- curve25519_public_key_t *onion_curve25519_pkey;
- /** Ed25519 identity key, if included. */
- ed25519_public_key_t *ed25519_identity_pkey;
- /** As routerinfo_t.ipv6_addr */
- tor_addr_t ipv6_addr;
- /** As routerinfo_t.ipv6_orport */
- uint16_t ipv6_orport;
- /** As routerinfo_t.family */
- smartlist_t *family;
- /** IPv4 exit policy summary */
- short_policy_t *exit_policy;
- /** IPv6 exit policy summary */
- short_policy_t *ipv6_exit_policy;
-
-} microdesc_t;
-
+typedef struct microdesc_t microdesc_t;
typedef struct node_t node_t;
typedef struct vote_microdesc_hash_t vote_microdesc_hash_t;
typedef struct vote_routerstatus_t vote_routerstatus_t;
diff --git a/src/or/policies.c b/src/or/policies.c
index 0c1e3497e..07cf12387 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -31,6 +31,7 @@
#include "ht.h"
#include "dir_server_st.h"
+#include "microdesc_st.h"
#include "node_st.h"
#include "port_cfg_st.h"
#include "routerstatus_st.h"
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 7a19460df..dee4220b6 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -84,6 +84,7 @@
#include "authority_cert_st.h"
#include "document_signature_st.h"
#include "extrainfo_st.h"
+#include "microdesc_st.h"
#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "ns_detached_signatures_st.h"
diff --git a/src/test/test_address_set.c b/src/test/test_address_set.c
index a704e6fb3..efc4d4e8a 100644
--- a/src/test/test_address_set.c
+++ b/src/test/test_address_set.c
@@ -10,6 +10,7 @@
#include "routerlist.h"
#include "torcert.h"
+#include "microdesc_st.h"
#include "networkstatus_st.h"
#include "routerstatus_st.h"
diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c
index d16af591d..6a93921f9 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 "microdesc_st.h"
#include "networkstatus_st.h"
#include "node_st.h"
#include "origin_circuit_st.h"
diff --git a/src/test/test_hs_common.c b/src/test/test_hs_common.c
index ea5fb4979..342626bcc 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 "microdesc_st.h"
#include "networkstatus_st.h"
#include "node_st.h"
#include "routerstatus_st.h"
diff --git a/src/test/test_microdesc.c b/src/test/test_microdesc.c
index 1fdac0924..593089335 100644
--- a/src/test/test_microdesc.c
+++ b/src/test/test_microdesc.c
@@ -13,6 +13,7 @@
#include "routerparse.h"
#include "torcert.h"
+#include "microdesc_st.h"
#include "networkstatus_st.h"
#include "routerstatus_st.h"
diff --git a/src/test/test_nodelist.c b/src/test/test_nodelist.c
index 018f109e5..e41557ed3 100644
--- a/src/test/test_nodelist.c
+++ b/src/test/test_nodelist.c
@@ -12,6 +12,7 @@
#include "nodelist.h"
#include "torcert.h"
+#include "microdesc_st.h"
#include "networkstatus_st.h"
#include "node_st.h"
#include "routerstatus_st.h"
1
0
commit 7dbe504f3e527ed5c266a43380eeec1a82914cc2
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 15:41:27 2018 -0400
Move hsdir_index_t into its own header.
---
src/or/hsdir_index_st.h | 24 ++++++++++++++++++++++++
src/or/include.am | 1 +
src/or/node_st.h | 2 ++
src/or/or.h | 13 +------------
4 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/src/or/hsdir_index_st.h b/src/or/hsdir_index_st.h
new file mode 100644
index 000000000..9d9ce66bd
--- /dev/null
+++ b/src/or/hsdir_index_st.h
@@ -0,0 +1,24 @@
+/* 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 HSDIR_INDEX_ST_H
+#define HSDIR_INDEX_ST_H
+
+/* Hidden service directory index used in a node_t which is set once we set
+ * the consensus. */
+struct hsdir_index_t {
+ /* HSDir index to use when fetching a descriptor. */
+ uint8_t fetch[DIGEST256_LEN];
+
+ /* HSDir index used by services to store their first and second
+ * descriptor. The first descriptor is chronologically older than the second
+ * one and uses older TP and SRV values. */
+ uint8_t store_first[DIGEST256_LEN];
+ uint8_t store_second[DIGEST256_LEN];
+};
+
+#endif
+
diff --git a/src/or/include.am b/src/or/include.am
index 06e61e00d..af525f35c 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -252,6 +252,7 @@ ORHEADERS = \
src/or/hs_ntor.h \
src/or/hs_stats.h \
src/or/hs_service.h \
+ src/or/hsdir_index_st.h \
src/or/keypin.h \
src/or/listener_connection_st.h \
src/or/main.h \
diff --git a/src/or/node_st.h b/src/or/node_st.h
index 511e23ad1..43206f662 100644
--- a/src/or/node_st.h
+++ b/src/or/node_st.h
@@ -7,6 +7,8 @@
#ifndef NODE_ST_H
#define NODE_ST_H
+#include "hsdir_index_st.h"
+
/** A node_t represents a Tor router.
*
* Specifically, a node_t is a Tor router as we are using it: a router that
diff --git a/src/or/or.h b/src/or/or.h
index b164cf0e7..7d4d963e0 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -899,18 +899,7 @@ struct hs_ident_edge_conn_t;
struct hs_ident_dir_conn_t;
struct hs_ident_circuit_t;
-/* Hidden service directory index used in a node_t which is set once we set
- * the consensus. */
-typedef struct hsdir_index_t {
- /* HSDir index to use when fetching a descriptor. */
- uint8_t fetch[DIGEST256_LEN];
-
- /* HSDir index used by services to store their first and second
- * descriptor. The first descriptor is chronologically older than the second
- * one and uses older TP and SRV values. */
- uint8_t store_first[DIGEST256_LEN];
- uint8_t store_second[DIGEST256_LEN];
-} hsdir_index_t;
+typedef struct hsdir_index_t hsdir_index_t;
/** Time interval for tracking replays of DH public keys received in
* INTRODUCE2 cells. Used only to avoid launching multiple
1
0

18 Jun '18
commit ed0731c7ded26d84975411f4a0e35f2500f3eb2a
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Fri Jun 15 14:49:15 2018 -0400
Extract routerinfo_t into its own header.
I was expecting this to be much worse.
---
src/or/bridges.c | 1 +
src/or/channeltls.c | 1 +
src/or/circuitbuild.c | 1 +
src/or/connection.c | 1 +
src/or/connection_or.c | 1 +
src/or/control.c | 1 +
src/or/dirauth/dirvote.c | 1 +
src/or/directory.c | 1 +
src/or/dirserv.c | 1 +
src/or/include.am | 1 +
src/or/main.c | 1 +
src/or/networkstatus.c | 1 +
src/or/nodelist.c | 1 +
src/or/or.h | 95 +------------------------------------
src/or/policies.c | 1 +
src/or/relay.c | 1 +
src/or/router.c | 1 +
src/or/routerinfo_st.h | 105 +++++++++++++++++++++++++++++++++++++++++
src/or/routerlist.c | 1 +
src/or/routerparse.c | 1 +
src/or/routerset.c | 1 +
src/or/status.c | 2 +
src/test/test_address_set.c | 1 +
src/test/test_config.c | 1 +
src/test/test_connection.c | 1 +
src/test/test_dir.c | 1 +
src/test/test_dir_common.c | 1 +
src/test/test_dir_handle_get.c | 1 +
src/test/test_entrynodes.c | 1 +
src/test/test_hs.c | 1 +
src/test/test_hs_common.c | 1 +
src/test/test_hs_service.c | 1 +
src/test/test_microdesc.c | 1 +
src/test/test_nodelist.c | 1 +
src/test/test_policy.c | 1 +
src/test/test_rendcache.c | 1 +
src/test/test_router.c | 2 +
src/test/test_routerset.c | 1 +
src/test/test_status.c | 1 +
39 files changed, 145 insertions(+), 94 deletions(-)
diff --git a/src/or/bridges.c b/src/or/bridges.c
index 3108e1495..013c45cd5 100644
--- a/src/or/bridges.c
+++ b/src/or/bridges.c
@@ -28,6 +28,7 @@
#include "transports.h"
#include "node_st.h"
+#include "routerinfo_st.h"
#include "routerstatus_st.h"
/** Information about a configured bridge. Currently this just matches the
diff --git a/src/or/channeltls.c b/src/or/channeltls.c
index 4d5677821..dd0c1628c 100644
--- a/src/or/channeltls.c
+++ b/src/or/channeltls.c
@@ -63,6 +63,7 @@
#include "or_connection_st.h"
#include "or_handshake_certs_st.h"
#include "or_handshake_state_st.h"
+#include "routerinfo_st.h"
/** How many CELL_PADDING cells have we received, ever? */
uint64_t stats_n_padding_cells_processed = 0;
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index b871bd10c..103dd6eb9 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -71,6 +71,7 @@
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
#include "microdesc_st.h"
+#include "routerinfo_st.h"
#include "routerstatus_st.h"
static channel_t * channel_connect_for_circuit(const tor_addr_t *addr,
diff --git a/src/or/connection.c b/src/or/connection.c
index 283f09652..6e133f8d4 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -119,6 +119,7 @@
#include "listener_connection_st.h"
#include "or_connection_st.h"
#include "port_cfg_st.h"
+#include "routerinfo_st.h"
#include "socks_request_st.h"
static connection_t *connection_listener_new(
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 070253dce..1810c3954 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -64,6 +64,7 @@
#include "or_connection_st.h"
#include "or_handshake_certs_st.h"
#include "or_handshake_state_st.h"
+#include "routerinfo_st.h"
static int connection_tls_finish_handshake(or_connection_t *conn);
static int connection_or_launch_v3_or_handshake(or_connection_t *conn);
diff --git a/src/or/control.c b/src/or/control.c
index 642d38774..520b6178f 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -94,6 +94,7 @@
#include "rend_authorized_client_st.h"
#include "rend_encoded_v2_service_descriptor_st.h"
#include "rend_service_descriptor_st.h"
+#include "routerinfo_st.h"
#include "routerlist_st.h"
#include "socks_request_st.h"
diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c
index 73fa07bfe..94a6139f5 100644
--- a/src/or/dirauth/dirvote.c
+++ b/src/or/dirauth/dirvote.c
@@ -36,6 +36,7 @@
#include "networkstatus_voter_info_st.h"
#include "node_st.h"
#include "ns_detached_signatures_st.h"
+#include "routerinfo_st.h"
#include "routerlist_st.h"
#include "vote_microdesc_hash_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/or/directory.c b/src/or/directory.c
index f3080bc1f..4e2e96886 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -61,6 +61,7 @@
#include "networkstatus_st.h"
#include "node_st.h"
#include "rend_service_descriptor_st.h"
+#include "routerinfo_st.h"
/**
* \file directory.c
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 8cfccda61..e54782d19 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -40,6 +40,7 @@
#include "extrainfo_st.h"
#include "microdesc_st.h"
#include "node_st.h"
+#include "routerinfo_st.h"
#include "routerlist_st.h"
#include "tor_version_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/or/include.am b/src/or/include.am
index 564af4ba4..468b231f7 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -296,6 +296,7 @@ ORHEADERS = \
src/or/rephist.h \
src/or/replaycache.h \
src/or/router.h \
+ src/or/routerinfo_st.h \
src/or/routerkeys.h \
src/or/routerlist.h \
src/or/routerlist_st.h \
diff --git a/src/or/main.c b/src/or/main.c
index 73c23ee98..664105046 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -126,6 +126,7 @@
#include "networkstatus_st.h"
#include "or_connection_st.h"
#include "port_cfg_st.h"
+#include "routerinfo_st.h"
#include "socks_request_st.h"
#ifdef HAVE_SYSTEMD
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 1951414a8..dd994f085 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -82,6 +82,7 @@
#include "networkstatus_voter_info_st.h"
#include "ns_detached_signatures_st.h"
#include "node_st.h"
+#include "routerinfo_st.h"
#include "routerlist_st.h"
#include "vote_microdesc_hash_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index 91d100336..5e575e9a8 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -72,6 +72,7 @@
#include "microdesc_st.h"
#include "networkstatus_st.h"
#include "node_st.h"
+#include "routerinfo_st.h"
#include "routerlist_st.h"
#include "routerstatus_st.h"
diff --git a/src/or/or.h b/src/or/or.h
index 40d7dfee3..208ec6d33 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1599,100 +1599,7 @@ typedef struct protover_summary_flags_t {
unsigned int supports_v3_rendezvous_point: 1;
} protover_summary_flags_t;
-/** Information about another onion router in the network. */
-typedef struct {
- signed_descriptor_t cache_info;
- char *nickname; /**< Human-readable OR name. */
-
- uint32_t addr; /**< IPv4 address of OR, in host order. */
- uint16_t or_port; /**< Port for TLS connections. */
- uint16_t dir_port; /**< Port for HTTP directory connections. */
-
- /** A router's IPv6 address, if it has one. */
- /* XXXXX187 Actually these should probably be part of a list of addresses,
- * not just a special case. Use abstractions to access these; don't do it
- * directly. */
- tor_addr_t ipv6_addr;
- uint16_t ipv6_orport;
-
- crypto_pk_t *onion_pkey; /**< Public RSA key for onions. */
- crypto_pk_t *identity_pkey; /**< Public RSA key for signing. */
- /** Public curve25519 key for onions */
- curve25519_public_key_t *onion_curve25519_pkey;
- /** What's the earliest expiration time on all the certs in this
- * routerinfo? */
- time_t cert_expiration_time;
-
- char *platform; /**< What software/operating system is this OR using? */
-
- char *protocol_list; /**< Encoded list of subprotocol versions supported
- * by this OR */
-
- /* link info */
- uint32_t bandwidthrate; /**< How many bytes does this OR add to its token
- * bucket per second? */
- uint32_t bandwidthburst; /**< How large is this OR's token bucket? */
- /** How many bytes/s is this router known to handle? */
- uint32_t bandwidthcapacity;
- smartlist_t *exit_policy; /**< What streams will this OR permit
- * to exit on IPv4? NULL for 'reject *:*'. */
- /** What streams will this OR permit to exit on IPv6?
- * NULL for 'reject *:*' */
- struct short_policy_t *ipv6_exit_policy;
- long uptime; /**< How many seconds the router claims to have been up */
- smartlist_t *declared_family; /**< Nicknames of router which this router
- * claims are its family. */
- char *contact_info; /**< Declared contact info for this router. */
- unsigned int is_hibernating:1; /**< Whether the router claims to be
- * hibernating */
- unsigned int caches_extra_info:1; /**< Whether the router says it caches and
- * serves extrainfo documents. */
- unsigned int allow_single_hop_exits:1; /**< Whether the router says
- * it allows single hop exits. */
-
- unsigned int wants_to_be_hs_dir:1; /**< True iff this router claims to be
- * a hidden service directory. */
- unsigned int policy_is_reject_star:1; /**< True iff the exit policy for this
- * router rejects everything. */
- /** True if, after we have added this router, we should re-launch
- * tests for it. */
- unsigned int needs_retest_if_added:1;
-
- /** True iff this router included "tunnelled-dir-server" in its descriptor,
- * implying it accepts tunnelled directory requests, or it advertised
- * dir_port > 0. */
- unsigned int supports_tunnelled_dir_requests:1;
-
- /** Used during voting to indicate that we should not include an entry for
- * this routerinfo. Used only during voting. */
- unsigned int omit_from_vote:1;
-
- /** Flags to summarize the protocol versions for this routerinfo_t. */
- protover_summary_flags_t pv;
-
-/** Tor can use this router for general positions in circuits; we got it
- * from a directory server as usual, or we're an authority and a server
- * uploaded it. */
-#define ROUTER_PURPOSE_GENERAL 0
-/** Tor should avoid using this router for circuit-building: we got it
- * from a controller. If the controller wants to use it, it'll have to
- * ask for it by identity. */
-#define ROUTER_PURPOSE_CONTROLLER 1
-/** Tor should use this router only for bridge positions in circuits: we got
- * it via a directory request from the bridge itself, or a bridge
- * authority. */
-#define ROUTER_PURPOSE_BRIDGE 2
-/** Tor should not use this router; it was marked in cached-descriptors with
- * a purpose we didn't recognize. */
-#define ROUTER_PURPOSE_UNKNOWN 255
-
- /** In what way did we find out about this router? One of ROUTER_PURPOSE_*.
- * Routers of different purposes are kept segregated and used for different
- * things; see notes on ROUTER_PURPOSE_* macros above.
- */
- uint8_t purpose;
-} routerinfo_t;
-
+typedef struct routerinfo_t routerinfo_t;
typedef struct extrainfo_t extrainfo_t;
typedef struct routerstatus_t routerstatus_t;
diff --git a/src/or/policies.c b/src/or/policies.c
index 07cf12387..bc4a9a920 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -34,6 +34,7 @@
#include "microdesc_st.h"
#include "node_st.h"
#include "port_cfg_st.h"
+#include "routerinfo_st.h"
#include "routerstatus_st.h"
/** Policy that addresses for incoming SOCKS connections must match. */
diff --git a/src/or/relay.c b/src/or/relay.c
index 1eaf6f7db..ff97b5266 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -87,6 +87,7 @@
#include "entry_connection_st.h"
#include "or_circuit_st.h"
#include "origin_circuit_st.h"
+#include "routerinfo_st.h"
#include "socks_request_st.h"
static edge_connection_t *relay_lookup_conn(circuit_t *circ, cell_t *cell,
diff --git a/src/or/router.c b/src/or/router.c
index 28dd360d3..ddbfb0313 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -47,6 +47,7 @@
#include "node_st.h"
#include "origin_circuit_st.h"
#include "port_cfg_st.h"
+#include "routerinfo_st.h"
/**
* \file router.c
diff --git a/src/or/routerinfo_st.h b/src/or/routerinfo_st.h
new file mode 100644
index 000000000..800a8cbe3
--- /dev/null
+++ b/src/or/routerinfo_st.h
@@ -0,0 +1,105 @@
+/* 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 ROUTERINFO_ST_H
+#define ROUTERINFO_ST_H
+
+/** Information about another onion router in the network. */
+struct routerinfo_t {
+ signed_descriptor_t cache_info;
+ char *nickname; /**< Human-readable OR name. */
+
+ uint32_t addr; /**< IPv4 address of OR, in host order. */
+ uint16_t or_port; /**< Port for TLS connections. */
+ uint16_t dir_port; /**< Port for HTTP directory connections. */
+
+ /** A router's IPv6 address, if it has one. */
+ /* XXXXX187 Actually these should probably be part of a list of addresses,
+ * not just a special case. Use abstractions to access these; don't do it
+ * directly. */
+ tor_addr_t ipv6_addr;
+ uint16_t ipv6_orport;
+
+ crypto_pk_t *onion_pkey; /**< Public RSA key for onions. */
+ crypto_pk_t *identity_pkey; /**< Public RSA key for signing. */
+ /** Public curve25519 key for onions */
+ curve25519_public_key_t *onion_curve25519_pkey;
+ /** What's the earliest expiration time on all the certs in this
+ * routerinfo? */
+ time_t cert_expiration_time;
+
+ char *platform; /**< What software/operating system is this OR using? */
+
+ char *protocol_list; /**< Encoded list of subprotocol versions supported
+ * by this OR */
+
+ /* link info */
+ uint32_t bandwidthrate; /**< How many bytes does this OR add to its token
+ * bucket per second? */
+ uint32_t bandwidthburst; /**< How large is this OR's token bucket? */
+ /** How many bytes/s is this router known to handle? */
+ uint32_t bandwidthcapacity;
+ smartlist_t *exit_policy; /**< What streams will this OR permit
+ * to exit on IPv4? NULL for 'reject *:*'. */
+ /** What streams will this OR permit to exit on IPv6?
+ * NULL for 'reject *:*' */
+ struct short_policy_t *ipv6_exit_policy;
+ long uptime; /**< How many seconds the router claims to have been up */
+ smartlist_t *declared_family; /**< Nicknames of router which this router
+ * claims are its family. */
+ char *contact_info; /**< Declared contact info for this router. */
+ unsigned int is_hibernating:1; /**< Whether the router claims to be
+ * hibernating */
+ unsigned int caches_extra_info:1; /**< Whether the router says it caches and
+ * serves extrainfo documents. */
+ unsigned int allow_single_hop_exits:1; /**< Whether the router says
+ * it allows single hop exits. */
+
+ unsigned int wants_to_be_hs_dir:1; /**< True iff this router claims to be
+ * a hidden service directory. */
+ unsigned int policy_is_reject_star:1; /**< True iff the exit policy for this
+ * router rejects everything. */
+ /** True if, after we have added this router, we should re-launch
+ * tests for it. */
+ unsigned int needs_retest_if_added:1;
+
+ /** True iff this router included "tunnelled-dir-server" in its descriptor,
+ * implying it accepts tunnelled directory requests, or it advertised
+ * dir_port > 0. */
+ unsigned int supports_tunnelled_dir_requests:1;
+
+ /** Used during voting to indicate that we should not include an entry for
+ * this routerinfo. Used only during voting. */
+ unsigned int omit_from_vote:1;
+
+ /** Flags to summarize the protocol versions for this routerinfo_t. */
+ protover_summary_flags_t pv;
+
+/** Tor can use this router for general positions in circuits; we got it
+ * from a directory server as usual, or we're an authority and a server
+ * uploaded it. */
+#define ROUTER_PURPOSE_GENERAL 0
+/** Tor should avoid using this router for circuit-building: we got it
+ * from a controller. If the controller wants to use it, it'll have to
+ * ask for it by identity. */
+#define ROUTER_PURPOSE_CONTROLLER 1
+/** Tor should use this router only for bridge positions in circuits: we got
+ * it via a directory request from the bridge itself, or a bridge
+ * authority. */
+#define ROUTER_PURPOSE_BRIDGE 2
+/** Tor should not use this router; it was marked in cached-descriptors with
+ * a purpose we didn't recognize. */
+#define ROUTER_PURPOSE_UNKNOWN 255
+
+ /** In what way did we find out about this router? One of ROUTER_PURPOSE_*.
+ * Routers of different purposes are kept segregated and used for different
+ * things; see notes on ROUTER_PURPOSE_* macros above.
+ */
+ uint8_t purpose;
+};
+
+#endif
+
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 425ad8273..ad7e4102c 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -133,6 +133,7 @@
#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
#include "node_st.h"
+#include "routerinfo_st.h"
#include "routerlist_st.h"
#include "vote_routerstatus_st.h"
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index dee4220b6..040745f65 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -91,6 +91,7 @@
#include "rend_authorized_client_st.h"
#include "rend_intro_point_st.h"
#include "rend_service_descriptor_st.h"
+#include "routerinfo_st.h"
#include "routerlist_st.h"
#include "tor_version_st.h"
#include "vote_microdesc_hash_st.h"
diff --git a/src/or/routerset.c b/src/or/routerset.c
index 1033702f3..415fa0ce7 100644
--- a/src/or/routerset.c
+++ b/src/or/routerset.c
@@ -37,6 +37,7 @@
#include "routerset.h"
#include "node_st.h"
+#include "routerinfo_st.h"
#include "routerstatus_st.h"
/** Return a new empty routerset. */
diff --git a/src/or/status.c b/src/or/status.c
index 4b8033d11..2cfc43679 100644
--- a/src/or/status.c
+++ b/src/or/status.c
@@ -30,6 +30,8 @@
#include "hs_service.h"
#include "dos.h"
+#include "routerinfo_st.h"
+
static void log_accounting(const time_t now, const or_options_t *options);
#include "geoip.h"
diff --git a/src/test/test_address_set.c b/src/test/test_address_set.c
index efc4d4e8a..93469573f 100644
--- a/src/test/test_address_set.c
+++ b/src/test/test_address_set.c
@@ -12,6 +12,7 @@
#include "microdesc_st.h"
#include "networkstatus_st.h"
+#include "routerinfo_st.h"
#include "routerstatus_st.h"
#include "test.h"
diff --git a/src/test/test_config.c b/src/test/test_config.c
index 2b761d2ba..ea0f45f22 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -46,6 +46,7 @@
#include "dir_server_st.h"
#include "port_cfg_st.h"
+#include "routerinfo_st.h"
static void
test_config_addressmap(void *arg)
diff --git a/src/test/test_connection.c b/src/test/test_connection.c
index 6f9c2706c..5d2aa65c8 100644
--- a/src/test/test_connection.c
+++ b/src/test/test_connection.c
@@ -28,6 +28,7 @@
#include "entry_connection_st.h"
#include "node_st.h"
#include "or_connection_st.h"
+#include "routerinfo_st.h"
#include "socks_request_st.h"
static void * test_conn_get_basic_setup(const struct testcase_t *tc);
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index c25665d3e..ac5b3bd7c 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -52,6 +52,7 @@
#include "networkstatus_voter_info_st.h"
#include "ns_detached_signatures_st.h"
#include "port_cfg_st.h"
+#include "routerinfo_st.h"
#include "routerlist_st.h"
#include "tor_version_st.h"
#include "vote_microdesc_hash_st.h"
diff --git a/src/test/test_dir_common.c b/src/test/test_dir_common.c
index c23282ba8..3ec9fd691 100644
--- a/src/test/test_dir_common.c
+++ b/src/test/test_dir_common.c
@@ -17,6 +17,7 @@
#include "authority_cert_st.h"
#include "networkstatus_st.h"
#include "networkstatus_voter_info_st.h"
+#include "routerinfo_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 c8704505e..3babffb9e 100644
--- a/src/test/test_dir_handle_get.c
+++ b/src/test/test_dir_handle_get.c
@@ -38,6 +38,7 @@
#include "dir_server_st.h"
#include "networkstatus_st.h"
#include "rend_encoded_v2_service_descriptor_st.h"
+#include "routerinfo_st.h"
#include "routerlist_st.h"
#ifdef _WIN32
diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c
index 6a93921f9..bc075e91a 100644
--- a/src/test/test_entrynodes.c
+++ b/src/test/test_entrynodes.c
@@ -37,6 +37,7 @@
#include "networkstatus_st.h"
#include "node_st.h"
#include "origin_circuit_st.h"
+#include "routerinfo_st.h"
#include "routerstatus_st.h"
#include "test_helpers.h"
diff --git a/src/test/test_hs.c b/src/test/test_hs.c
index c546af2fe..f2c520aee 100644
--- a/src/test/test_hs.c
+++ b/src/test/test_hs.c
@@ -25,6 +25,7 @@
#include "node_st.h"
#include "rend_encoded_v2_service_descriptor_st.h"
#include "rend_intro_point_st.h"
+#include "routerinfo_st.h"
#include "test_helpers.h"
diff --git a/src/test/test_hs_common.c b/src/test/test_hs_common.c
index 342626bcc..b4969fa7b 100644
--- a/src/test/test_hs_common.c
+++ b/src/test/test_hs_common.c
@@ -36,6 +36,7 @@
#include "microdesc_st.h"
#include "networkstatus_st.h"
#include "node_st.h"
+#include "routerinfo_st.h"
#include "routerstatus_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 ab27b4dc4..a4a1449b4 100644
--- a/src/test/test_hs_service.c
+++ b/src/test/test_hs_service.c
@@ -58,6 +58,7 @@
#include "networkstatus_st.h"
#include "node_st.h"
#include "origin_circuit_st.h"
+#include "routerinfo_st.h"
/* Trunnel */
#include "hs/cell_establish_intro.h"
diff --git a/src/test/test_microdesc.c b/src/test/test_microdesc.c
index 593089335..28d349466 100644
--- a/src/test/test_microdesc.c
+++ b/src/test/test_microdesc.c
@@ -15,6 +15,7 @@
#include "microdesc_st.h"
#include "networkstatus_st.h"
+#include "routerinfo_st.h"
#include "routerstatus_st.h"
#include "test.h"
diff --git a/src/test/test_nodelist.c b/src/test/test_nodelist.c
index e41557ed3..df69466fb 100644
--- a/src/test/test_nodelist.c
+++ b/src/test/test_nodelist.c
@@ -15,6 +15,7 @@
#include "microdesc_st.h"
#include "networkstatus_st.h"
#include "node_st.h"
+#include "routerinfo_st.h"
#include "routerstatus_st.h"
#include "test.h"
diff --git a/src/test/test_policy.c b/src/test/test_policy.c
index 71c623070..61ebd27dc 100644
--- a/src/test/test_policy.c
+++ b/src/test/test_policy.c
@@ -12,6 +12,7 @@
#include "node_st.h"
#include "port_cfg_st.h"
+#include "routerinfo_st.h"
#include "routerstatus_st.h"
/* Helper: assert that short_policy parses and writes back out as itself,
diff --git a/src/test/test_rendcache.c b/src/test/test_rendcache.c
index e5d531617..22af3473b 100644
--- a/src/test/test_rendcache.c
+++ b/src/test/test_rendcache.c
@@ -15,6 +15,7 @@
#include "rend_encoded_v2_service_descriptor_st.h"
#include "rend_intro_point_st.h"
#include "rend_service_descriptor_st.h"
+#include "routerinfo_st.h"
#include "rend_test_helpers.h"
#include "log_test_helpers.h"
diff --git a/src/test/test_router.c b/src/test/test_router.c
index 4e96e2453..d560a1aec 100644
--- a/src/test/test_router.c
+++ b/src/test/test_router.c
@@ -14,6 +14,8 @@
#include "router.h"
#include "routerlist.h"
+#include "routerinfo_st.h"
+
/* Test suite stuff */
#include "test.h"
diff --git a/src/test/test_routerset.c b/src/test/test_routerset.c
index 21db9bb3b..004b88ac8 100644
--- a/src/test/test_routerset.c
+++ b/src/test/test_routerset.c
@@ -11,6 +11,7 @@
#include "nodelist.h"
#include "node_st.h"
+#include "routerinfo_st.h"
#include "routerstatus_st.h"
#include "test.h"
diff --git a/src/test/test_status.c b/src/test/test_status.c
index 062a28f73..cedce1676 100644
--- a/src/test/test_status.c
+++ b/src/test/test_status.c
@@ -26,6 +26,7 @@
#include "statefile.h"
#include "origin_circuit_st.h"
+#include "routerinfo_st.h"
#include "test.h"
1
0