summaryrefslogtreecommitdiff
path: root/src/or/hs_config.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-07-13 08:51:14 -0400
committerDavid Goulet <dgoulet@torproject.org>2017-07-13 16:50:09 -0400
commit5d64ceb12defdc7db8402088fb2946c35274636a (patch)
treec89ac5b35065c96f874789b88c120b4484df31e9 /src/or/hs_config.c
parent3eeebd1b0ca43bc2523fb39349078277a40d4116 (diff)
downloadtor-5d64ceb12defdc7db8402088fb2946c35274636a.tar.gz
tor-5d64ceb12defdc7db8402088fb2946c35274636a.zip
prop224: Move service version into config object
It makes more sense to have the version in the configuration object of the service because it is afterall a torrc option (HiddenServiceVersion). Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/hs_config.c')
-rw-r--r--src/or/hs_config.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/or/hs_config.c b/src/or/hs_config.c
index 7e0124bb34..5f9282ea79 100644
--- a/src/or/hs_config.c
+++ b/src/or/hs_config.c
@@ -55,7 +55,7 @@ stage_services(smartlist_t *service_list)
* only >= v3 service. And remember, v2 has a different object type which is
* shadow copied from an hs_service_t type. */
SMARTLIST_FOREACH_BEGIN(service_list, hs_service_t *, s) {
- if (s->version == HS_VERSION_TWO) {
+ if (s->config.version == HS_VERSION_TWO) {
SMARTLIST_DEL_CURRENT(service_list, s);
hs_service_free(s);
}
@@ -157,7 +157,7 @@ config_has_invalid_options(const config_line_t *line_,
const config_line_t *line;
tor_assert(service);
- tor_assert(service->version <= HS_VERSION_MAX);
+ tor_assert(service->config.version <= HS_VERSION_MAX);
/* List of options that a v3 service doesn't support thus must exclude from
* its configuration. */
@@ -178,7 +178,7 @@ config_has_invalid_options(const config_line_t *line_,
{ opts_exclude_v3 }, /* v3. */
};
- optlist = exclude_lists[service->version].list;
+ optlist = exclude_lists[service->config.version].list;
if (optlist == NULL) {
/* No exclude options to look at for this version. */
goto end;
@@ -193,7 +193,8 @@ config_has_invalid_options(const config_line_t *line_,
if (!strcasecmp(line->key, opt)) {
log_warn(LD_CONFIG, "Hidden service option %s is incompatible with "
"version %" PRIu32 " of service in %s",
- opt, service->version, service->config.directory_path);
+ opt, service->config.version,
+ service->config.directory_path);
ret = 1;
/* Continue the loop so we can find all possible options. */
continue;
@@ -342,7 +343,7 @@ config_generic_service(const config_line_t *line_,
}
/* Version of the service. */
if (!strcasecmp(line->key, "HiddenServiceVersion")) {
- service->version =
+ service->config.version =
(uint32_t) helper_parse_uint64(line->key, line->value, HS_VERSION_MIN,
HS_VERSION_MAX, &ok);
if (!ok || have_version) {
@@ -462,7 +463,7 @@ config_service(const config_line_t *line, const or_options_t *options,
if (config_generic_service(line, options, service) < 0) {
goto err;
}
- tor_assert(service->version <= HS_VERSION_MAX);
+ tor_assert(service->config.version <= HS_VERSION_MAX);
/* Before we configure the service on a per-version basis, we'll make
* sure that this set of options for a service are valid that is for
* instance an option only for v2 is not used for v3. */
@@ -482,7 +483,7 @@ config_service(const config_line_t *line, const or_options_t *options,
/* Different functions are in charge of specific options for a version. We
* start just after the service directory line so once we hit another
* directory line, the function knows that it has to stop parsing. */
- switch (service->version) {
+ switch (service->config.version) {
case HS_VERSION_TWO:
ret = rend_config_service(line->next, options, &service->config);
break;