summaryrefslogtreecommitdiff
path: root/src/or/channel.c
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2017-06-23 18:34:41 -0400
committerNick Mathewson <nickm@torproject.org>2017-09-12 10:28:45 -0400
commit6d221c8f371a0c1809552b699f1afab8cde3bd31 (patch)
treef03bda8eca62ccf13b3f0a32af1baf595865bfd0 /src/or/channel.c
parent79e2e4d3cbabff41675aa1f7defb67f4acba398c (diff)
downloadtor-6d221c8f371a0c1809552b699f1afab8cde3bd31.tar.gz
tor-6d221c8f371a0c1809552b699f1afab8cde3bd31.zip
Ticket #17857: Apply padding off-switch to existing connections.
Diffstat (limited to 'src/or/channel.c')
-rw-r--r--src/or/channel.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/or/channel.c b/src/or/channel.c
index 8348ffd649..17b2191b77 100644
--- a/src/or/channel.c
+++ b/src/or/channel.c
@@ -66,6 +66,7 @@
#include "scheduler.h"
#include "compat_time.h"
#include "networkstatus.h"
+#include "rendservice.h"
/* Global lists of channels */
@@ -2712,17 +2713,26 @@ channel_do_open_actions(channel_t *chan)
/* Disable or reduce padding according to user prefs. */
if (chan->padding_enabled || get_options()->ConnectionPadding == 1) {
- if (!get_options()->ConnectionPadding ||
- (get_options()->Tor2webMode &&
- !networkstatus_get_param(NULL, "nf_pad_tor2web", 1, 0, 1))
- || (get_options()->HiddenServiceSingleHopMode &&
- !networkstatus_get_param(NULL, "nf_pad_single_onion", 1, 0, 1))) {
+ if (!get_options()->ConnectionPadding) {
+ /* Disable if torrc disabled */
channelpadding_disable_padding_on_channel(chan);
- }
-
- /* Padding can be forced and/or reduced by clients, regardless of if
- * the channel supports it */
- if (get_options()->ReducedConnectionPadding) {
+ } else if (get_options()->Tor2webMode &&
+ !networkstatus_get_param(NULL,
+ CHANNELPADDING_TOR2WEB_PARAM,
+ CHANNELPADDING_TOR2WEB_DEFAULT, 0, 1)) {
+ /* Disable if we're using tor2web and the consensus disabled padding
+ * for tor2web */
+ channelpadding_disable_padding_on_channel(chan);
+ } else if (rend_service_allow_non_anonymous_connection(get_options()) &&
+ !networkstatus_get_param(NULL,
+ CHANNELPADDING_SOS_PARAM,
+ CHANNELPADDING_SOS_DEFAULT, 0, 1)) {
+ /* Disable if we're using RSOS and the consensus disabled padding
+ * for RSOS*/
+ channelpadding_disable_padding_on_channel(chan);
+ } else if (get_options()->ReducedConnectionPadding) {
+ /* Padding can be forced and/or reduced by clients, regardless of if
+ * the channel supports it */
channelpadding_reduce_padding_on_channel(chan);
}
}