diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-09-12 10:29:00 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-09-12 10:29:00 -0400 |
commit | befddf6d2a46cd25beeb46357bf6cc4fe21802ce (patch) | |
tree | 60c991f1b43a4028abc7d33786ae2eff80ecc9df /src/or/channelpadding.c | |
parent | 469189d84a9b968be7a296c42ac540bf31824124 (diff) | |
parent | 6689c95d061d440ca16369583dac066cc35a6807 (diff) | |
download | tor-befddf6d2a46cd25beeb46357bf6cc4fe21802ce.tar.gz tor-befddf6d2a46cd25beeb46357bf6cc4fe21802ce.zip |
Merge branch 'ticket17857_squashed' into maint-0.3.1
Diffstat (limited to 'src/or/channelpadding.c')
-rw-r--r-- | src/or/channelpadding.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/or/channelpadding.c b/src/or/channelpadding.c index bed2489837..ccaf5b4ec8 100644 --- a/src/or/channelpadding.c +++ b/src/or/channelpadding.c @@ -21,6 +21,7 @@ #include "router.h" #include "compat_time.h" #include <event2/event.h> +#include "rendservice.h" STATIC int channelpadding_get_netflow_inactive_timeout_ms(const channel_t *); STATIC int channelpadding_send_disable_command(channel_t *); @@ -46,6 +47,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 +135,16 @@ 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, + CHANNELPADDING_TOR2WEB_PARAM, + CHANNELPADDING_TOR2WEB_DEFAULT, 0, 1); + + consensus_nf_pad_single_onion = + networkstatus_get_param(ns, + CHANNELPADDING_SOS_PARAM, + CHANNELPADDING_SOS_DEFAULT, 0, 1); } /** @@ -717,6 +732,25 @@ channelpadding_decide_to_pad_channel(channel_t *chan) return CHANNELPADDING_WONTPAD; } + if (options->Tor2webMode && !consensus_nf_pad_tor2web) { + /* If the consensus just changed values, this channel may still + * think padding is enabled. Negotiate it off. */ + if (chan->padding_enabled) + channelpadding_disable_padding_on_channel(chan); + + return CHANNELPADDING_WONTPAD; + } + + if (rend_service_allow_non_anonymous_connection(options) && + !consensus_nf_pad_single_onion) { + /* If the consensus just changed values, this channel may still + * think padding is enabled. Negotiate it off. */ + if (chan->padding_enabled) + channelpadding_disable_padding_on_channel(chan); + + return CHANNELPADDING_WONTPAD; + } + if (!chan->has_queued_writes(chan)) { int is_client_channel = 0; |