aboutsummaryrefslogtreecommitdiff
path: root/src/feature/hs/hs_config.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-02-24 07:45:20 -0500
committerNick Mathewson <nickm@torproject.org>2020-02-24 07:45:20 -0500
commitcaa392a73ad6c8e215a4686955c9de98eeb07661 (patch)
tree50de29ea7cbbf27ae656a4b7a865f76c1a66ae63 /src/feature/hs/hs_config.c
parent7ba7f9c0de9d1b2435a01961379b3d85c4fc2ab5 (diff)
parent93cb8072becb4213525d08a87fdf7284e6257168 (diff)
downloadtor-caa392a73ad6c8e215a4686955c9de98eeb07661.tar.gz
tor-caa392a73ad6c8e215a4686955c9de98eeb07661.zip
Merge remote-tracking branch 'tor-github/pr/1685/head'
Diffstat (limited to 'src/feature/hs/hs_config.c')
-rw-r--r--src/feature/hs/hs_config.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/feature/hs/hs_config.c b/src/feature/hs/hs_config.c
index 64656b1935..684f7bc975 100644
--- a/src/feature/hs/hs_config.c
+++ b/src/feature/hs/hs_config.c
@@ -26,6 +26,7 @@
#include "feature/hs/hs_common.h"
#include "feature/hs/hs_config.h"
#include "feature/hs/hs_client.h"
+#include "feature/hs/hs_ob.h"
#include "feature/hs/hs_service.h"
#include "feature/rend/rendclient.h"
#include "feature/rend/rendservice.h"
@@ -219,6 +220,7 @@ config_has_invalid_options(const config_line_t *line_,
"HiddenServiceEnableIntroDoSDefense",
"HiddenServiceEnableIntroDoSRatePerSec",
"HiddenServiceEnableIntroDoSBurstPerSec",
+ "HiddenServiceOnionBalanceInstance",
NULL /* End marker. */
};
@@ -317,7 +319,7 @@ config_service_v3(const config_line_t *line_,
int have_num_ip = 0;
bool export_circuit_id = false; /* just to detect duplicate options */
bool dos_enabled = false, dos_rate_per_sec = false;
- bool dos_burst_per_sec = false;
+ bool dos_burst_per_sec = false, ob_instance = false;
const char *dup_opt_seen = NULL;
const config_line_t *line;
@@ -402,6 +404,27 @@ config_service_v3(const config_line_t *line_,
config->intro_dos_burst_per_sec);
continue;
}
+ if (!strcasecmp(line->key, "HiddenServiceOnionBalanceInstance")) {
+ bool enabled = !!helper_parse_uint64(line->key, line->value,
+ 0, 1, &ok);
+ if (!ok || ob_instance) {
+ if (ob_instance) {
+ dup_opt_seen = line->key;
+ }
+ goto err;
+ }
+ ob_instance = true;
+ if (!enabled) {
+ /* Skip if this is disabled. */
+ continue;
+ }
+ /* Option is enabled, parse config file. */
+ ok = hs_ob_parse_config_file(config);
+ if (!ok) {
+ goto err;
+ }
+ continue;
+ }
}
/* We do not load the key material for the service at this stage. This is