[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] hs: Remove v2 stats
commit 897ec8a34cbdfc510ddddd33cc027e13985fde8f
Author: David Goulet <dgoulet@xxxxxxxxxxxxxx>
Date: Tue Feb 16 10:36:13 2021 -0500
hs: Remove v2 stats
We still keep v2 rendezvous stats since we will allow them until the network
has entirely phased out.
Related to #40266
Signed-off-by: David Goulet <dgoulet@xxxxxxxxxxxxxx>
---
src/core/or/status.c | 3 +--
src/feature/hs/hs_service.c | 2 +-
src/feature/hs/hs_stats.c | 17 ++---------------
src/feature/hs/hs_stats.h | 3 +--
src/feature/stats/rephist.c | 37 +------------------------------------
src/feature/stats/rephist.h | 6 ------
6 files changed, 6 insertions(+), 62 deletions(-)
diff --git a/src/core/or/status.c b/src/core/or/status.c
index 00a88a3178..d027bcf81a 100644
--- a/src/core/or/status.c
+++ b/src/core/or/status.c
@@ -105,10 +105,9 @@ log_onion_service_stats(void)
}
log_notice(LD_HEARTBEAT,
- "Our onion service%s received %u v2 and %u v3 INTRODUCE2 cells "
+ "Our onion service%s received %u v3 INTRODUCE2 cells "
"and attempted to launch %d rendezvous circuits.",
num_services == 1 ? "" : "s",
- hs_stats_get_n_introduce2_v2_cells(),
hs_stats_get_n_introduce2_v3_cells(),
hs_stats_get_n_rendezvous_launches());
}
diff --git a/src/feature/hs/hs_service.c b/src/feature/hs/hs_service.c
index 79734a67d5..3e0ecb91e1 100644
--- a/src/feature/hs/hs_service.c
+++ b/src/feature/hs/hs_service.c
@@ -4075,7 +4075,7 @@ hs_service_receive_introduce2(origin_circuit_t *circ, const uint8_t *payload,
if (circ->hs_ident) {
ret = service_handle_introduce2(circ, payload, payload_len);
- hs_stats_note_introduce2_cell(1);
+ hs_stats_note_introduce2_cell();
}
done:
diff --git a/src/feature/hs/hs_stats.c b/src/feature/hs/hs_stats.c
index f9d458d630..c292694294 100644
--- a/src/feature/hs/hs_stats.c
+++ b/src/feature/hs/hs_stats.c
@@ -12,20 +12,14 @@
/** Number of v3 INTRODUCE2 cells received */
static uint32_t n_introduce2_v3 = 0;
-/** Number of v2 INTRODUCE2 cells received */
-static uint32_t n_introduce2_v2 = 0;
/** Number of attempts to make a circuit to a rendezvous point */
static uint32_t n_rendezvous_launches = 0;
/** Note that we received another INTRODUCE2 cell. */
void
-hs_stats_note_introduce2_cell(int is_hsv3)
+hs_stats_note_introduce2_cell(void)
{
- if (is_hsv3) {
- n_introduce2_v3++;
- } else {
- n_introduce2_v2++;
- }
+ n_introduce2_v3++;
}
/** Return the number of v3 INTRODUCE2 cells we have received. */
@@ -35,13 +29,6 @@ hs_stats_get_n_introduce2_v3_cells(void)
return n_introduce2_v3;
}
-/** Return the number of v2 INTRODUCE2 cells we have received. */
-uint32_t
-hs_stats_get_n_introduce2_v2_cells(void)
-{
- return n_introduce2_v2;
-}
-
/** Note that we attempted to launch another circuit to a rendezvous point. */
void
hs_stats_note_service_rendezvous_launch(void)
diff --git a/src/feature/hs/hs_stats.h b/src/feature/hs/hs_stats.h
index aea2ccf5c2..b08e2f702d 100644
--- a/src/feature/hs/hs_stats.h
+++ b/src/feature/hs/hs_stats.h
@@ -9,9 +9,8 @@
#ifndef TOR_HS_STATS_H
#define TOR_HS_STATS_H
-void hs_stats_note_introduce2_cell(int is_hsv3);
+void hs_stats_note_introduce2_cell(void);
uint32_t hs_stats_get_n_introduce2_v3_cells(void);
-uint32_t hs_stats_get_n_introduce2_v2_cells(void);
void hs_stats_note_service_rendezvous_launch(void);
uint32_t hs_stats_get_n_rendezvous_launches(void);
diff --git a/src/feature/stats/rephist.c b/src/feature/stats/rephist.c
index f8d7887e65..f7c9336bff 100644
--- a/src/feature/stats/rephist.c
+++ b/src/feature/stats/rephist.c
@@ -1722,7 +1722,6 @@ static hs_v2_stats_t *
hs_v2_stats_new(void)
{
hs_v2_stats_t *new_hs_v2_stats = tor_malloc_zero(sizeof(hs_v2_stats_t));
- new_hs_v2_stats->v2_onions_seen_this_period = digestmap_new();
return new_hs_v2_stats;
}
@@ -1737,8 +1736,6 @@ hs_v2_stats_free_(hs_v2_stats_t *victim_hs_v2_stats)
if (!victim_hs_v2_stats) {
return;
}
-
- digestmap_free(victim_hs_v2_stats->v2_onions_seen_this_period, NULL);
tor_free(victim_hs_v2_stats);
}
@@ -1753,40 +1750,9 @@ rep_hist_reset_hs_v2_stats(time_t now)
hs_v2_stats->rp_v2_relay_cells_seen = 0;
- digestmap_free(hs_v2_stats->v2_onions_seen_this_period, NULL);
- hs_v2_stats->v2_onions_seen_this_period = digestmap_new();
-
start_of_hs_v2_stats_interval = now;
}
-/** As HSDirs, we saw another v2 onion with public key <b>pubkey</b>. Check
- * whether we have counted it before, if not count it now! */
-void
-rep_hist_hsdir_stored_maybe_new_v2_onion(const crypto_pk_t *pubkey)
-{
- char pubkey_hash[DIGEST_LEN];
-
- if (!hs_v2_stats) {
- return; // We're not collecting stats
- }
-
- /* Get the digest of the pubkey which will be used to detect whether
- we've seen this hidden service before or not. */
- if (crypto_pk_get_digest(pubkey, pubkey_hash) < 0) {
- /* This fail should not happen; key has been validated by
- descriptor parsing code first. */
- return;
- }
-
- /* Check if this is the first time we've seen this hidden
- service. If it is, count it as new. */
- if (!digestmap_get(hs_v2_stats->v2_onions_seen_this_period,
- pubkey_hash)) {
- digestmap_set(hs_v2_stats->v2_onions_seen_this_period,
- pubkey_hash, (void*)(uintptr_t)1);
- }
-}
-
/*** HSv3 stats ******/
/** Start of the current hidden service stats interval or 0 if we're not
@@ -1989,8 +1955,7 @@ rep_hist_format_hs_stats(time_t now, bool is_v3)
uint64_t rp_cells_seen = is_v3 ?
hs_v3_stats->rp_v3_relay_cells_seen : hs_v2_stats->rp_v2_relay_cells_seen;
size_t onions_seen = is_v3 ?
- digest256map_size(hs_v3_stats->v3_onions_seen_this_period) :
- digestmap_size(hs_v2_stats->v2_onions_seen_this_period);
+ digest256map_size(hs_v3_stats->v3_onions_seen_this_period) : 0;
time_t start_of_hs_stats_interval = is_v3 ?
start_of_hs_v3_stats_interval : start_of_hs_v2_stats_interval;
diff --git a/src/feature/stats/rephist.h b/src/feature/stats/rephist.h
index de27b16ae0..7ecbfebfd7 100644
--- a/src/feature/stats/rephist.h
+++ b/src/feature/stats/rephist.h
@@ -67,9 +67,7 @@ void rep_hist_hs_stats_init(time_t now);
void rep_hist_hs_stats_term(void);
time_t rep_hist_hs_stats_write(time_t now, bool is_v3);
-char *rep_hist_get_hs_v2_stats_string(void);
void rep_hist_seen_new_rp_cell(bool is_v2);
-void rep_hist_hsdir_stored_maybe_new_v2_onion(const crypto_pk_t *pubkey);
char *rep_hist_get_hs_v3_stats_string(void);
void rep_hist_hsdir_stored_maybe_new_v3_onion(const uint8_t *blinded_key);
@@ -93,10 +91,6 @@ extern int onion_handshakes_assigned[MAX_ONION_HANDSHAKE_TYPE+1];
typedef struct hs_v2_stats_t {
/** How many v2 relay cells have we seen as rendezvous points? */
uint64_t rp_v2_relay_cells_seen;
-
- /** Set of unique public key digests we've seen this stat period
- * (could also be implemented as sorted smartlist). */
- digestmap_t *v2_onions_seen_this_period;
} hs_v2_stats_t;
/** Structure that contains the various statistics we keep about v3
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits