mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-25 07:07:52 +01:00
Hook up circuit padding to circuit_t.
Co-authored-by: George Kadianakis <desnacked@riseup.net>
This commit is contained in:
parent
2a24e21fb0
commit
2f7b5a2d44
3 changed files with 32 additions and 0 deletions
|
@ -12,6 +12,11 @@
|
||||||
#include "core/or/cell_queue_st.h"
|
#include "core/or/cell_queue_st.h"
|
||||||
|
|
||||||
struct hs_token_t;
|
struct hs_token_t;
|
||||||
|
typedef struct circpad_machine_t circpad_machine_t;
|
||||||
|
typedef struct circpad_machineinfo_t circpad_machineinfo_t;
|
||||||
|
|
||||||
|
/** Number of padding state machines on a circuit. */
|
||||||
|
#define CIRCPAD_MAX_MACHINES (2)
|
||||||
|
|
||||||
/** "magic" value for an origin_circuit_t */
|
/** "magic" value for an origin_circuit_t */
|
||||||
#define ORIGIN_CIRCUIT_MAGIC 0x35315243u
|
#define ORIGIN_CIRCUIT_MAGIC 0x35315243u
|
||||||
|
@ -177,6 +182,25 @@ struct circuit_t {
|
||||||
/** Hashtable node: used to look up the circuit by its HS token using the HS
|
/** Hashtable node: used to look up the circuit by its HS token using the HS
|
||||||
circuitmap. */
|
circuitmap. */
|
||||||
HT_ENTRY(circuit_t) hs_circuitmap_node;
|
HT_ENTRY(circuit_t) hs_circuitmap_node;
|
||||||
|
|
||||||
|
/** Adaptive Padding state machines: these are immutable. The state machines
|
||||||
|
* that come from the consensus are saved to a global structure, to avoid
|
||||||
|
* per-circuit allocations. This merely points to the global copy.
|
||||||
|
*
|
||||||
|
* Each element of this array corresponds to a different padding machine,
|
||||||
|
* and we can have up to CIRCPAD_MAX_MACHINES such machines. */
|
||||||
|
const circpad_machine_t *padding_machine[CIRCPAD_MAX_MACHINES];
|
||||||
|
|
||||||
|
/** Adaptive Padding machine info for above machines. This is the
|
||||||
|
* per-circuit mutable information, such as the current state and
|
||||||
|
* histogram token counts. Some of it is optional (aka NULL).
|
||||||
|
* If a machine is being shut down, these indexes can be NULL
|
||||||
|
* without the corresponding padding_machine being NULL, while we
|
||||||
|
* wait for the other end to respond to our shutdown request.
|
||||||
|
*
|
||||||
|
* Each element of this array corresponds to a different padding machine,
|
||||||
|
* and we can have up to CIRCPAD_MAX_MACHINES such machines. */
|
||||||
|
circpad_machineinfo_t *padding_info[CIRCPAD_MAX_MACHINES];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
#include "core/or/circuitlist.h"
|
#include "core/or/circuitlist.h"
|
||||||
#include "core/or/circuituse.h"
|
#include "core/or/circuituse.h"
|
||||||
#include "core/or/circuitstats.h"
|
#include "core/or/circuitstats.h"
|
||||||
|
#include "core/or/circuitpadding.h"
|
||||||
#include "core/mainloop/connection.h"
|
#include "core/mainloop/connection.h"
|
||||||
#include "app/config/config.h"
|
#include "app/config/config.h"
|
||||||
#include "core/or/connection_edge.h"
|
#include "core/or/connection_edge.h"
|
||||||
|
@ -1231,6 +1232,9 @@ circuit_free_(circuit_t *circ)
|
||||||
CIRCUIT_IS_ORIGIN(circ) ?
|
CIRCUIT_IS_ORIGIN(circ) ?
|
||||||
TO_ORIGIN_CIRCUIT(circ)->global_identifier : 0);
|
TO_ORIGIN_CIRCUIT(circ)->global_identifier : 0);
|
||||||
|
|
||||||
|
/* Free any circuit padding structures */
|
||||||
|
circpad_circuit_free_all_machineinfos(circ);
|
||||||
|
|
||||||
if (should_free) {
|
if (should_free) {
|
||||||
memwipe(mem, 0xAA, memlen); /* poison memory */
|
memwipe(mem, 0xAA, memlen); /* poison memory */
|
||||||
tor_free(mem);
|
tor_free(mem);
|
||||||
|
|
|
@ -161,6 +161,10 @@ struct origin_circuit_t {
|
||||||
* connections to this circuit. */
|
* connections to this circuit. */
|
||||||
unsigned int unusable_for_new_conns : 1;
|
unsigned int unusable_for_new_conns : 1;
|
||||||
|
|
||||||
|
/* If this flag is set (due to padding negotiation failure), we should
|
||||||
|
* not try to negotiate further circuit padding. */
|
||||||
|
unsigned padding_negotiation_failed : 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tristate variable to guard against pathbias miscounting
|
* Tristate variable to guard against pathbias miscounting
|
||||||
* due to circuit purpose transitions changing the decision
|
* due to circuit purpose transitions changing the decision
|
||||||
|
|
Loading…
Add table
Reference in a new issue