diff options
author | David Goulet <dgoulet@torproject.org> | 2016-11-08 13:22:42 -0500 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2016-11-08 13:22:42 -0500 |
commit | 34f14a35b60522e2482fade24ab455956370eee4 (patch) | |
tree | 6947a3d22d3a3d79cd7b18d9acd57be16253f105 /src/or/hs_descriptor.c | |
parent | 053cf55cab4753cf0bcfb7e3bc7cf7038833a3a7 (diff) | |
download | tor-34f14a35b60522e2482fade24ab455956370eee4.tar.gz tor-34f14a35b60522e2482fade24ab455956370eee4.zip |
hs: Add single-onion-service line to v3 descriptor
This field indicates if the service is a Single Onion Service if present in
the descriptor.
Closes #19642
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/hs_descriptor.c')
-rw-r--r-- | src/or/hs_descriptor.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/or/hs_descriptor.c b/src/or/hs_descriptor.c index 96db936735..1517ccb12e 100644 --- a/src/or/hs_descriptor.c +++ b/src/or/hs_descriptor.c @@ -26,6 +26,7 @@ /* Constant string value for the encrypted part of the descriptor. */ #define str_create2_formats "create2-formats" #define str_auth_required "authentication-required" +#define str_single_onion "single-onion-service" #define str_intro_point "introduction-point" #define str_ip_auth_key "auth-key" #define str_ip_enc_key "enc-key" @@ -63,6 +64,7 @@ static token_rule_t hs_desc_v3_token_table[] = { static token_rule_t hs_desc_encrypted_v3_token_table[] = { T1_START(str_create2_formats, R3_CREATE2_FORMATS, CONCAT_ARGS, NO_OBJ), T01(str_auth_required, R3_AUTHENTICATION_REQUIRED, ARGS, NO_OBJ), + T01(str_single_onion, R3_SINGLE_ONION_SERVICE, ARGS, NO_OBJ), END_OF_TABLE }; @@ -692,6 +694,10 @@ encode_encrypted_data(const hs_descriptor_t *desc, smartlist_add_asprintf(lines, "%s %s\n", str_auth_required, buf); tor_free(buf); } + + if (desc->encrypted_data.single_onion_service) { + smartlist_add_asprintf(lines, "%s\n", str_single_onion); + } } /* Build the introduction point(s) section. */ @@ -1613,6 +1619,13 @@ desc_decode_encrypted_v3(const hs_descriptor_t *desc, goto err; } } + + /* Is this service a single onion service? */ + tok = find_opt_by_keyword(tokens, R3_SINGLE_ONION_SERVICE); + if (tok) { + desc_encrypted_out->single_onion_service = 1; + } + /* Initialize the descriptor's introduction point list before we start * decoding. Having 0 intro point is valid. Then decode them all. */ desc_encrypted_out->intro_points = smartlist_new(); |