commit 3851128e886906aee5afa790c96f5b7dc2940454 Merge: 4f88eb849 4541289f2 Author: teor teor@torproject.org Date: Mon Jan 20 15:50:54 2020 +1000
Merge branch 'ticket20218_rebased_squashed' into ticket20218_merged
* ticket 32695 removed networkstatus_consensus_has_ipv6(), keep that change in master. * ticket 20218 modifies the function name and comment for routerstatus_has_visibly_changed(), keep that change in ticket20218_rebased_squashed.
changes/ticket20218 | 3 + src/feature/nodelist/fmt_routerstatus.c | 2 + src/feature/nodelist/networkstatus.c | 28 ++++-- src/feature/nodelist/networkstatus.h | 2 + src/feature/nodelist/routerstatus_st.h | 4 + src/test/test_nodelist.c | 167 ++++++++++++++++++++++++++++++++ 6 files changed, 198 insertions(+), 8 deletions(-)
diff --cc src/feature/nodelist/networkstatus.c index 58fad49a8,042852eb8..0d2ff96a6 --- a/src/feature/nodelist/networkstatus.c +++ b/src/feature/nodelist/networkstatus.c @@@ -1578,10 -1578,42 +1579,16 @@@ networkstatus_consensus_is_already_down return answer; }
- /** Given two router status entries for the same router identity, return 1 if - * if the contents have changed between them. Otherwise, return 0. */ - static int - routerstatus_has_changed(const routerstatus_t *a, const routerstatus_t *b) -/* Does the current, reasonably live consensus have IPv6 addresses? - * Returns 1 if there is a reasonably live consensus and its consensus method - * includes IPv6 addresses in the consensus. - * Otherwise, if there is no consensus, or the method does not include IPv6 - * addresses, returns 0. */ -int -networkstatus_consensus_has_ipv6(const or_options_t* options) -{ - const networkstatus_t *cons = networkstatus_get_reasonably_live_consensus( - approx_time(), - usable_consensus_flavor()); - - /* If we have no consensus, we have no IPv6 in it */ - if (!cons) { - return 0; - } - - /* Different flavours of consensus gained IPv6 at different times */ - if (we_use_microdescriptors_for_circuits(options)) { - return - cons->consensus_method >= MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS; - } else { - return 1; - } -} - + /** Given two router status entries for the same router identity, return 1 + * if the contents have changed between them. Otherwise, return 0. + * It only checks for fields that are output by control port. + * This should be kept in sync with the struct routerstatus_t + * and the printing function routerstatus_format_entry in + * NS_CONTROL_PORT mode. + **/ + STATIC int + routerstatus_has_visibly_changed(const routerstatus_t *a, + const routerstatus_t *b) { tor_assert(tor_memeq(a->identity_digest, b->identity_digest, DIGEST_LEN));