[tor-commits] [tor/maint-0.4.0] Merge branch 'maint-0.3.4' into maint-0.3.5
commit e5deb2bbc73d8830ae6c479a4532e72112f5484a Merge: 6945f2b3e a521c4278 Author: Nick Mathewson Date: Fri May 17 08:10:16 2019 -0400 Merge branch 'maint-0.3.4' into maint-0.3.5 changes/geoip-2019-05-13 | 4 + src/config/geoip | 15407 ++--- src/config/geoip6| 3771 +++ 3 files changed, 11335 insertions(+), 7847 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] Merge branch 'maint-0.3.4' into maint-0.3.5
commit 3b9e3cca94dbeb083bfd64dfd4eb22a905cd2748 Merge: 316aed502 48e990359 Author: teor Date: Sat Apr 6 09:33:20 2019 +1000 Merge branch 'maint-0.3.4' into maint-0.3.5 ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] Merge branch 'maint-0.3.4' into maint-0.3.5
commit 4aa02d3c7abe84e99874f6bf7bfffb7b551935a5 Merge: 0418d4081 3cfcfbac4 Author: Nick Mathewson Date: Wed Apr 3 09:27:43 2019 -0400 Merge branch 'maint-0.3.4' into maint-0.3.5 changes/geoip-2019-04-02 | 4 + src/config/geoip | 10355 + src/config/geoip6| 2337 ++ 3 files changed, 7344 insertions(+), 5352 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] Merge branch 'maint-0.3.4' into maint-0.3.5
commit 0418d4081acd2708a16dd757af4aac4777658da9 Merge: 3280e9a11 74775b2df Author: teor Date: Tue Apr 2 11:45:22 2019 +1000 Merge branch 'maint-0.3.4' into maint-0.3.5 changes/bug29703 | 4 1 file changed, 4 insertions(+) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] Merge branch 'maint-0.3.4' into maint-0.3.5
commit 3280e9a116df6202dba4e3ee50a9c9d2a1f6699d Merge: 091f8688b 6d057c56f Author: teor Date: Wed Mar 27 10:02:40 2019 +1000 Merge branch 'maint-0.3.4' into maint-0.3.5 ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] Merge branch 'maint-0.3.4' into maint-0.3.5
commit 41cd05562f68c23f8c3d95472e20a86165f6dc20 Merge: 6bf9078ce d7a5fdcb7 Author: teor Date: Wed Mar 20 09:48:03 2019 +1000 Merge branch 'maint-0.3.4' into maint-0.3.5 changes/bug29706_minimal | 4 src/feature/dirauth/shared_random_state.c | 4 ++-- src/feature/dirauth/shared_random_state.h | 2 ++ src/test/test_shared_random.c | 17 ++--- 4 files changed, 22 insertions(+), 5 deletions(-) diff --cc src/feature/dirauth/shared_random_state.c index 2bc030f4a,0..b3e4a4ef9 mode 100644,00..100644 --- a/src/feature/dirauth/shared_random_state.c +++ b/src/feature/dirauth/shared_random_state.c @@@ -1,1340 -1,0 +1,1340 @@@ +/* Copyright (c) 2016-2019, The Tor Project, Inc. */ +/* See LICENSE for licensing information */ + +/** + * \file shared_random_state.c + * + * \brief Functions and data structures for the state of the random protocol + *as defined in proposal #250. + **/ + +#define SHARED_RANDOM_STATE_PRIVATE + +#include "core/or/or.h" +#include "app/config/config.h" +#include "app/config/confparse.h" +#include "lib/crypt_ops/crypto_util.h" +#include "feature/dirauth/dirvote.h" +#include "feature/nodelist/networkstatus.h" +#include "feature/relay/router.h" +#include "feature/dirauth/shared_random.h" +#include "feature/hs_common/shared_random_client.h" +#include "feature/dirauth/shared_random_state.h" +#include "feature/dircommon/voting_schedule.h" +#include "lib/encoding/confline.h" + +#include "app/config/or_state_st.h" + +/* Default filename of the shared random state on disk. */ +static const char default_fname[] = "sr-state"; + +/* String representation of a protocol phase. */ +static const char *phase_str[] = { "unknown", "commit", "reveal" }; + +/* Our shared random protocol state. There is only one possible state per + * protocol run so this is the global state which is reset at every run once + * the shared random value has been computed. */ +static sr_state_t *sr_state = NULL; + +/* Representation of our persistent state on disk. The sr_state above + * contains the data parsed from this state. When we save to disk, we + * translate the sr_state to this sr_disk_state. */ +static sr_disk_state_t *sr_disk_state = NULL; + +/* Disk state file keys. */ +static const char dstate_commit_key[] = "Commit"; +static const char dstate_prev_srv_key[] = "SharedRandPreviousValue"; +static const char dstate_cur_srv_key[] = "SharedRandCurrentValue"; + +/** dummy instance of sr_disk_state_t, used for type-checking its + * members with CONF_CHECK_VAR_TYPE. */ +DUMMY_TYPECHECK_INSTANCE(sr_disk_state_t); + +/* These next two are duplicates or near-duplicates from config.c */ +#define VAR(name, conftype, member, initvalue) \ + { name, CONFIG_TYPE_ ## conftype, offsetof(sr_disk_state_t, member), \ + initvalue CONF_TEST_MEMBERS(sr_disk_state_t, conftype, member) } +/* As VAR, but the option name and member name are the same. */ +#define V(member, conftype, initvalue) \ + VAR(#member, conftype, member, initvalue) +/* Our persistent state magic number. */ +#define SR_DISK_STATE_MAGIC 0x98AB1254 + +static int +disk_state_validate_cb(void *old_state, void *state, void *default_state, + int from_setconf, char **msg); +static void disk_state_free_cb(void *); + +/* Array of variables that are saved to disk as a persistent state. */ +static config_var_t state_vars[] = { + V(Version,UINT, "0"), + V(TorVersion, STRING, NULL), + V(ValidAfter, ISOTIME, NULL), + V(ValidUntil, ISOTIME, NULL), + + V(Commit, LINELIST, NULL), + + V(SharedRandValues, LINELIST_V, NULL), + VAR("SharedRandPreviousValue",LINELIST_S, SharedRandValues, NULL), + VAR("SharedRandCurrentValue", LINELIST_S, SharedRandValues, NULL), + END_OF_CONFIG_VARS +}; + +/* "Extra" variable in the state that receives lines we can't parse. This + * lets us preserve options from versions of Tor newer than us. */ +static config_var_t state_extra_var = { + "__extra", CONFIG_TYPE_LINELIST, + offsetof(sr_disk_state_t, ExtraLines), NULL + CONF_TEST_MEMBERS(sr_disk_state_t, LINELIST, ExtraLines) +}; + +/* Configuration format of sr_disk_state_t. */ +static const config_format_t state_format = { + sizeof(sr_disk_state_t), + SR_DISK_STATE_MAGIC, + offsetof(sr_disk_state_t, magic_), + NULL, + NULL, + state_vars, + disk_state_validate_cb, + disk_state_free_cb, + _extra_var, +}; + +/* Return a string representation of a protocol phase. */ +STATIC const char * +get_phase_str(sr_phase_t phase) +{ + const char *the_string = NULL; + + switch (phase) { + case SR_PHASE_COMMIT: + case SR_PHASE_REVEAL: +the_string = phase_str[phase]; +break; + default: +/* Unknown phase shouldn't be possible. */ +
[tor-commits] [tor/maint-0.4.0] Merge branch 'maint-0.3.4' into maint-0.3.5
commit 5d41e2223f64517300aad168b2f2479ba00ac10b Merge: ffd720702 e021f89f3 Author: teor Date: Thu Mar 14 06:59:09 2019 +1000 Merge branch 'maint-0.3.4' into maint-0.3.5 "ours" merge to ignore the changes to src/common/compat.c, they have already been merged to 0.3.5 in the correct file. ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] Merge branch 'maint-0.3.4' into maint-0.3.5
commit d6f77b99dac1a368514cfcfc1d6c5908ef6dd74a Merge: 1c248fa27 155b0f552 Author: Nick Mathewson Date: Wed Mar 6 14:29:38 2019 -0500 Merge branch 'maint-0.3.4' into maint-0.3.5 changes/geoip-2019-03-04 | 4 + src/config/geoip | 12163 - src/config/geoip6| 2251 ++--- 3 files changed, 8221 insertions(+), 6197 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] Merge branch 'maint-0.3.4' into maint-0.3.5
commit 1c248fa27d978a3a20f29ea76cc23c4c4604d1a0 Merge: de0969ef7 f56645917 Author: teor Date: Fri Mar 1 14:16:59 2019 +1000 Merge branch 'maint-0.3.4' into maint-0.3.5 ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] Merge branch 'maint-0.3.4' into maint-0.3.5
commit de0969ef7816d54acdcc9f1e2960d8bbc4400ecf Merge: be29dfedd 6a61a020e Author: teor Date: Thu Feb 28 10:49:33 2019 +1000 Merge branch 'maint-0.3.4' into maint-0.3.5 src/test/test_shared_random.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] Merge branch 'maint-0.3.4' into maint-0.3.5
commit be29dfedd99f49b8bf22422eff04986f12580733 Merge: 15dc33849 524731503 Author: teor Date: Thu Feb 28 10:45:59 2019 +1000 Merge branch 'maint-0.3.4' into maint-0.3.5 changes/bug29599 | 3 +++ src/test/test_shared_random.c | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] Merge branch 'maint-0.3.4' into maint-0.3.5
commit 15dc33849eda4fba651bf4096a9e405d737a977b Merge: 1216f9953 1a194beb2 Author: teor Date: Wed Feb 27 09:38:04 2019 +1000 Merge branch 'maint-0.3.4' into maint-0.3.5 changes/bug29145| 3 +++ src/test/test-memwipe.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] Merge branch 'maint-0.3.4' into maint-0.3.5
commit e1079266e73c70cc0e5141249ebf3199a849017d Merge: 4a8a1f76e a56b9501f Author: Nick Mathewson Date: Thu Feb 21 13:23:52 2019 -0500 Merge branch 'maint-0.3.4' into maint-0.3.5 "ours" to avoid version bump. ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] Merge branch 'maint-0.3.4' into maint-0.3.5
commit 4a8a1f76ea6cbde128f2cda49049866ea739931d Merge: c663716b6 506264791 Author: Nick Mathewson Date: Thu Feb 21 10:08:14 2019 -0500 Merge branch 'maint-0.3.4' into maint-0.3.5 changes/ticket29168 | 5 + src/core/or/scheduler_kist.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --cc src/core/or/scheduler_kist.c index e17d67cfd,0..79ecb0bc7 mode 100644,00..100644 --- a/src/core/or/scheduler_kist.c +++ b/src/core/or/scheduler_kist.c @@@ -1,844 -1,0 +1,844 @@@ +/* Copyright (c) 2017-2019, The Tor Project, Inc. */ +/* See LICENSE for licensing information */ + +#define SCHEDULER_KIST_PRIVATE + +#include "core/or/or.h" +#include "lib/container/buffers.h" +#include "app/config/config.h" +#include "core/mainloop/connection.h" +#include "feature/nodelist/networkstatus.h" +#define TOR_CHANNEL_INTERNAL_ +#include "core/or/channel.h" +#include "core/or/channeltls.h" +#define SCHEDULER_PRIVATE_ +#include "core/or/scheduler.h" +#include "lib/math/fp.h" + +#include "core/or/or_connection_st.h" + +#ifdef HAVE_SYS_IOCTL_H +#include +#endif + +#ifdef HAVE_KIST_SUPPORT +/* Kernel interface needed for KIST. */ +#include +#include +#endif /* HAVE_KIST_SUPPORT */ + +/* + * Data structures and supporting functions + */ + +/* Socket_table hash table stuff. The socket_table keeps track of per-socket + * limit information imposed by kist and used by kist. */ + +static uint32_t +socket_table_ent_hash(const socket_table_ent_t *ent) +{ + return (uint32_t)ent->chan->global_identifier; +} + +static unsigned +socket_table_ent_eq(const socket_table_ent_t *a, const socket_table_ent_t *b) +{ + return a->chan == b->chan; +} + +typedef HT_HEAD(socket_table_s, socket_table_ent_s) socket_table_t; + +static socket_table_t socket_table = HT_INITIALIZER(); + +HT_PROTOTYPE(socket_table_s, socket_table_ent_s, node, socket_table_ent_hash, + socket_table_ent_eq) +HT_GENERATE2(socket_table_s, socket_table_ent_s, node, socket_table_ent_hash, + socket_table_ent_eq, 0.6, tor_reallocarray, tor_free_) + +/* outbuf_table hash table stuff. The outbuf_table keeps track of which + * channels have data sitting in their outbuf so the kist scheduler can force + * a write from outbuf to kernel periodically during a run and at the end of a + * run. */ + +typedef struct outbuf_table_ent_s { + HT_ENTRY(outbuf_table_ent_s) node; + channel_t *chan; +} outbuf_table_ent_t; + +static uint32_t +outbuf_table_ent_hash(const outbuf_table_ent_t *ent) +{ + return (uint32_t)ent->chan->global_identifier; +} + +static unsigned +outbuf_table_ent_eq(const outbuf_table_ent_t *a, const outbuf_table_ent_t *b) +{ + return a->chan->global_identifier == b->chan->global_identifier; +} + +HT_PROTOTYPE(outbuf_table_s, outbuf_table_ent_s, node, outbuf_table_ent_hash, + outbuf_table_ent_eq) +HT_GENERATE2(outbuf_table_s, outbuf_table_ent_s, node, outbuf_table_ent_hash, + outbuf_table_ent_eq, 0.6, tor_reallocarray, tor_free_) + +/* + * Other internal data + */ + +/* Store the last time the scheduler was run so we can decide when to next run + * the scheduler based on it. */ +static monotime_t scheduler_last_run; +/* This is a factor for the extra_space calculation in kist per-socket limits. + * It is the number of extra congestion windows we want to write to the kernel. + */ +static double sock_buf_size_factor = 1.0; +/* How often the scheduler runs. */ +STATIC int sched_run_interval = KIST_SCHED_RUN_INTERVAL_DEFAULT; + +#ifdef HAVE_KIST_SUPPORT +/* Indicate if KIST lite mode is on or off. We can disable it at runtime. + * Important to have because of the KISTLite -> KIST possible transition. */ +static unsigned int kist_lite_mode = 0; +/* Indicate if we don't have the kernel support. This can happen if the kernel + * changed and it doesn't recognized the values passed to the syscalls needed + * by KIST. In that case, fallback to the naive approach. */ +static unsigned int kist_no_kernel_support = 0; +#else /* !(defined(HAVE_KIST_SUPPORT)) */ +static unsigned int kist_lite_mode = 1; +#endif /* defined(HAVE_KIST_SUPPORT) */ + +/* + * Internally called function implementations + */ + +/* Little helper function to get the length of a channel's output buffer */ +static inline size_t +channel_outbuf_length(channel_t *chan) +{ + tor_assert(chan); + /* In theory, this can not happen because we can not scheduler a channel
[tor-commits] [tor/maint-0.4.0] Merge branch 'maint-0.3.4' into maint-0.3.5
commit 46910c060f6d0065f1745500e2bef89da8f8801a Merge: d83c299eb 508002a4c Author: Nick Mathewson Date: Thu Feb 21 09:50:46 2019 -0500 Merge branch 'maint-0.3.4' into maint-0.3.5 "ours" to avoid version bump. ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits