[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Add a consensus method for IPv6 address lines in the microdesc consensus



commit 56dbba32079484d88016bd34de04122457dbdd89
Author: teor <teor2345@xxxxxxxxx>
Date:   Sun Oct 15 12:10:51 2017 -0400

    Add a consensus method for IPv6 address lines in the microdesc consensus
    
    Implements #23826.
---
 src/or/dirserv.c | 8 +++++---
 src/or/dirvote.h | 6 +++++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 42ffdfa0d..ad6448a3d 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1949,8 +1949,10 @@ routerstatus_format_entry(const routerstatus_t *rs, const char *version,
    * networkstatus_type_t values, with an additional control port value
    * added -MP */
 
-  /* V3 microdesc consensuses don't have "a" lines. */
-  if (format == NS_V3_CONSENSUS_MICRODESC)
+  /* V3 microdesc consensuses only have "a" lines in later consensus methods
+   */
+  if (format == NS_V3_CONSENSUS_MICRODESC &&
+      consensus_method < MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS)
     goto done;
 
   /* Possible "a" line. At most one for now. */
@@ -1959,7 +1961,7 @@ routerstatus_format_entry(const routerstatus_t *rs, const char *version,
                            fmt_addrport(&rs->ipv6_addr, rs->ipv6_orport));
   }
 
-  if (format == NS_V3_CONSENSUS)
+  if (format == NS_V3_CONSENSUS || format == NS_V3_CONSENSUS_MICRODESC)
     goto done;
 
   smartlist_add_asprintf(chunks,
diff --git a/src/or/dirvote.h b/src/or/dirvote.h
index ddf32277d..b3838eee9 100644
--- a/src/or/dirvote.h
+++ b/src/or/dirvote.h
@@ -59,7 +59,7 @@
 #define MIN_SUPPORTED_CONSENSUS_METHOD 13
 
 /** The highest consensus method that we currently support. */
-#define MAX_SUPPORTED_CONSENSUS_METHOD 26
+#define MAX_SUPPORTED_CONSENSUS_METHOD 27
 
 /** Lowest consensus method where microdesc consensuses omit any entry
  * with no microdesc. */
@@ -119,6 +119,10 @@
  * instead of 0. See #14881 */
 #define MIN_METHOD_FOR_INIT_BW_WEIGHTS_ONE 26
 
+/** Lowest consensus method where the microdesc consensus contains relay IPv6
+ * addresses. See #23826 and #20916. */
+#define MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS 27
+
 /** Default bandwidth to clip unmeasured bandwidths to using method >=
  * MIN_METHOD_TO_CLIP_UNMEASURED_BW.  (This is not a consensus method; do not
  * get confused with the above macros.) */



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits