summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am21
-rw-r--r--changes/bug326714
-rw-r--r--changes/bug331244
-rw-r--r--changes/feature283615
-rw-r--r--changes/ticket250616
-rw-r--r--changes/ticket400535
-rw-r--r--changes/ticket401277
-rw-r--r--changes/ticket401592
-rw-r--r--changes/ticket401627
-rw-r--r--changes/ticket401646
-rw-r--r--doc/man/tor.1.txt28
-rwxr-xr-xscripts/build/combine_libs35
-rwxr-xr-xscripts/codegen/fuzzing_include_am.py7
-rw-r--r--src/app/include.am4
-rw-r--r--src/app/main/subsysmgr.c2
-rw-r--r--src/core/or/channel.c13
-rw-r--r--src/core/or/channel.h2
-rw-r--r--src/core/or/channeltls.c25
-rw-r--r--src/core/or/circuitbuild.c8
-rw-r--r--src/core/or/circuitpadding.c1
-rw-r--r--src/core/or/circuituse.c3
-rw-r--r--src/core/or/connection_edge.c4
-rw-r--r--src/core/or/or_connection_st.h5
-rw-r--r--src/feature/control/control_bootstrap.c12
-rw-r--r--src/feature/dirauth/dirauth_options.inc2
-rw-r--r--src/feature/dirauth/dirvote.c7
-rw-r--r--src/feature/dirauth/dirvote.h52
-rw-r--r--src/feature/dirclient/dirclient.c29
-rw-r--r--src/feature/nodelist/routerset.c45
-rw-r--r--src/feature/nodelist/routerset.h4
-rw-r--r--src/feature/relay/circuitbuild_relay.c1
-rw-r--r--src/test/conf_examples/bug_31495_1/expected2
-rw-r--r--src/test/conf_examples/bug_31495_1/expected_log1
-rw-r--r--src/test/conf_examples/bug_31495_1/torrc2
-rw-r--r--src/test/conf_examples/bug_31495_2/error1
-rw-r--r--src/test/conf_examples/bug_31495_2/torrc3
-rw-r--r--src/test/conf_examples/bug_31495_3/cmdline1
-rw-r--r--src/test/conf_examples/bug_31495_3/expected2
-rw-r--r--src/test/conf_examples/bug_31495_3/expected_log1
-rw-r--r--src/test/conf_examples/bug_31495_3/torrc3
-rw-r--r--src/test/conf_examples/multiple_routerset_1/expected1
-rw-r--r--src/test/conf_examples/multiple_routerset_1/expected_log1
-rw-r--r--src/test/conf_examples/multiple_routerset_1/torrc2
-rw-r--r--src/test/conf_examples/multiple_routerset_2/cmdline1
-rw-r--r--src/test/conf_examples/multiple_routerset_2/expected1
-rw-r--r--src/test/conf_examples/multiple_routerset_2/expected_log1
-rw-r--r--src/test/conf_examples/multiple_routerset_2/torrc2
-rw-r--r--src/test/conf_examples/multiple_routerset_3/cmdline1
-rw-r--r--src/test/conf_examples/multiple_routerset_3/expected1
-rw-r--r--src/test/conf_examples/multiple_routerset_3/expected_log1
-rw-r--r--src/test/conf_examples/multiple_routerset_3/torrc2
-rw-r--r--src/test/conf_examples/multiple_routerset_4/cmdline1
-rw-r--r--src/test/conf_examples/multiple_routerset_4/expected1
-rw-r--r--src/test/conf_examples/multiple_routerset_4/expected_log1
-rw-r--r--src/test/conf_examples/multiple_routerset_4/torrc3
-rw-r--r--src/test/fuzz/include.am7
-rw-r--r--src/test/include.am10
-rw-r--r--src/test/test_channel.c20
-rw-r--r--src/test/test_circuitbuild.c2
59 files changed, 362 insertions, 69 deletions
diff --git a/Makefile.am b/Makefile.am
index 136368088e..50b002139e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,6 +14,7 @@ CLEANFILES=
TESTS=
noinst_PROGRAMS=
DISTCLEANFILES=
+MOSTLYCLEANFILES=
bin_SCRIPTS=
AM_CPPFLAGS=\
-I$(top_srcdir)/src \
@@ -137,6 +138,13 @@ TOR_INTERNAL_LIBS = \
src/trunnel/libor-trunnel.a \
src/lib/libtor-trace.a
+libtor.a: $(TOR_INTERNAL_LIBS)
+ $(AM_V_AR) export AR="$(AR)"; \
+ export ARFLAGS="$(ARFLAGS)"; \
+ $(top_srcdir)/scripts/build/combine_libs libtor.a $(TOR_INTERNAL_LIBS)
+
+MOSTLYCLEANFILES += libtor.a
+
# Variants of the above for linking the testing variant of tor (for coverage
# and tests)
if UNITTESTS_ENABLED
@@ -148,6 +156,14 @@ TOR_INTERNAL_TESTING_LIBS = \
$(TOR_UTIL_TESTING_LIBS) \
src/trunnel/libor-trunnel-testing.a \
src/lib/libtor-trace.a
+
+src/test/libtor-testing.a: $(TOR_INTERNAL_TESTING_LIBS)
+ $(AM_V_AR) export AR="$(AR)"; \
+ export ARFLAGS="$(ARFLAGS)"; \
+ export RANLIB="$(RANLIB)"; \
+ $(top_srcdir)/scripts/build/combine_libs src/test/libtor-testing.a $(TOR_INTERNAL_TESTING_LIBS)
+
+MOSTLYCLEANFILES += src/test/libtor-testing.a
endif
TOR_LDFLAGS_CRYPTLIB=@TOR_LDFLAGS_openssl@
@@ -175,6 +191,7 @@ EXTRA_DIST+= \
Makefile.nmake \
README \
ReleaseNotes \
+ scripts/build/combine_libs \
scripts/maint/checkIncludes.py \
scripts/maint/checkSpace.pl \
scripts/maint/checkSpaceTest.sh \
@@ -701,7 +718,7 @@ show-distdir-core:
file $(distdir)/_build/core; fi
show-libs:
- @echo $(TOR_INTERNAL_LIBS)
+ @echo libtor.a
show-testing-libs:
- @echo $(TOR_INTERNAL_TESTING_LIBS)
+ @echo src/test/libtor-testing.a
diff --git a/changes/bug32671 b/changes/bug32671
new file mode 100644
index 0000000000..aa43d46543
--- /dev/null
+++ b/changes/bug32671
@@ -0,0 +1,4 @@
+ o Minor bugfixes (circuit padding):
+ - When circpad_send_padding_cell_for_callback is called,
+ `is_padding_timer_scheduled` flag was not reset. Now it is set to 0 at
+ the top of that function. Fixes bug 32671; bugfix on 0.4.0.1-alpha.
diff --git a/changes/bug33124 b/changes/bug33124
new file mode 100644
index 0000000000..bc7003d9b5
--- /dev/null
+++ b/changes/bug33124
@@ -0,0 +1,4 @@
+ o Minor bugfixes (SOCKS, onion services):
+ - Make sure we send the SOCKS request address in relay begin cells when a
+ stream is attached with the purpose CIRCUIT_PURPOSE_CONTROLLER. Fixes bug
+ 33124; bugfix on 0.0.5. Patch by Neel Chauhan.
diff --git a/changes/feature28361 b/changes/feature28361
new file mode 100644
index 0000000000..55bed9aea0
--- /dev/null
+++ b/changes/feature28361
@@ -0,0 +1,5 @@
+ o Minor feature (configuration):
+ - Allows configuration options EntryNodes, ExcludeNodes,
+ ExcludeExitNodes, ExitNodes, MiddleNodes, HSLayer2Nodes and
+ HSLayer3Nodes to be specified multiple times. Closes ticket
+ 28361. Patch by Daniel Pinto.
diff --git a/changes/ticket25061 b/changes/ticket25061
new file mode 100644
index 0000000000..9ab0e660bb
--- /dev/null
+++ b/changes/ticket25061
@@ -0,0 +1,6 @@
+ o Minor features (bootstrap reporting):
+ - When reporting bootstrapping status on a relay, do not consider
+ connections that have never been the target of an origin circuit.
+ Previously, all connection failures were treated as potential
+ bootstrapping failures, including those that had been opened because of
+ client requests. Closes ticket 25061.
diff --git a/changes/ticket40053 b/changes/ticket40053
new file mode 100644
index 0000000000..ec46ff269b
--- /dev/null
+++ b/changes/ticket40053
@@ -0,0 +1,5 @@
+ o Minor features (logging):
+ - Consider 301 as an error like a 404 when processing the response to a
+ request for a group of server descriptors or an extrainfo documents.
+ Closes ticket 40053.
+
diff --git a/changes/ticket40127 b/changes/ticket40127
new file mode 100644
index 0000000000..f546a8ea3b
--- /dev/null
+++ b/changes/ticket40127
@@ -0,0 +1,7 @@
+ o Minor features (compilation):
+ - When building Tor, first link all object files into a single
+ static library. This may help with embedding Tor in other
+ programs. Note that most Tor functions do not constitute a
+ part of a stable or supported API: Only those functions in
+ tor_api.h should be used if embedding Tor. Closes ticket
+ 40127.
diff --git a/changes/ticket40159 b/changes/ticket40159
new file mode 100644
index 0000000000..6484097544
--- /dev/null
+++ b/changes/ticket40159
@@ -0,0 +1,2 @@
+ o Minor features (logging):
+ - Print directory fetch information a single line. Closes ticket 40159.
diff --git a/changes/ticket40162 b/changes/ticket40162
new file mode 100644
index 0000000000..093042f9af
--- /dev/null
+++ b/changes/ticket40162
@@ -0,0 +1,7 @@
+ o Minor features (authorities):
+ - Authorities now list a different set of protocols as required and
+ recommended. These lists are chosen so that only truly recommended
+ and/or required protocols are included, and so that clients using 0.2.9
+ or later will continue to work (even though they are not supported),
+ whereas only relays running 0.3.5 or later will meet the requirements.
+ Closes ticket 40162.
diff --git a/changes/ticket40164 b/changes/ticket40164
new file mode 100644
index 0000000000..c96118d0a4
--- /dev/null
+++ b/changes/ticket40164
@@ -0,0 +1,6 @@
+ o Minor features (directory authority):
+ - Make it possible to specify multiple ConsensusParams torrc lines.
+ Now directory authority operators can for example put the main
+ ConsensusParams config in one torrc file and then add to it from
+ a different torrc file. Closes ticket 40164.
+
diff --git a/doc/man/tor.1.txt b/doc/man/tor.1.txt
index 860e1db33a..5f94f414b8 100644
--- a/doc/man/tor.1.txt
+++ b/doc/man/tor.1.txt
@@ -1863,6 +1863,9 @@ different from other Tor clients:
option overrides this option; if you have configured bridges and
UseBridges is 1, the Bridges are used as your entry nodes. +
+
+ This option can appear multiple times: the values from multiple lines are
+ spliced together. +
+ +
The ExcludeNodes option overrides this option: any node listed in both
EntryNodes and ExcludeNodes is treated as excluded. See
<<ExcludeNodes,ExcludeNodes>> for more information on how to specify nodes.
@@ -1875,6 +1878,9 @@ different from other Tor clients:
(Example:
ExcludeNodes ABCD1234CDEF5678ABCD1234CDEF5678ABCD1234, \{cc}, 255.254.0.0/8) +
+
+ This option can appear multiple times: the values from multiple lines are
+ spliced together. +
+ +
By default, this option is treated as a preference that Tor is allowed
to override in order to keep working.
For example, if you try to connect to a hidden service,
@@ -1900,13 +1906,19 @@ different from other Tor clients:
list too. See
<<ExcludeNodes,ExcludeNodes>> for more information on how to specify
nodes. See also the caveats on the <<ExitNodes,ExitNodes>> option below.
-
+ +
+ This option can appear multiple times: the values from multiple lines are
+ spliced together. +
+ +
[[ExitNodes]] **ExitNodes** __node__,__node__,__...__::
A list of identity fingerprints, country codes, and address
patterns of nodes to use as exit node---that is, a
node that delivers traffic for you *outside* the Tor network. See
<<ExcludeNodes,ExcludeNodes>> for more information on how to specify nodes. +
+
+ This option can appear multiple times: the values from multiple lines are
+ spliced together. +
+ +
Note that if you list too few nodes here, or if you exclude too many exit
nodes with ExcludeExitNodes, you can degrade functionality. For example,
if none of the exits you list allows traffic on port 80 or 443, you won't
@@ -1945,6 +1957,9 @@ different from other Tor clients:
(Example:
HSLayer2Nodes ABCD1234CDEF5678ABCD1234CDEF5678ABCD1234, \{cc}, 255.254.0.0/8) +
+
+ This option can appear multiple times: the values from multiple lines are
+ spliced together. +
+ +
When this is set, the resulting hidden service paths will
look like:
+
@@ -2001,6 +2016,9 @@ different from other Tor clients:
(Example:
HSLayer3Nodes ABCD1234CDEF5678ABCD1234CDEF5678ABCD1234, \{cc}, 255.254.0.0/8) +
+
+ This option can appear multiple times: the values from multiple lines are
+ spliced together. +
+ +
When this is set by itself, the resulting hidden service paths
will look like: +
C - G - M - L3 - Rend +
@@ -2048,7 +2066,10 @@ different from other Tor clients:
to use for "middle" hops in your normal circuits.
Normal circuits include all circuits except for direct connections
to directory servers. Middle hops are all hops other than exit and entry.
-+
+ +
+ This option can appear multiple times: the values from multiple lines are
+ spliced together. +
+ +
This is an **experimental** feature that is meant to be used by researchers
and developers to test new features in the Tor network safely. Using it
without care will strongly influence your anonymity. Other tor features may
@@ -3041,7 +3062,8 @@ on the public Tor network.
[[ConsensusParams]] **ConsensusParams** __STRING__::
STRING is a space-separated list of key=value pairs that Tor will include
- in the "params" line of its networkstatus vote.
+ in the "params" line of its networkstatus vote. This directive can be
+ specified multiple times so you don't have to put it all on one line.
[[DirAllowPrivateAddresses]] **DirAllowPrivateAddresses** **0**|**1**::
If set to 1, Tor will accept server descriptors with arbitrary "Address"
diff --git a/scripts/build/combine_libs b/scripts/build/combine_libs
new file mode 100755
index 0000000000..fb311552fe
--- /dev/null
+++ b/scripts/build/combine_libs
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+set -e
+
+TMPDIR="$(mktemp -d -t tor_lib_combining.XXXXXX)"
+ORIGDIR="$(pwd)"
+
+trap 'cd "$ORIGDIR" && rm -rf "$TMPDIR"' 0
+
+abspath() {
+ echo "$(cd "$(dirname "$1")">/dev/null && pwd)/$(basename "$1")"
+}
+
+TARGET=$(abspath "$1")
+
+#echo ORIGDIR="$ORIGDIR"
+#echo AR="$AR"
+#echo ARFLAGS="$AFLAGS"
+
+shift
+
+for input in "$@"; do
+ cd "$ORIGDIR"
+ abs=$(abspath "$input")
+ dir="$TMPDIR"/$(basename "$input" .a)
+ mkdir "$dir"
+ cd "$dir">/dev/null
+ ar x "$abs"
+done
+
+cd "$TMPDIR" >/dev/null
+#echo "${AR:-ar}" "${ARFLAGS:-cru}" library.tmp.a ./*/**
+"${AR:-ar}" "${ARFLAGS:-cru}" library.tmp.a ./*/**
+"${RANLIB:-ranlib}" library.tmp.a
+mv -f library.tmp.a "$TARGET"
diff --git a/scripts/codegen/fuzzing_include_am.py b/scripts/codegen/fuzzing_include_am.py
index b3892b6fd3..b52b956f81 100755
--- a/scripts/codegen/fuzzing_include_am.py
+++ b/scripts/codegen/fuzzing_include_am.py
@@ -31,17 +31,18 @@ FUZZING_CFLAGS = \
FUZZING_LDFLAG = \
@TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB) @TOR_LDFLAGS_libevent@
FUZZING_LIBS = \
- $(TOR_INTERNAL_TESTING_LIBS) \
+ src/test/libtor-testing.a \
$(rust_ldadd) \
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
@TOR_LIBEVENT_LIBS@ $(TOR_LIBS_CRYPTLIB) \
@TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ @CURVE25519_LIBS@ \
@TOR_SYSTEMD_LIBS@ \
@TOR_LZMA_LIBS@ \
- @TOR_ZSTD_LIBS@
+ @TOR_ZSTD_LIBS@ \
+ @TOR_TRACE_LIBS@
oss-fuzz-prereqs: \
- $(TOR_INTERNAL_TESTING_LIBS)
+ src/test/libtor-testing.a
noinst_HEADERS += \
src/test/fuzz/fuzzing.h
diff --git a/src/app/include.am b/src/app/include.am
index 8488a1bf19..b81fad0276 100644
--- a/src/app/include.am
+++ b/src/app/include.am
@@ -15,7 +15,7 @@ src_app_tor_SOURCES = src/app/main/tor_main.c
# matters a lot there, and is quite hard to debug if you forget to do it.
src_app_tor_LDFLAGS = @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB) @TOR_LDFLAGS_libevent@
-src_app_tor_LDADD = $(TOR_INTERNAL_LIBS) \
+src_app_tor_LDADD = libtor.a \
$(rust_ldadd) \
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ $(TOR_LIBS_CRYPTLIB) \
@TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
@@ -27,7 +27,7 @@ src_app_tor_cov_SOURCES = $(src_app_tor_SOURCES)
src_app_tor_cov_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
src_app_tor_cov_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
src_app_tor_cov_LDFLAGS = @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB) @TOR_LDFLAGS_libevent@
-src_app_tor_cov_LDADD = $(TOR_INTERNAL_TESTING_LIBS) \
+src_app_tor_cov_LDADD = src/test/libtor-testing.a \
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ $(TOR_LIBS_CRYPTLIB) \
@TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ \
@CURVE25519_LIBS@ @TOR_SYSTEMD_LIBS@ \
diff --git a/src/app/main/subsysmgr.c b/src/app/main/subsysmgr.c
index de601d28cd..349803cd46 100644
--- a/src/app/main/subsysmgr.c
+++ b/src/app/main/subsysmgr.c
@@ -300,7 +300,7 @@ subsystems_thread_cleanup(void)
void
subsystems_dump_list(void)
{
- for (unsigned i = 0; i < n_tor_subsystems - 1; ++i) {
+ for (unsigned i = 0; i < n_tor_subsystems; ++i) {
const subsys_fns_t *sys = tor_subsystems[i];
printf("% 4d\t%16s\t%s\n", sys->level, sys->name,
sys->location?sys->location:"");
diff --git a/src/core/or/channel.c b/src/core/or/channel.c
index d082174dc8..c163f53488 100644
--- a/src/core/or/channel.c
+++ b/src/core/or/channel.c
@@ -2395,12 +2395,16 @@ channel_is_better(channel_t *a, channel_t *b)
* *msg_out to a message describing the channel's state and our next action,
* and set *launch_out to a boolean indicated whether the caller should try to
* launch a new channel with channel_connect().
+ *
+ * If `for_origin_circ` is set, mark the channel as interesting for origin
+ * circuits, and therefore interesting for our bootstrapping reports.
*/
MOCK_IMPL(channel_t *,
channel_get_for_extend,(const char *rsa_id_digest,
const ed25519_public_key_t *ed_id,
const tor_addr_t *target_ipv4_addr,
const tor_addr_t *target_ipv6_addr,
+ bool for_origin_circ,
const char **msg_out,
int *launch_out))
{
@@ -2440,8 +2444,15 @@ channel_get_for_extend,(const char *rsa_id_digest,
if (!CHANNEL_IS_OPEN(chan)) {
/* If the address matches, don't launch a new connection for this
* circuit. */
- if (matches_target)
+ if (matches_target) {
++n_inprogress_goodaddr;
+ if (for_origin_circ) {
+ /* We were looking for a connection for an origin circuit; this one
+ * matches, so we'll note that we decided to use it for an origin
+ * circuit. */
+ channel_mark_as_used_for_origin_circuit(chan);
+ }
+ }
continue;
}
diff --git a/src/core/or/channel.h b/src/core/or/channel.h
index 606b0730b8..206d0fdc97 100644
--- a/src/core/or/channel.h
+++ b/src/core/or/channel.h
@@ -526,6 +526,7 @@ void channel_mark_for_close(channel_t *chan);
int channel_write_packed_cell(channel_t *chan, packed_cell_t *cell);
void channel_listener_mark_for_close(channel_listener_t *chan_l);
+void channel_mark_as_used_for_origin_circuit(channel_t *chan);
/* Channel callback registrations */
@@ -661,6 +662,7 @@ MOCK_DECL(channel_t *, channel_get_for_extend,(
const struct ed25519_public_key_t *ed_id,
const tor_addr_t *target_ipv4_addr,
const tor_addr_t *target_ipv6_addr,
+ bool for_origin_circ,
const char **msg_out,
int *launch_out));
diff --git a/src/core/or/channeltls.c b/src/core/or/channeltls.c
index a0debf8d22..32723fed1e 100644
--- a/src/core/or/channeltls.c
+++ b/src/core/or/channeltls.c
@@ -360,6 +360,31 @@ channel_tls_handle_incoming(or_connection_t *orconn)
return chan;
}
+/**
+ * Set the `potentially_used_for_bootstrapping` flag on the or_connection_t
+ * corresponding to the provided channel.
+ *
+ * This flag indicates that if the connection fails, it might be interesting
+ * to the bootstrapping subsystem. (The bootstrapping system only cares about
+ * channels that we have tried to use for our own circuits. Other channels
+ * may have been launched in response to EXTEND cells from somebody else, and
+ * if they fail, it won't necessarily indicate a bootstrapping problem.)
+ **/
+void
+channel_mark_as_used_for_origin_circuit(channel_t *chan)
+{
+ if (BUG(!chan))
+ return;
+ if (chan->magic != TLS_CHAN_MAGIC)
+ return;
+ channel_tls_t *tlschan = channel_tls_from_base(chan);
+ if (BUG(!tlschan))
+ return;
+
+ if (tlschan->conn)
+ tlschan->conn->potentially_used_for_bootstrapping = 1;
+}
+
/*********
* Casts *
********/
diff --git a/src/core/or/circuitbuild.c b/src/core/or/circuitbuild.c
index 3df0f9be8f..a3a7a8cf58 100644
--- a/src/core/or/circuitbuild.c
+++ b/src/core/or/circuitbuild.c
@@ -574,6 +574,7 @@ circuit_handle_first_hop(origin_circuit_t *circ)
&firsthop->extend_info->ed_identity,
orport4 ? &orport4->addr : NULL,
orport6 ? &orport6->addr : NULL,
+ true,
&msg,
&should_launch);
@@ -590,6 +591,11 @@ circuit_handle_first_hop(origin_circuit_t *circ)
log_info(LD_CIRC,"connect to firsthop failed. Closing.");
return -END_CIRC_REASON_CONNECTFAILED;
}
+ /* We didn't find a channel, but we're launching one for an origin
+ * circuit. (If we decided not to launch a channel, then we found at
+ * least one once good in-progress channel use for this circuit, and
+ * marked it in channel_get_for_extend().) */
+ channel_mark_as_used_for_origin_circuit(n_chan);
circuit_chan_publish(circ, n_chan);
}
@@ -602,6 +608,8 @@ circuit_handle_first_hop(origin_circuit_t *circ)
} else { /* it's already open. use it. */
tor_assert(!circ->base_.n_hop);
circ->base_.n_chan = n_chan;
+ /* We found a channel, and we're using it for an origin circuit. */
+ channel_mark_as_used_for_origin_circuit(n_chan);
circuit_chan_publish(circ, n_chan);
log_debug(LD_CIRC,"Conn open for %s. Delivering first onion skin.",
safe_str_client(extend_info_describe(firsthop->extend_info)));
diff --git a/src/core/or/circuitpadding.c b/src/core/or/circuitpadding.c
index 889ffb03f1..e6daba5469 100644
--- a/src/core/or/circuitpadding.c
+++ b/src/core/or/circuitpadding.c
@@ -1226,6 +1226,7 @@ circpad_send_padding_cell_for_callback(circpad_machine_runtime_t *mi)
circuit_t *circ = mi->on_circ;
int machine_idx = mi->machine_index;
mi->padding_scheduled_at_usec = 0;
+ mi->is_padding_timer_scheduled = 0;
circpad_statenum_t state = mi->current_state;
/* Make sure circuit didn't close on us */
diff --git a/src/core/or/circuituse.c b/src/core/or/circuituse.c
index 9b506e67a1..ace68cea53 100644
--- a/src/core/or/circuituse.c
+++ b/src/core/or/circuituse.c
@@ -2693,7 +2693,8 @@ link_apconn_to_circ(entry_connection_t *apconn, origin_circuit_t *circ,
apconn->may_use_optimistic_data = 0;
log_info(LD_APP, "Looks like completed circuit to %s %s allow "
"optimistic data for connection to %s",
- circ->base_.purpose == CIRCUIT_PURPOSE_C_GENERAL ?
+ (circ->base_.purpose == CIRCUIT_PURPOSE_C_GENERAL ||
+ circ->base_.purpose == CIRCUIT_PURPOSE_CONTROLLER) ?
/* node_describe() does the right thing if exitnode is NULL */
safe_str_client(node_describe(exitnode)) :
"hidden service",
diff --git a/src/core/or/connection_edge.c b/src/core/or/connection_edge.c
index 25337f0720..f22c49d036 100644
--- a/src/core/or/connection_edge.c
+++ b/src/core/or/connection_edge.c
@@ -1205,6 +1205,7 @@ connection_ap_expire_beginning(void)
}
if (circ->purpose != CIRCUIT_PURPOSE_C_GENERAL &&
+ circ->purpose != CIRCUIT_PURPOSE_CONTROLLER &&
circ->purpose != CIRCUIT_PURPOSE_C_HSDIR_GET &&
circ->purpose != CIRCUIT_PURPOSE_S_HSDIR_POST &&
circ->purpose != CIRCUIT_PURPOSE_C_MEASURE_TIMEOUT &&
@@ -3266,7 +3267,8 @@ connection_ap_handshake_send_begin,(entry_connection_t *ap_conn))
edge_conn->begincell_flags = connection_ap_get_begincell_flags(ap_conn);
tor_snprintf(payload,RELAY_PAYLOAD_SIZE, "%s:%d",
- (circ->base_.purpose == CIRCUIT_PURPOSE_C_GENERAL) ?
+ (circ->base_.purpose == CIRCUIT_PURPOSE_C_GENERAL ||
+ circ->base_.purpose == CIRCUIT_PURPOSE_CONTROLLER) ?
ap_conn->socks_request->address : "",
ap_conn->socks_request->port);
payload_len = (int)strlen(payload)+1;
diff --git a/src/core/or/or_connection_st.h b/src/core/or/or_connection_st.h
index 8e012a6b85..253fe67020 100644
--- a/src/core/or/or_connection_st.h
+++ b/src/core/or/or_connection_st.h
@@ -74,6 +74,11 @@ struct or_connection_t {
unsigned int is_outgoing:1;
unsigned int proxy_type:3; /**< One of PROXY_NONE...PROXY_HAPROXY */
unsigned int wide_circ_ids:1;
+ /** True iff a failure on this connection indicates a posssible
+ * bootstrapping problem. We set this as true if we notice that this
+ * connection could handle a pending origin circuit, or if we launch it to
+ * handle an origin circuit. */
+ unsigned int potentially_used_for_bootstrapping:1;
/** True iff this connection has had its bootstrap failure logged with
* control_event_bootstrap_problem. */
unsigned int have_noted_bootstrap_problem:1;
diff --git a/src/feature/control/control_bootstrap.c b/src/feature/control/control_bootstrap.c
index d4f2adde81..d6dfdad94e 100644
--- a/src/feature/control/control_bootstrap.c
+++ b/src/feature/control/control_bootstrap.c
@@ -348,6 +348,18 @@ control_event_bootstrap_prob_or, (const char *warn, int reason,
{
int dowarn = 0;
+ if (! or_conn->potentially_used_for_bootstrapping) {
+ /* We never decided that this channel was a good match for one of our
+ * origin_circuit_t objects. That means that we probably launched it
+ * for somebody else, most likely in response to an EXTEND cell.
+ *
+ * Since EXTEND cells can contain arbitrarily broken descriptions of
+ * relays, a failure on this connection here won't necessarily indicate a
+ * bootstrapping problem.
+ */
+ return;
+ }
+
if (or_conn->have_noted_bootstrap_problem)
return;
diff --git a/src/feature/dirauth/dirauth_options.inc b/src/feature/dirauth/dirauth_options.inc
index 40ef7c3bab..40a42b9092 100644
--- a/src/feature/dirauth/dirauth_options.inc
+++ b/src/feature/dirauth/dirauth_options.inc
@@ -53,7 +53,7 @@ CONF_VAR(AuthDirTestReachability, BOOL, 0, "1")
/** Authority only: key=value pairs that we add to our networkstatus
* consensus vote on the 'params' line. */
-CONF_VAR(ConsensusParams, STRING, 0, NULL)
+CONF_VAR(ConsensusParams, LINELIST, 0, NULL)
/** Authority only: minimum number of measured bandwidths we must see
* before we only believe measured bandwidths to assign flags. */
diff --git a/src/feature/dirauth/dirvote.c b/src/feature/dirauth/dirvote.c
index f56d3ef0a0..a1f9bb28ae 100644
--- a/src/feature/dirauth/dirvote.c
+++ b/src/feature/dirauth/dirvote.c
@@ -4795,9 +4795,12 @@ dirserv_generate_networkstatus_vote_obj(crypto_pk_t *private_key,
smartlist_sort_strings(v3_out->known_flags);
if (d_options->ConsensusParams) {
+ config_line_t *paramline = d_options->ConsensusParams;
v3_out->net_params = smartlist_new();
- smartlist_split_string(v3_out->net_params,
- d_options->ConsensusParams, NULL, 0, 0);
+ for ( ; paramline; paramline = paramline->next) {
+ smartlist_split_string(v3_out->net_params,
+ paramline->value, NULL, 0, 0);
+ }
smartlist_sort_strings(v3_out->net_params);
}
v3_out->bw_file_headers = bw_file_headers;
diff --git a/src/feature/dirauth/dirvote.h b/src/feature/dirauth/dirvote.h
index a4f1b8bfe9..4f48e45dc3 100644
--- a/src/feature/dirauth/dirvote.h
+++ b/src/feature/dirauth/dirvote.h
@@ -260,32 +260,60 @@ STATIC microdesc_t *dirvote_create_microdescriptor(const routerinfo_t *ri,
/** The recommended relay protocols for this authority's votes.
* Recommending a new protocol causes old tor versions to log a warning.
*/
-#define DIRVOTE_RECOMMEND_RELAY_PROTO \
- "Cons=1-2 Desc=1-2 DirCache=2 HSDir=2 HSIntro=4 HSRend=2 " \
- "Link=5 LinkAuth=3 Microdesc=1-2 Relay=2"
+#define DIRVOTE_RECOMMEND_RELAY_PROTO \
+ "Cons=2 " \
+ "Desc=2 " \
+ "DirCache=2 " \
+ "HSDir=2 " \
+ "HSIntro=4 " \
+ "HSRend=2 " \
+ "Link=4-5 " \
+ "LinkAuth=3 " \
+ "Microdesc=2 " \
+ "Relay=2"
+
/** The recommended client protocols for this authority's votes.
* Recommending a new protocol causes old tor versions to log a warning.
*/
-#define DIRVOTE_RECOMMEND_CLIENT_PROTO \
- "Cons=1-2 Desc=1-2 DirCache=2 HSDir=2 HSIntro=4 HSRend=2 " \
- "Link=5 LinkAuth=3 Microdesc=1-2 Relay=2"
+#define DIRVOTE_RECOMMEND_CLIENT_PROTO \
+ "Cons=2 " \
+ "Desc=2 " \
+ "DirCache=2 " \
+ "HSDir=2 " \
+ "HSIntro=4 " \
+ "HSRend=2 " \
+ "Link=4-5 " \
+ "Microdesc=2 " \
+ "Relay=2"
/** The required relay protocols for this authority's votes.
* WARNING: Requiring a new protocol causes old tor versions to shut down.
* Requiring the wrong protocols can break the tor network.
* See Proposal 303: When and how to remove support for protocol versions.
*/
-#define DIRVOTE_REQUIRE_RELAY_PROTO \
- "Cons=1 Desc=1 DirCache=1 HSDir=1 HSIntro=3 HSRend=1 " \
- "Link=3-4 Microdesc=1 Relay=1-2"
+#define DIRVOTE_REQUIRE_RELAY_PROTO \
+ "Cons=2 " \
+ "Desc=2 " \
+ "DirCache=2 " \
+ "HSDir=2 " \
+ "HSIntro=4 " \
+ "HSRend=2 " \
+ "Link=4-5 " \
+ "LinkAuth=3 " \
+ "Microdesc=2 " \
+ "Relay=2"
+
/** The required relay protocols for this authority's votes.
* WARNING: Requiring a new protocol causes old tor versions to shut down.
* Requiring the wrong protocols can break the tor network.
* See Proposal 303: When and how to remove support for protocol versions.
*/
-#define DIRVOTE_REQUIRE_CLIENT_PROTO \
- "Cons=1-2 Desc=1-2 DirCache=1 HSDir=1 HSIntro=3 HSRend=1 " \
- "Link=4 Microdesc=1-2 Relay=2"
+#define DIRVOTE_REQUIRE_CLIENT_PROTO \
+ "Cons=2 " \
+ "Desc=2 " \
+ "Link=4 " \
+ "Microdesc=2 " \
+ "Relay=2"
#endif /* defined(DIRVOTE_PRIVATE) */
diff --git a/src/feature/dirclient/dirclient.c b/src/feature/dirclient/dirclient.c
index f088ef8283..74e68ac6be 100644
--- a/src/feature/dirclient/dirclient.c
+++ b/src/feature/dirclient/dirclient.c
@@ -1987,7 +1987,7 @@ dirclient_dump_total_dls(void)
{
const or_options_t *options = get_options();
for (int bootstrapped = 0; bootstrapped < 2; ++bootstrapped) {
- bool first_time = true;
+ smartlist_t *lines = smartlist_new();
for (int i=0; i < DIR_PURPOSE_MAX_; ++i) {
uint64_t n = total_dl[i][bootstrapped];
if (n == 0)
@@ -1995,15 +1995,19 @@ dirclient_dump_total_dls(void)
if (options->SafeLogging_ != SAFELOG_SCRUB_NONE &&
purpose_needs_anonymity(i, ROUTER_PURPOSE_GENERAL, NULL))
continue;
- if (first_time) {
- log_notice(LD_NET,
- "While %sbootstrapping, fetched this many bytes: ",
- bootstrapped?"not ":"");
- first_time = false;
- }
- log_notice(LD_NET, " %"PRIu64" (%s)",
- n, dir_conn_purpose_to_string(i));
+ smartlist_add_asprintf(lines, "%"PRIu64" (%s)",
+ n, dir_conn_purpose_to_string(i));
+ }
+
+ if (smartlist_len(lines) > 0) {
+ char *log_line = smartlist_join_strings(lines, "; ", 0, NULL);
+ log_notice(LD_NET, "While %sbootstrapping, fetched this many bytes: %s",
+ bootstrapped?"not ":"", log_line);
+ tor_free(log_line);
+
+ SMARTLIST_FOREACH(lines, char *, s, tor_free(s));
}
+ smartlist_free(lines);
}
}
@@ -2505,9 +2509,12 @@ handle_response_fetch_desc(dir_connection_t *conn,
}
if (status_code != 200) {
int dir_okay = status_code == 404 ||
- (status_code == 400 && !strcmp(reason, "Servers unavailable."));
+ (status_code == 400 && !strcmp(reason, "Servers unavailable.")) ||
+ status_code == 301;
/* 404 means that it didn't have them; no big deal.
- * Older (pre-0.1.1.8) servers said 400 Servers unavailable instead. */
+ * Older (pre-0.1.1.8) servers said 400 Servers unavailable instead.
+ * 301 is considered as an error since Tor does not follow redirects,
+ * which means we failed to reach the server we wanted. */
log_fn(dir_okay ? LOG_INFO : LOG_WARN, LD_DIR,
"Received http status code %d (%s) from server %s "
"while fetching \"/tor/server/%s\". I'll try again soon.",
diff --git a/src/feature/nodelist/routerset.c b/src/feature/nodelist/routerset.c
index 7234dc5441..0d123956d9 100644
--- a/src/feature/nodelist/routerset.c
+++ b/src/feature/nodelist/routerset.c
@@ -56,6 +56,7 @@ routerset_new(void)
result->digests = digestmap_new();
result->policies = smartlist_new();
result->country_names = smartlist_new();
+ result->fragile = 0;
return result;
}
@@ -499,21 +500,32 @@ routerset_kv_parse(void *target, const config_line_t *line, char **errmsg,
const void *params)
{
(void)params;
- routerset_t **p = (routerset_t**)target;
- routerset_free(*p); // clear the old value, if any.
+ routerset_t **lines = target;
+
+ if (*lines && (*lines)->fragile) {
+ if (line->command == CONFIG_LINE_APPEND) {
+ (*lines)->fragile = 0;
+ } else {
+ routerset_free(*lines); // Represent empty sets as NULL
+ }
+ }
+
+ int ret;
routerset_t *rs = routerset_new();
if (routerset_parse(rs, line->value, line->key) < 0) {
- routerset_free(rs);
*errmsg = tor_strdup("Invalid router list.");
- return -1;
+ ret = -1;
} else {
- if (routerset_is_empty(rs)) {
- /* Represent empty sets as NULL. */
- routerset_free(rs);
+ if (!routerset_is_empty(rs)) {
+ if (!*lines) {
+ *lines = routerset_new();
+ }
+ routerset_union(*lines, rs);
}
- *p = rs;
- return 0;
+ ret = 0;
}
+ routerset_free(rs);
+ return ret;
}
/**
@@ -564,6 +576,15 @@ routerset_copy(void *dest, const void *src, const void *params)
return 0;
}
+static void
+routerset_mark_fragile(void *target, const void *params)
+{
+ (void)params;
+ routerset_t **ptr = (routerset_t **)target;
+ if (*ptr)
+ (*ptr)->fragile = 1;
+}
+
/**
* Function table to implement a routerset_t-based configuration type.
**/
@@ -571,7 +592,8 @@ static const var_type_fns_t routerset_type_fns = {
.kv_parse = routerset_kv_parse,
.encode = routerset_encode,
.clear = routerset_clear,
- .copy = routerset_copy
+ .copy = routerset_copy,
+ .mark_fragile = routerset_mark_fragile,
};
/**
@@ -585,5 +607,6 @@ static const var_type_fns_t routerset_type_fns = {
**/
const var_type_def_t ROUTERSET_type_defn = {
.name = "RouterList",
- .fns = &routerset_type_fns
+ .fns = &routerset_type_fns,
+ .flags = CFLG_NOREPLACE
};
diff --git a/src/feature/nodelist/routerset.h b/src/feature/nodelist/routerset.h
index 0e4fedf64e..18a0e31ba7 100644
--- a/src/feature/nodelist/routerset.h
+++ b/src/feature/nodelist/routerset.h
@@ -88,6 +88,10 @@ struct routerset_t {
* routerset_refresh_countries() whenever the geoip country list is
* reloaded. */
bitarray_t *countries;
+ /** If true, subsequent assignments to this routerset should replace
+ * it, not extend it. Set only on the first item in a routerset in an
+ * or_options_t. */
+ unsigned int fragile:1;
};
#endif /* defined(ROUTERSET_PRIVATE) */
#endif /* !defined(TOR_ROUTERSET_H) */
diff --git a/src/feature/relay/circuitbuild_relay.c b/src/feature/relay/circuitbuild_relay.c
index 64f3c341ae..289a5be557 100644
--- a/src/feature/relay/circuitbuild_relay.c
+++ b/src/feature/relay/circuitbuild_relay.c
@@ -475,6 +475,7 @@ circuit_extend(struct cell_t *cell, struct circuit_t *circ)
&ec.ed_pubkey,
ipv4_valid ? &ec.orport_ipv4.addr : NULL,
ipv6_valid ? &ec.orport_ipv6.addr : NULL,
+ false,
&msg,
&should_launch);
diff --git a/src/test/conf_examples/bug_31495_1/expected b/src/test/conf_examples/bug_31495_1/expected
new file mode 100644
index 0000000000..246347b668
--- /dev/null
+++ b/src/test/conf_examples/bug_31495_1/expected
@@ -0,0 +1,2 @@
+Bridge 127.0.0.1:9050
+UseBridges 1
diff --git a/src/test/conf_examples/bug_31495_1/expected_log b/src/test/conf_examples/bug_31495_1/expected_log
new file mode 100644
index 0000000000..a4b98345d6
--- /dev/null
+++ b/src/test/conf_examples/bug_31495_1/expected_log
@@ -0,0 +1 @@
+Configuration was valid \ No newline at end of file
diff --git a/src/test/conf_examples/bug_31495_1/torrc b/src/test/conf_examples/bug_31495_1/torrc
new file mode 100644
index 0000000000..ed6cccab3f
--- /dev/null
+++ b/src/test/conf_examples/bug_31495_1/torrc
@@ -0,0 +1,2 @@
+UseBridges 1
+Bridge 127.0.0.1:9050 \ No newline at end of file
diff --git a/src/test/conf_examples/bug_31495_2/error b/src/test/conf_examples/bug_31495_2/error
new file mode 100644
index 0000000000..1417806c60
--- /dev/null
+++ b/src/test/conf_examples/bug_31495_2/error
@@ -0,0 +1 @@
+Failed to parse/validate config: You cannot set both UseBridges and EntryNodes. \ No newline at end of file
diff --git a/src/test/conf_examples/bug_31495_2/torrc b/src/test/conf_examples/bug_31495_2/torrc
new file mode 100644
index 0000000000..f629fff673
--- /dev/null
+++ b/src/test/conf_examples/bug_31495_2/torrc
@@ -0,0 +1,3 @@
+UseBridges 1
+Bridge 127.0.0.1:9050
+EntryNodes 127.0.0.1 \ No newline at end of file
diff --git a/src/test/conf_examples/bug_31495_3/cmdline b/src/test/conf_examples/bug_31495_3/cmdline
new file mode 100644
index 0000000000..478c1abe74
--- /dev/null
+++ b/src/test/conf_examples/bug_31495_3/cmdline
@@ -0,0 +1 @@
+/EntryNodes \ No newline at end of file
diff --git a/src/test/conf_examples/bug_31495_3/expected b/src/test/conf_examples/bug_31495_3/expected
new file mode 100644
index 0000000000..246347b668
--- /dev/null
+++ b/src/test/conf_examples/bug_31495_3/expected
@@ -0,0 +1,2 @@
+Bridge 127.0.0.1:9050
+UseBridges 1
diff --git a/src/test/conf_examples/bug_31495_3/expected_log b/src/test/conf_examples/bug_31495_3/expected_log
new file mode 100644
index 0000000000..a4b98345d6
--- /dev/null
+++ b/src/test/conf_examples/bug_31495_3/expected_log
@@ -0,0 +1 @@
+Configuration was valid \ No newline at end of file
diff --git a/src/test/conf_examples/bug_31495_3/torrc b/src/test/conf_examples/bug_31495_3/torrc
new file mode 100644
index 0000000000..f629fff673
--- /dev/null
+++ b/src/test/conf_examples/bug_31495_3/torrc
@@ -0,0 +1,3 @@
+UseBridges 1
+Bridge 127.0.0.1:9050
+EntryNodes 127.0.0.1 \ No newline at end of file
diff --git a/src/test/conf_examples/multiple_routerset_1/expected b/src/test/conf_examples/multiple_routerset_1/expected
new file mode 100644
index 0000000000..9087aaff06
--- /dev/null
+++ b/src/test/conf_examples/multiple_routerset_1/expected
@@ -0,0 +1 @@
+EntryNodes 127.0.0.1,127.0.0.2,127.0.0.3
diff --git a/src/test/conf_examples/multiple_routerset_1/expected_log b/src/test/conf_examples/multiple_routerset_1/expected_log
new file mode 100644
index 0000000000..a4b98345d6
--- /dev/null
+++ b/src/test/conf_examples/multiple_routerset_1/expected_log
@@ -0,0 +1 @@
+Configuration was valid \ No newline at end of file
diff --git a/src/test/conf_examples/multiple_routerset_1/torrc b/src/test/conf_examples/multiple_routerset_1/torrc
new file mode 100644
index 0000000000..44978e4b38
--- /dev/null
+++ b/src/test/conf_examples/multiple_routerset_1/torrc
@@ -0,0 +1,2 @@
+EntryNodes 127.0.0.1
+EntryNodes 127.0.0.2,127.0.0.3 \ No newline at end of file
diff --git a/src/test/conf_examples/multiple_routerset_2/cmdline b/src/test/conf_examples/multiple_routerset_2/cmdline
new file mode 100644
index 0000000000..d6e7970e53
--- /dev/null
+++ b/src/test/conf_examples/multiple_routerset_2/cmdline
@@ -0,0 +1 @@
+EntryNodes 127.0.0.4 \ No newline at end of file
diff --git a/src/test/conf_examples/multiple_routerset_2/expected b/src/test/conf_examples/multiple_routerset_2/expected
new file mode 100644
index 0000000000..34c893df79
--- /dev/null
+++ b/src/test/conf_examples/multiple_routerset_2/expected
@@ -0,0 +1 @@
+EntryNodes 127.0.0.4
diff --git a/src/test/conf_examples/multiple_routerset_2/expected_log b/src/test/conf_examples/multiple_routerset_2/expected_log
new file mode 100644
index 0000000000..a4b98345d6
--- /dev/null
+++ b/src/test/conf_examples/multiple_routerset_2/expected_log
@@ -0,0 +1 @@
+Configuration was valid \ No newline at end of file
diff --git a/src/test/conf_examples/multiple_routerset_2/torrc b/src/test/conf_examples/multiple_routerset_2/torrc
new file mode 100644
index 0000000000..44978e4b38
--- /dev/null
+++ b/src/test/conf_examples/multiple_routerset_2/torrc
@@ -0,0 +1,2 @@
+EntryNodes 127.0.0.1
+EntryNodes 127.0.0.2,127.0.0.3 \ No newline at end of file
diff --git a/src/test/conf_examples/multiple_routerset_3/cmdline b/src/test/conf_examples/multiple_routerset_3/cmdline
new file mode 100644
index 0000000000..425f383bc3
--- /dev/null
+++ b/src/test/conf_examples/multiple_routerset_3/cmdline
@@ -0,0 +1 @@
++EntryNodes 127.0.0.4 \ No newline at end of file
diff --git a/src/test/conf_examples/multiple_routerset_3/expected b/src/test/conf_examples/multiple_routerset_3/expected
new file mode 100644
index 0000000000..196b4814f8
--- /dev/null
+++ b/src/test/conf_examples/multiple_routerset_3/expected
@@ -0,0 +1 @@
+EntryNodes 127.0.0.1,127.0.0.2,127.0.0.3,127.0.0.4
diff --git a/src/test/conf_examples/multiple_routerset_3/expected_log b/src/test/conf_examples/multiple_routerset_3/expected_log
new file mode 100644
index 0000000000..a4b98345d6
--- /dev/null
+++ b/src/test/conf_examples/multiple_routerset_3/expected_log
@@ -0,0 +1 @@
+Configuration was valid \ No newline at end of file
diff --git a/src/test/conf_examples/multiple_routerset_3/torrc b/src/test/conf_examples/multiple_routerset_3/torrc
new file mode 100644
index 0000000000..44978e4b38
--- /dev/null
+++ b/src/test/conf_examples/multiple_routerset_3/torrc
@@ -0,0 +1,2 @@
+EntryNodes 127.0.0.1
+EntryNodes 127.0.0.2,127.0.0.3 \ No newline at end of file
diff --git a/src/test/conf_examples/multiple_routerset_4/cmdline b/src/test/conf_examples/multiple_routerset_4/cmdline
new file mode 100644
index 0000000000..478c1abe74
--- /dev/null
+++ b/src/test/conf_examples/multiple_routerset_4/cmdline
@@ -0,0 +1 @@
+/EntryNodes \ No newline at end of file
diff --git a/src/test/conf_examples/multiple_routerset_4/expected b/src/test/conf_examples/multiple_routerset_4/expected
new file mode 100644
index 0000000000..bc790c86e3
--- /dev/null
+++ b/src/test/conf_examples/multiple_routerset_4/expected
@@ -0,0 +1 @@
+ControlSocket 1234
diff --git a/src/test/conf_examples/multiple_routerset_4/expected_log b/src/test/conf_examples/multiple_routerset_4/expected_log
new file mode 100644
index 0000000000..a4b98345d6
--- /dev/null
+++ b/src/test/conf_examples/multiple_routerset_4/expected_log
@@ -0,0 +1 @@
+Configuration was valid \ No newline at end of file
diff --git a/src/test/conf_examples/multiple_routerset_4/torrc b/src/test/conf_examples/multiple_routerset_4/torrc
new file mode 100644
index 0000000000..dad8cb694e
--- /dev/null
+++ b/src/test/conf_examples/multiple_routerset_4/torrc
@@ -0,0 +1,3 @@
+ControlSocket 1234 # dummy to prevent empty output
+EntryNodes 127.0.0.1
+EntryNodes 127.0.0.2,127.0.0.3 \ No newline at end of file
diff --git a/src/test/fuzz/include.am b/src/test/fuzz/include.am
index 510ff35a3c..ef952c3812 100644
--- a/src/test/fuzz/include.am
+++ b/src/test/fuzz/include.am
@@ -7,17 +7,18 @@ FUZZING_CFLAGS = \
FUZZING_LDFLAG = \
@TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB) @TOR_LDFLAGS_libevent@
FUZZING_LIBS = \
- $(TOR_INTERNAL_TESTING_LIBS) \
+ src/test/libtor-testing.a \
$(rust_ldadd) \
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
@TOR_LIBEVENT_LIBS@ $(TOR_LIBS_CRYPTLIB) \
@TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ @CURVE25519_LIBS@ \
@TOR_SYSTEMD_LIBS@ \
@TOR_LZMA_LIBS@ \
- @TOR_ZSTD_LIBS@ @TOR_TRACE_LIBS@
+ @TOR_ZSTD_LIBS@ \
+ @TOR_TRACE_LIBS@
oss-fuzz-prereqs: \
- $(TOR_INTERNAL_TESTING_LIBS)
+ src/test/libtor-testing.a
noinst_HEADERS += \
src/test/fuzz/fuzzing.h
diff --git a/src/test/include.am b/src/test/include.am
index 173f007fbf..cb3a498f74 100644
--- a/src/test/include.am
+++ b/src/test/include.am
@@ -312,7 +312,7 @@ src_test_test_switch_id_LDADD = \
src_test_test_LDFLAGS = @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB) \
@TOR_LDFLAGS_libevent@
src_test_test_LDADD = \
- $(TOR_INTERNAL_TESTING_LIBS) \
+ src/test/libtor-testing.a \
$(rust_ldadd) \
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \
$(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
@@ -341,7 +341,7 @@ src_test_test_memwipe_LDFLAGS = $(src_test_test_LDFLAGS) @CFLAGS_BUGTRAP@
src_test_bench_LDFLAGS = @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB) \
@TOR_LDFLAGS_libevent@
src_test_bench_LDADD = \
- $(TOR_INTERNAL_LIBS) \
+ libtor.a \
$(rust_ldadd) \
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \
$(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
@@ -351,7 +351,7 @@ src_test_bench_LDADD = \
src_test_test_workqueue_LDFLAGS = @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB) \
@TOR_LDFLAGS_libevent@
src_test_test_workqueue_LDADD = \
- $(TOR_INTERNAL_TESTING_LIBS) \
+ src/test/libtor-testing.a \
$(rust_ldadd) \
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \
$(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
@@ -400,7 +400,7 @@ noinst_PROGRAMS+= src/test/test-hs-ntor-cl
src_test_test_ntor_cl_SOURCES = src/test/test_ntor_cl.c
src_test_test_ntor_cl_LDFLAGS = @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB)
src_test_test_ntor_cl_LDADD = \
- $(TOR_INTERNAL_LIBS) \
+ libtor.a \
$(rust_ldadd) \
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
$(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
@@ -411,7 +411,7 @@ src_test_test_ntor_cl_AM_CPPFLAGS = \
src_test_test_hs_ntor_cl_SOURCES = src/test/test_hs_ntor_cl.c
src_test_test_hs_ntor_cl_LDFLAGS = @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB)
src_test_test_hs_ntor_cl_LDADD = \
- $(TOR_INTERNAL_LIBS) \
+ libtor.a \
@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
$(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ \
@CURVE25519_LIBS@ @TOR_TRACE_LIBS@
diff --git a/src/test/test_channel.c b/src/test/test_channel.c
index 042eb27d9d..c86327ceb4 100644
--- a/src/test/test_channel.c
+++ b/src/test/test_channel.c
@@ -1382,7 +1382,7 @@ test_channel_for_extend(void *arg)
/* The expected result is chan2 because it is older than chan1. */
ret_chan = channel_get_for_extend(digest, &ed_id, &ipv4_addr, &ipv6_addr,
- &msg, &launch);
+ false, &msg, &launch);
tt_assert(ret_chan);
tt_ptr_op(ret_chan, OP_EQ, chan2);
tt_int_op(launch, OP_EQ, 0);
@@ -1391,7 +1391,7 @@ test_channel_for_extend(void *arg)
/* Switch that around from previous test. */
chan2->timestamp_created = chan1->timestamp_created + 1;
ret_chan = channel_get_for_extend(digest, &ed_id, &ipv4_addr, &ipv6_addr,
- &msg, &launch);
+ false, &msg, &launch);
tt_assert(ret_chan);
tt_ptr_op(ret_chan, OP_EQ, chan1);
tt_int_op(launch, OP_EQ, 0);
@@ -1401,7 +1401,7 @@ test_channel_for_extend(void *arg)
* channel 2 should be picked due to how channel_is_better() works. */
chan2->timestamp_created = chan1->timestamp_created;
ret_chan = channel_get_for_extend(digest, &ed_id, &ipv4_addr, &ipv6_addr,
- &msg, &launch);
+ false, &msg, &launch);
tt_assert(ret_chan);
tt_ptr_op(ret_chan, OP_EQ, chan1);
tt_int_op(launch, OP_EQ, 0);
@@ -1413,7 +1413,7 @@ test_channel_for_extend(void *arg)
/* Condemned the older channel. */
chan1->state = CHANNEL_STATE_CLOSING;
ret_chan = channel_get_for_extend(digest, &ed_id, &ipv4_addr, &ipv6_addr,
- &msg, &launch);
+ false, &msg, &launch);
tt_assert(ret_chan);
tt_ptr_op(ret_chan, OP_EQ, chan2);
tt_int_op(launch, OP_EQ, 0);
@@ -1423,7 +1423,7 @@ test_channel_for_extend(void *arg)
/* Make the older channel a client one. */
channel_mark_client(chan1);
ret_chan = channel_get_for_extend(digest, &ed_id, &ipv4_addr, &ipv6_addr,
- &msg, &launch);
+ false, &msg, &launch);
tt_assert(ret_chan);
tt_ptr_op(ret_chan, OP_EQ, chan2);
tt_int_op(launch, OP_EQ, 0);
@@ -1435,7 +1435,7 @@ test_channel_for_extend(void *arg)
memset(&dumb_ed_id, 0, sizeof(dumb_ed_id));
ret_chan = channel_get_for_extend(digest, &dumb_ed_id,
&ipv4_addr, &ipv6_addr,
- &msg, &launch);
+ false, &msg, &launch);
tt_assert(!ret_chan);
tt_str_op(msg, OP_EQ, "Not connected. Connecting.");
tt_int_op(launch, OP_EQ, 1);
@@ -1445,7 +1445,7 @@ test_channel_for_extend(void *arg)
chan1->state = CHANNEL_STATE_OPENING;
chan2->state = CHANNEL_STATE_OPENING;
ret_chan = channel_get_for_extend(digest, &ed_id, &ipv4_addr, &ipv6_addr,
- &msg, &launch);
+ false, &msg, &launch);
tt_assert(!ret_chan);
tt_str_op(msg, OP_EQ, "Connection in progress; waiting.");
tt_int_op(launch, OP_EQ, 0);
@@ -1455,7 +1455,7 @@ test_channel_for_extend(void *arg)
/* Mark channel 1 as bad for circuits. */
channel_mark_bad_for_new_circs(chan1);
ret_chan = channel_get_for_extend(digest, &ed_id, &ipv4_addr, &ipv6_addr,
- &msg, &launch);
+ false, &msg, &launch);
tt_assert(ret_chan);
tt_ptr_op(ret_chan, OP_EQ, chan2);
tt_int_op(launch, OP_EQ, 0);
@@ -1466,7 +1466,7 @@ test_channel_for_extend(void *arg)
channel_mark_bad_for_new_circs(chan1);
channel_mark_bad_for_new_circs(chan2);
ret_chan = channel_get_for_extend(digest, &ed_id, &ipv4_addr, &ipv6_addr,
- &msg, &launch);
+ false, &msg, &launch);
tt_assert(!ret_chan);
tt_str_op(msg, OP_EQ, "Connections all too old, or too non-canonical. "
" Launching a new one.");
@@ -1478,7 +1478,7 @@ test_channel_for_extend(void *arg)
test_chan_should_be_canonical = 0;
test_chan_should_match_target = 0;
ret_chan = channel_get_for_extend(digest, &ed_id, &ipv4_addr, &ipv6_addr,
- &msg, &launch);
+ false, &msg, &launch);
tt_assert(!ret_chan);
tt_str_op(msg, OP_EQ, "Connections all too old, or too non-canonical. "
" Launching a new one.");
diff --git a/src/test/test_circuitbuild.c b/src/test/test_circuitbuild.c
index 74824a1bc1..299908ce82 100644
--- a/src/test/test_circuitbuild.c
+++ b/src/test/test_circuitbuild.c
@@ -1214,6 +1214,7 @@ mock_channel_get_for_extend(const char *rsa_id_digest,
const ed25519_public_key_t *ed_id,
const tor_addr_t *target_ipv4_addr,
const tor_addr_t *target_ipv6_addr,
+ bool for_origin_circ,
const char **msg_out,
int *launch_out)
{
@@ -1221,6 +1222,7 @@ mock_channel_get_for_extend(const char *rsa_id_digest,
(void)ed_id;
(void)target_ipv4_addr;
(void)target_ipv6_addr;
+ (void)for_origin_circ;
/* channel_get_for_extend() requires non-NULL arguments */
tt_ptr_op(msg_out, OP_NE, NULL);