diff options
author | David Goulet <dgoulet@torproject.org> | 2018-01-25 09:44:21 -0500 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2018-01-30 09:18:16 -0500 |
commit | 82de4ea900c5d3513214b127421890595343bfaa (patch) | |
tree | 27d926d2666961490eaf53eda267e6c2a9bae136 /src/or/dos.h | |
parent | 14a8b87852887f8c20a424ff32a2b6746105dd6c (diff) | |
download | tor-82de4ea900c5d3513214b127421890595343bfaa.tar.gz tor-82de4ea900c5d3513214b127421890595343bfaa.zip |
dos: Clear connection tracked flag if geoip entry is removed
Imagine this scenario. We had 10 connections over the 24h lifetime of a geoip
cache entry. The lifetime of the entry has been reached so it is about to get
freed but 2 connections remain for it. After the free, a third connection
comes in thus making us create a new geoip entry for that address matching the
2 previous ones that are still alive. If they end up being closed, we'll have
a concurrent count desynch from what the reality is.
To mitigate this probably very rare scenario in practice, when we free a geoip
entry and it has a concurrent count above 0, we'll go over all connections
matching the address and clear out the tracked flag. So once they are closed,
we don't try to decrement the count.
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/dos.h')
-rw-r--r-- | src/or/dos.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/or/dos.h b/src/or/dos.h index 56835169d2..9ce1baddb8 100644 --- a/src/or/dos.h +++ b/src/or/dos.h @@ -43,11 +43,15 @@ typedef struct dos_client_stats_t { /* General API. */ +/* Stub. */ +struct clientmap_entry_t; + void dos_init(void); void dos_free_all(void); void dos_consensus_has_changed(const networkstatus_t *ns); int dos_enabled(void); void dos_log_heartbeat(void); +void dos_geoip_entry_about_to_free(const struct clientmap_entry_t *geoip_ent); void dos_new_client_conn(or_connection_t *or_conn); void dos_close_client_conn(const or_connection_t *or_conn); |