[tor-commits] [tor/master] Add "a" line to status document.

nickm at torproject.org nickm at torproject.org
Thu Jul 19 21:53:06 UTC 2012


commit dda177b19e614c866d67a02aab1c0a83ca22760d
Author: Linus Nordberg <linus at nordberg.se>
Date:   Wed May 9 19:29:46 2012 +0200

    Add "a" line to status document.
---
 src/or/dirserv.c |   17 +++++++++++++++++
 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 ad3c45d..2af4e68 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 0684b9d..a8ef4d9 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. */





More information about the tor-commits mailing list