summaryrefslogtreecommitdiff
path: root/src/or/channelpadding.c
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2017-06-23 16:53:39 -0400
committerMike Perry <mikeperry-git@torproject.org>2017-06-23 16:53:39 -0400
commit79e2e4d3cbabff41675aa1f7defb67f4acba398c (patch)
tree9c1eba60e3b72c7deef375dc37020fe3f22db9a3 /src/or/channelpadding.c
parent784b29a2bfc7b7ce5ef355629528a38c50b81908 (diff)
downloadtor-79e2e4d3cbabff41675aa1f7defb67f4acba398c.tar.gz
tor-79e2e4d3cbabff41675aa1f7defb67f4acba398c.zip
Ticket #17857: Padding off-switch for single hop connections
This doesn't apply to currently active connections.. yet...
Diffstat (limited to 'src/or/channelpadding.c')
-rw-r--r--src/or/channelpadding.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/or/channelpadding.c b/src/or/channelpadding.c
index f5248e8960..9a2fdc4bbe 100644
--- a/src/or/channelpadding.c
+++ b/src/or/channelpadding.c
@@ -46,6 +46,10 @@ static int consensus_nf_conntimeout_clients;
static int consensus_nf_pad_before_usage;
/** Should we pad relay-to-relay connections? */
static int consensus_nf_pad_relays;
+/** Should we pad tor2web connections? */
+static int consensus_nf_pad_tor2web;
+/** Should we pad rosos connections? */
+static int consensus_nf_pad_single_onion;
#define TOR_MSEC_PER_SEC 1000
#define TOR_USEC_PER_MSEC 1000
@@ -130,6 +134,12 @@ channelpadding_new_consensus_params(networkstatus_t *ns)
consensus_nf_pad_relays =
networkstatus_get_param(ns, "nf_pad_relays", 0, 0, 1);
+
+ consensus_nf_pad_tor2web =
+ networkstatus_get_param(ns, "nf_pad_tor2web", 1, 0, 1);
+
+ consensus_nf_pad_single_onion =
+ networkstatus_get_param(ns, "nf_pad_single_onion", 1, 0, 1);
}
/**
@@ -707,6 +717,12 @@ channelpadding_decide_to_pad_channel(channel_t *chan)
return CHANNELPADDING_WONTPAD;
}
+ if (options->Tor2webMode && !consensus_nf_pad_tor2web)
+ return CHANNELPADDING_WONTPAD;
+
+ if (options->HiddenServiceSingleHopMode && !consensus_nf_pad_single_onion)
+ return CHANNELPADDING_WONTPAD;
+
if (!chan->has_queued_writes(chan)) {
int is_client_channel = 0;