From dda177b19e614c866d67a02aab1c0a83ca22760d Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Wed, 9 May 2012 19:29:46 +0200 Subject: Add "a" line to status document. --- src/or/dirserv.c | 17 +++++++++++++++++ src/or/or.h | 2 ++ 2 files changed, 19 insertions(+) (limited to 'src') 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 rs 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; /**