]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Merge branch 'bug23512-v4-029-fixes'
authorNick Mathewson <nickm@torproject.org>
Thu, 20 Sep 2018 18:41:44 +0000 (14:41 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 20 Sep 2018 18:41:44 +0000 (14:41 -0400)
1  2 
src/feature/stats/rephist.c
src/feature/stats/rephist.h
src/test/test_relay.c

index 2588bb4c00664d29afe20f472417dc259f64441c,20f9148f03ce8b6ca4ad8cf555ef544bfd81834c..a2dbb0ff1626001a78c7bda7b534e697c28e1658
   * (The "rephist" name originally stood for "reputation and history". )
   **/
  
 -#include "or.h"
 -#include "circuitlist.h"
 -#include "circuituse.h"
 -#include "config.h"
 -#include "networkstatus.h"
 -#include "nodelist.h"
 -#include "rephist.h"
 -#include "router.h"
 -#include "routerlist.h"
++#define REPHIST_PRIVATE
 +#include "core/or/or.h"
 +#include "core/or/circuitlist.h"
 +#include "core/or/circuituse.h"
 +#include "app/config/config.h"
 +#include "lib/crypt_ops/crypto_rand.h"
 +#include "feature/nodelist/networkstatus.h"
 +#include "feature/nodelist/nodelist.h"
 +#include "feature/stats/rephist.h"
 +#include "feature/relay/router.h"
 +#include "feature/nodelist/routerlist.h"
  #include "ht.h"
 +#include "core/or/channelpadding.h"
 +#include "core/or/connection_or.h"
 +#include "app/config/statefile.h"
  
 -static void bw_arrays_init(void);
 -static void predicted_ports_init(void);
 +#include "feature/nodelist/networkstatus_st.h"
 +#include "core/or/or_circuit_st.h"
 +#include "app/config/or_state_st.h"
 +
 +#include "lib/container/bloomfilt.h"
 +#include "lib/container/order.h"
 +#include "lib/math/fp.h"
 +#include "lib/math/laplace.h"
 +#include "lib/time/tvdiff.h"
  
 -typedef struct bw_array_t bw_array_t;
 -STATIC uint64_t find_largest_max(bw_array_t *b);
 -STATIC void commit_max(bw_array_t *b);
 -STATIC void advance_obs(bw_array_t *b);
 +#ifdef HAVE_FCNTL_H
 +#include <fcntl.h>
 +#endif
 +
 +static void bw_arrays_init(void);
 +static void predicted_ports_alloc(void);
  
- typedef struct bw_array_t bw_array_t;
- STATIC uint64_t find_largest_max(bw_array_t *b);
- STATIC void commit_max(bw_array_t *b);
- STATIC void advance_obs(bw_array_t *b);
  /** Total number of bytes currently allocated in fields used by rephist.c. */
  uint64_t rephist_total_alloc=0;
  /** Number of or_history_t objects currently allocated. */
index e17a72248994cc15425edbde1e19111631d2f44b,f4bcd8ea0964f668fdc3d5f873d6aba0b9849c77..842184f8153ddf2bcf6fccd0115879f2699980b2
@@@ -109,34 -117,7 +109,39 @@@ extern uint32_t rephist_total_num
  #ifdef TOR_UNIT_TESTS
  extern int onion_handshakes_requested[MAX_ONION_HANDSHAKE_TYPE+1];
  extern int onion_handshakes_assigned[MAX_ONION_HANDSHAKE_TYPE+1];
 -extern bw_array_t *write_array;
++extern struct bw_array_t *write_array;
+ #endif
++#ifdef REPHIST_PRIVATE
 +typedef struct bw_array_t bw_array_t;
- extern bw_array_t *write_array;
++STATIC uint64_t find_largest_max(bw_array_t *b);
++STATIC void commit_max(bw_array_t *b);
++STATIC void advance_obs(bw_array_t *b);
  #endif
 +
 +/**
 + * Represents the type of a cell for padding accounting
 + */
 +typedef enum padding_type_t {
 +    /** A RELAY_DROP cell */
 +    PADDING_TYPE_DROP,
 +    /** A CELL_PADDING cell */
 +    PADDING_TYPE_CELL,
 +    /** Total counts of padding and non-padding together */
 +    PADDING_TYPE_TOTAL,
 +    /** Total cell counts for all padding-enabled channels */
 +    PADDING_TYPE_ENABLED_TOTAL,
 +    /** CELL_PADDING counts for all padding-enabled channels */
 +    PADDING_TYPE_ENABLED_CELL
 +} padding_type_t;
 +
 +/** The amount of time over which the padding cell counts were counted */
 +#define REPHIST_CELL_PADDING_COUNTS_INTERVAL (24*60*60)
 +void rep_hist_padding_count_read(padding_type_t type);
 +void rep_hist_padding_count_write(padding_type_t type);
 +char *rep_hist_get_padding_count_lines(void);
 +void rep_hist_reset_padding_counts(void);
 +void rep_hist_prep_published_padding_counts(time_t now);
 +void rep_hist_padding_count_timers(uint64_t num_timers);
 +
 +#endif /* !defined(TOR_REPHIST_H) */
index c3fd6578e14058d650e1747c9274fa9fdb348fe4,57dcb2406a182a172b969d5af6039d900e8c9e02..4311392be8af3d75d6b8de6a7b4bfed59898c6a6
@@@ -1,30 -1,27 +1,30 @@@
 -/* Copyright (c) 2014-2016, The Tor Project, Inc. */
 +/* Copyright (c) 2014-2018, The Tor Project, Inc. */
  /* See LICENSE for licensing information */
  
- #include "core/or/or.h"
 -#include "or.h"
  #define CIRCUITBUILD_PRIVATE
 -#include "circuitbuild.h"
 -#include "circuitlist.h"
 -#include "rephist.h"
 -#include "channeltls.h"
+ #define RELAY_PRIVATE
 -#include "relay.h"
++#define REPHIST_PRIVATE
++#include "core/or/or.h"
 +#include "core/or/circuitbuild.h"
 +#include "core/or/circuitlist.h"
 +#include "core/or/channeltls.h"
 +#include "feature/stats/rephist.h"
- #define RELAY_PRIVATE
 +#include "core/or/relay.h"
++#include "feature/stats/rephist.h"
++#include "lib/container/order.h"
  /* For init/free stuff */
 -#include "scheduler.h"
 +#include "core/or/scheduler.h"
 +
 +#include "core/or/cell_st.h"
 +#include "core/or/or_circuit_st.h"
  
  /* Test suite stuff */
 -#include "test.h"
 -#include "fakechans.h"
 +#include "test/test.h"
 +#include "test/fakechans.h"
  
  static or_circuit_t * new_fake_orcirc(channel_t *nchan, channel_t *pchan);
  
  static void test_relay_append_cell_to_circuit_queue(void *arg);
--uint64_t find_largest_max(bw_array_t *b);
--void commit_max(bw_array_t *b);
--void advance_obs(bw_array_t *b);
  
  static or_circuit_t *
  new_fake_orcirc(channel_t *nchan, channel_t *pchan)