summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nordberg <linus@torproject.org>2012-08-31 23:02:19 +0200
committerNick Mathewson <nickm@torproject.org>2012-09-04 12:57:21 -0400
commit7a8366a3eb7081c29cbc0ebf0e9757cbfd71a86d (patch)
treea9757edc5f567b8d62daf837c76ff5d021c369e1
parente04e1a2e7d67861881c9e237dcea344dda39e858 (diff)
downloadtor-7a8366a3eb7081c29cbc0ebf0e9757cbfd71a86d.tar.gz
tor-7a8366a3eb7081c29cbc0ebf0e9757cbfd71a86d.zip
Add IPv6 OR port to microdesc_t and populate it.
-rw-r--r--src/or/or.h4
-rw-r--r--src/or/routerparse.c9
2 files changed, 13 insertions, 0 deletions
diff --git a/src/or/or.h b/src/or/or.h
index 7536afc690..4bf99e2eaa 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1960,6 +1960,10 @@ typedef struct microdesc_t {
/** As routerinfo_t.onion_pkey */
crypto_pk_t *onion_pkey;
+ /** As routerinfo_t.ipv6_add */
+ tor_addr_t ipv6_addr;
+ /** As routerinfo_t.ipv6_orport */
+ uint16_t ipv6_orport;
/** As routerinfo_t.family */
smartlist_t *family;
/** Exit policy summary */
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 60a2eae75f..4eec19f026 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -522,6 +522,7 @@ static token_rule_t networkstatus_detached_signature_token_table[] = {
/** List of tokens recognized in microdescriptors */
static token_rule_t microdesc_token_table[] = {
T1_START("onion-key", K_ONION_KEY, NO_ARGS, NEED_KEY_1024),
+ T0N("a", K_A, GE(1), NO_OBJ ),
T01("family", K_FAMILY, ARGS, NO_OBJ ),
T01("p", K_P, CONCAT_ARGS, NO_OBJ ),
A01("@last-listed", A_LAST_LISTED, CONCAT_ARGS, NO_OBJ ),
@@ -4421,6 +4422,14 @@ microdescs_parse_from_string(const char *s, const char *eos,
md->onion_pkey = tok->key;
tok->key = NULL;
+ {
+ smartlist_t *a_lines = find_all_by_keyword(tokens, K_A);
+ if (a_lines) {
+ find_single_ipv6_orport(a_lines, &md->ipv6_addr, &md->ipv6_orport);
+ smartlist_free(a_lines);
+ }
+ }
+
if ((tok = find_opt_by_keyword(tokens, K_FAMILY))) {
int i;
md->family = smartlist_new();