diff options
author | Linus Nordberg <linus@nordberg.se> | 2012-05-09 19:29:46 +0200 |
---|---|---|
committer | Linus Nordberg <linus@torproject.org> | 2012-07-19 18:21:21 +0200 |
commit | dda177b19e614c866d67a02aab1c0a83ca22760d (patch) | |
tree | a116807a6ffb812a550f4c2bb2cea3052dbf7efb /src | |
parent | 4cce8ab742999900a4c5f1f3f8faf13d217014e0 (diff) | |
download | tor-dda177b19e614c866d67a02aab1c0a83ca22760d.tar tor-dda177b19e614c866d67a02aab1c0a83ca22760d.tar.gz |
Add "a" line to status document.
Diffstat (limited to 'src')
-rw-r--r-- | src/or/dirserv.c | 17 | ||||
-rw-r--r-- | src/or/or.h | 2 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c index ad3c45da7..2af4e688c 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -2088,6 +2088,21 @@ routerstatus_format_entry(char *buf, size_t buf_len, return 0; cp = buf + strlen(buf); + + /* Possible "a" line, not included in consensus for now. */ + if (!tor_addr_is_null(&rs->ipv6_addr)) { + char buf[TOR_ADDR_BUF_LEN]; + r = tor_snprintf(cp, buf_len - (cp-buf), + "a %s:%d\n", + tor_addr_to_str(buf, &rs->ipv6_addr, sizeof(buf), 1), + (int)rs->ipv6_orport); + if (r<0) { + log_warn(LD_BUG, "Not enough space in buffer."); + return -1; + } + cp += strlen(cp); + } + /* NOTE: Whenever this list expands, be sure to increase MAX_FLAG_LINE_LEN*/ r = tor_snprintf(cp, buf_len - (cp-buf), "s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", @@ -2453,6 +2468,8 @@ set_routerstatus_from_routerinfo(routerstatus_t *rs, strlcpy(rs->nickname, ri->nickname, sizeof(rs->nickname)); rs->or_port = ri->or_port; rs->dir_port = ri->dir_port; + tor_addr_copy(&rs->ipv6_addr, &ri->ipv6_addr); + rs->ipv6_orport = ri->ipv6_orport; } /** Routerstatus <b>rs</b> is part of a group of routers that are on diff --git a/src/or/or.h b/src/or/or.h index 0684b9d6f..a8ef4d97c 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1824,6 +1824,8 @@ typedef struct routerstatus_t { uint32_t addr; /**< IPv4 address for this router. */ uint16_t or_port; /**< OR port for this router. */ uint16_t dir_port; /**< Directory port for this router. */ + tor_addr_t ipv6_addr; /**< IPv6 address for this router. */ + uint16_t ipv6_orport; /**<IPV6 OR port for this router. */ unsigned int is_authority:1; /**< True iff this router is an authority. */ unsigned int is_exit:1; /**< True iff this router is a good exit. */ unsigned int is_stable:1; /**< True iff this router stays up a long time. */ |