aboutsummaryrefslogtreecommitdiff
path: root/src/or/rendservice.c
diff options
context:
space:
mode:
authorYawning Angel <yawning@schwanenlied.me>2015-05-20 17:41:27 +0000
committerYawning Angel <yawning@schwanenlied.me>2015-05-20 17:41:27 +0000
commit712bf069781d7a6336501aab628f62ada4f4c4d7 (patch)
tree103291e345c2a2c03859ab20456c012d88652086 /src/or/rendservice.c
parentdb7bde08be59398488624bc377d1d5318182ee45 (diff)
downloadtor-712bf069781d7a6336501aab628f62ada4f4c4d7.tar.gz
tor-712bf069781d7a6336501aab628f62ada4f4c4d7.zip
Add support for 'HiddenServiceMaxStream' to 'ADD_ONION'.
Done as a separate commit to ease backporting the tunables to 0.2.6.x.
Diffstat (limited to 'src/or/rendservice.c')
-rw-r--r--src/or/rendservice.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 5d2225ec56..0329d70924 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -266,6 +266,23 @@ rend_add_service(rend_service_t *service)
service->intro_nodes = smartlist_new();
+ if (service->max_streams_per_circuit < 0) {
+ log_warn(LD_CONFIG, "Hidden service (%s) configured with negative max "
+ "streams per circuit; ignoring.",
+ rend_service_escaped_dir(service));
+ rend_service_free(service);
+ return -1;
+ }
+
+ if (service->max_streams_close_circuit < 0 ||
+ service->max_streams_close_circuit > 1) {
+ log_warn(LD_CONFIG, "Hidden service (%s) configured with invalid "
+ "max streams handling; ignoring.",
+ rend_service_escaped_dir(service));
+ rend_service_free(service);
+ return -1;
+ }
+
if (service->auth_type != REND_NO_AUTH &&
smartlist_len(service->clients) == 0) {
log_warn(LD_CONFIG, "Hidden service (%s) with client authorization but no "
@@ -792,7 +809,10 @@ rend_config_services(const or_options_t *options, int validate_only)
return 0;
}
-/** Add the ephemeral service <b>pk</b>/<b>ports</b> if possible.
+/** Add the ephemeral service <b>pk</b>/<b>ports</b> if possible, with
+ * <b>max_streams_per_circuit</b> streams allowed per rendezvous circuit,
+ * and circuit closure on max streams being exceeded set by
+ * <b>max_streams_close_circuit</b>.
*
* Regardless of sucess/failure, callers should not touch pk/ports after
* calling this routine, and may assume that correct cleanup has been done
@@ -803,6 +823,8 @@ rend_config_services(const or_options_t *options, int validate_only)
rend_service_add_ephemeral_status_t
rend_service_add_ephemeral(crypto_pk_t *pk,
smartlist_t *ports,
+ int max_streams_per_circuit,
+ int max_streams_close_circuit,
char **service_id_out)
{
*service_id_out = NULL;
@@ -816,6 +838,8 @@ rend_service_add_ephemeral(crypto_pk_t *pk,
s->ports = ports;
s->intro_period_started = time(NULL);
s->n_intro_points_wanted = NUM_INTRO_POINTS_DEFAULT;
+ s->max_streams_per_circuit = max_streams_per_circuit;
+ s->max_streams_close_circuit = max_streams_close_circuit;
if (rend_service_derive_key_digests(s) < 0) {
rend_service_free(s);
return RSAE_BADPRIVKEY;