summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.appveyor.yml62
-rw-r--r--.editorconfig33
-rw-r--r--.gitignore41
-rw-r--r--.travis.yml5
-rw-r--r--ChangeLog868
-rw-r--r--LICENSE2
-rw-r--r--Makefile.am103
-rw-r--r--ReleaseNotes977
-rw-r--r--acinclude.m42
-rw-r--r--changes/bug221563
-rw-r--r--changes/bug248914
-rw-r--r--changes/bug249775
-rw-r--r--changes/bug254773
-rw-r--r--changes/bug25686_diagnostic4
-rw-r--r--changes/bug257877
-rw-r--r--changes/bug258867
-rw-r--r--changes/bug260725
-rw-r--r--changes/bug261524
-rw-r--r--changes/bug261585
-rw-r--r--changes/bug261967
-rw-r--r--changes/bug262143
-rw-r--r--changes/bug262453
-rw-r--r--changes/bug26258_0334
-rw-r--r--changes/bug262824
-rw-r--r--changes/bug264024
-rw-r--r--changes/bug264153
-rw-r--r--changes/bug264355
-rw-r--r--changes/cargo_global_cache4
-rw-r--r--changes/feature26372_0294
-rw-r--r--changes/feature83233
-rw-r--r--changes/full_include_paths3
-rw-r--r--changes/rust_cross2
-rw-r--r--changes/split_or_h5
-rw-r--r--changes/ticket199793
-rw-r--r--changes/ticket259474
-rw-r--r--changes/ticket259605
-rw-r--r--changes/ticket264264
-rw-r--r--changes/ticket264276
-rw-r--r--config.rust.in22
-rw-r--r--configure.ac109
-rw-r--r--contrib/win32build/tor-mingw.nsi.in2
-rw-r--r--doc/HACKING/CodingStandards.md5
-rw-r--r--doc/HACKING/HelpfulTools.md10
-rw-r--r--link_rust.sh.in10
-rwxr-xr-xscripts/codegen/gen_server_ciphers.py2
-rwxr-xr-xscripts/codegen/get_mozilla_ciphers.py2
-rw-r--r--scripts/codegen/makedesc.py2
-rwxr-xr-xscripts/maint/checkIncludes.py72
-rwxr-xr-xscripts/maint/checkSpace.pl16
-rwxr-xr-xscripts/maint/format_changelog.py2
-rwxr-xr-xscripts/maint/rectify_include_paths.py60
-rwxr-xr-xscripts/maint/redox.py2
-rwxr-xr-xscripts/maint/sortChanges.py2
-rwxr-xr-xscripts/maint/updateCopyright.pl4
-rw-r--r--scripts/test/appveyor-irc-notify.py192
-rwxr-xr-xscripts/test/cov-diff6
-rw-r--r--src/common/.may_include11
-rw-r--r--src/common/address.c19
-rw-r--r--src/common/address.h32
-rw-r--r--src/common/address_set.c15
-rw-r--r--src/common/address_set.h4
-rw-r--r--src/common/buffers.c14
-rw-r--r--src/common/buffers.h8
-rw-r--r--src/common/compat.c499
-rw-r--r--src/common/compat.h319
-rw-r--r--src/common/compat_libevent.c12
-rw-r--r--src/common/compat_libevent.h4
-rw-r--r--src/common/compat_pthreads.c94
-rw-r--r--src/common/compat_threads.c38
-rw-r--r--src/common/compat_threads.h48
-rw-r--r--src/common/compat_time.c65
-rw-r--r--src/common/compat_time.h7
-rw-r--r--src/common/compat_winthreads.c37
-rw-r--r--src/common/confline.c13
-rw-r--r--src/common/confline.h7
-rw-r--r--src/common/container.h742
-rw-r--r--src/common/crypto.c1118
-rw-r--r--src/common/handles.h4
-rw-r--r--src/common/include.am113
-rw-r--r--src/common/memarea.c11
-rw-r--r--src/common/memarea.h2
-rw-r--r--src/common/procmon.c6
-rw-r--r--src/common/procmon.h8
-rw-r--r--src/common/pubsub.c129
-rw-r--r--src/common/pubsub.h179
-rw-r--r--src/common/sandbox.c20
-rw-r--r--src/common/sandbox.h4
-rw-r--r--src/common/storagedir.c19
-rw-r--r--src/common/storagedir.h2
-rw-r--r--src/common/timers.c12
-rw-r--r--src/common/timers.h4
-rw-r--r--src/common/token_bucket.c8
-rw-r--r--src/common/token_bucket.h6
-rw-r--r--src/common/util.c1273
-rw-r--r--src/common/util.h246
-rw-r--r--src/common/util_format.c49
-rw-r--r--src/common/util_format.h8
-rw-r--r--src/common/util_process.c10
-rw-r--r--src/common/util_process.h2
-rw-r--r--src/common/workqueue.c14
-rw-r--r--src/common/workqueue.h4
-rw-r--r--src/config/geoip5848
-rw-r--r--src/config/geoip6810
-rw-r--r--src/ext/OpenBSD_malloc_Linux.c2
-rw-r--r--src/ext/csiphash.c4
-rw-r--r--src/ext/curve25519_donna/curve25519-donna-c64.c2
-rw-r--r--src/ext/curve25519_donna/curve25519-donna.c2
-rw-r--r--src/ext/ed25519/donna/ed25519-hash-custom.h2
-rw-r--r--src/ext/ed25519/donna/ed25519-randombytes-custom.h2
-rw-r--r--src/ext/ed25519/donna/ed25519_donna_tor.h2
-rw-r--r--src/ext/ed25519/donna/ed25519_tor.c2
-rw-r--r--src/ext/ed25519/ref10/blinding.c2
-rw-r--r--src/ext/ed25519/ref10/crypto_hash_sha512.h2
-rw-r--r--src/ext/ed25519/ref10/crypto_int32.h2
-rw-r--r--src/ext/ed25519/ref10/crypto_int64.h2
-rw-r--r--src/ext/ed25519/ref10/crypto_uint32.h2
-rw-r--r--src/ext/ed25519/ref10/crypto_uint64.h2
-rw-r--r--src/ext/ed25519/ref10/crypto_verify_32.h3
-rw-r--r--src/ext/ed25519/ref10/ed25519_ref10.h2
-rw-r--r--src/ext/ed25519/ref10/keypair.c5
-rw-r--r--src/ext/ed25519/ref10/randombytes.h2
-rw-r--r--src/ext/ht.h2
-rw-r--r--src/ext/keccak-tiny/keccak-tiny-unrolled.c2
-rw-r--r--src/ext/keccak-tiny/keccak-tiny.h2
-rw-r--r--src/ext/mulodi/mulodi4.c2
-rw-r--r--src/include.am21
-rw-r--r--src/lib/cc/.may_include1
-rw-r--r--src/lib/cc/compat_compiler.h259
-rw-r--r--src/lib/cc/include.am4
-rw-r--r--src/lib/cc/torint.h (renamed from src/common/torint.h)2
-rw-r--r--src/lib/compress/.may_include7
-rw-r--r--src/lib/compress/compress.c (renamed from src/common/compress.c)19
-rw-r--r--src/lib/compress/compress.h (renamed from src/common/compress.h)2
-rw-r--r--src/lib/compress/compress_lzma.c (renamed from src/common/compress_lzma.c)10
-rw-r--r--src/lib/compress/compress_lzma.h (renamed from src/common/compress_lzma.h)2
-rw-r--r--src/lib/compress/compress_none.c (renamed from src/common/compress_none.c)10
-rw-r--r--src/lib/compress/compress_none.h (renamed from src/common/compress_none.h)2
-rw-r--r--src/lib/compress/compress_zlib.c (renamed from src/common/compress_zlib.c)10
-rw-r--r--src/lib/compress/compress_zlib.h (renamed from src/common/compress_zlib.h)2
-rw-r--r--src/lib/compress/compress_zstd.c (renamed from src/common/compress_zstd.c)12
-rw-r--r--src/lib/compress/compress_zstd.h (renamed from src/common/compress_zstd.h)2
-rw-r--r--src/lib/compress/include.am25
-rw-r--r--src/lib/container/.may_include16
-rw-r--r--src/lib/container/bitarray.h80
-rw-r--r--src/lib/container/bloomfilt.c46
-rw-r--r--src/lib/container/bloomfilt.h58
-rw-r--r--src/lib/container/include.am24
-rw-r--r--src/lib/container/map.c412
-rw-r--r--src/lib/container/map.h255
-rw-r--r--src/lib/container/order.c48
-rw-r--r--src/lib/container/order.h54
-rw-r--r--src/lib/container/smartlist.c (renamed from src/common/container.c)518
-rw-r--r--src/lib/container/smartlist.h360
-rw-r--r--src/lib/crypt_ops/.may_include22
-rw-r--r--src/lib/crypt_ops/aes.c (renamed from src/common/aes.c)16
-rw-r--r--src/lib/crypt_ops/aes.h (renamed from src/common/aes.h)2
-rw-r--r--src/lib/crypt_ops/compat_openssl.h (renamed from src/common/compat_openssl.h)4
-rw-r--r--src/lib/crypt_ops/crypto.c509
-rw-r--r--src/lib/crypt_ops/crypto.h (renamed from src/common/crypto.h)48
-rw-r--r--src/lib/crypt_ops/crypto_curve25519.c (renamed from src/common/crypto_curve25519.c)17
-rw-r--r--src/lib/crypt_ops/crypto_curve25519.h (renamed from src/common/crypto_curve25519.h)10
-rw-r--r--src/lib/crypt_ops/crypto_dh.c510
-rw-r--r--src/lib/crypt_ops/crypto_dh.h49
-rw-r--r--src/lib/crypt_ops/crypto_digest.c (renamed from src/common/crypto_digest.c)13
-rw-r--r--src/lib/crypt_ops/crypto_digest.h (renamed from src/common/crypto_digest.h)20
-rw-r--r--src/lib/crypt_ops/crypto_ed25519.c (renamed from src/common/crypto_ed25519.c)20
-rw-r--r--src/lib/crypt_ops/crypto_ed25519.h (renamed from src/common/crypto_ed25519.h)10
-rw-r--r--src/lib/crypt_ops/crypto_format.c (renamed from src/common/crypto_format.c)22
-rw-r--r--src/lib/crypt_ops/crypto_format.h (renamed from src/common/crypto_format.h)8
-rw-r--r--src/lib/crypt_ops/crypto_hkdf.c193
-rw-r--r--src/lib/crypt_ops/crypto_hkdf.h28
-rw-r--r--src/lib/crypt_ops/crypto_openssl_mgt.c (renamed from src/common/crypto_openssl_mgt.c)8
-rw-r--r--src/lib/crypt_ops/crypto_openssl_mgt.h (renamed from src/common/crypto_openssl_mgt.h)4
-rw-r--r--src/lib/crypt_ops/crypto_pwbox.c (renamed from src/common/crypto_pwbox.c)22
-rw-r--r--src/lib/crypt_ops/crypto_pwbox.h (renamed from src/common/crypto_pwbox.h)4
-rw-r--r--src/lib/crypt_ops/crypto_rand.c (renamed from src/common/crypto_rand.c)21
-rw-r--r--src/lib/crypt_ops/crypto_rand.h (renamed from src/common/crypto_rand.h)6
-rw-r--r--src/lib/crypt_ops/crypto_rsa.c (renamed from src/common/crypto_rsa.c)47
-rw-r--r--src/lib/crypt_ops/crypto_rsa.h (renamed from src/common/crypto_rsa.h)14
-rw-r--r--src/lib/crypt_ops/crypto_s2k.c (renamed from src/common/crypto_s2k.c)17
-rw-r--r--src/lib/crypt_ops/crypto_s2k.h (renamed from src/common/crypto_s2k.h)4
-rw-r--r--src/lib/crypt_ops/crypto_util.c (renamed from src/common/crypto_util.c)27
-rw-r--r--src/lib/crypt_ops/crypto_util.h (renamed from src/common/crypto_util.h)5
-rw-r--r--src/lib/crypt_ops/include.am44
-rw-r--r--src/lib/ctime/.may_include5
-rw-r--r--src/lib/ctime/di_ops.c (renamed from src/common/di_ops.c)23
-rw-r--r--src/lib/ctime/di_ops.h (renamed from src/common/di_ops.h)4
-rw-r--r--src/lib/ctime/include.am25
-rw-r--r--src/lib/defs/.may_include1
-rw-r--r--src/lib/defs/digest_sizes.h18
-rw-r--r--src/lib/defs/include.am3
-rw-r--r--src/lib/err/.may_include3
-rw-r--r--src/lib/err/backtrace.c (renamed from src/common/backtrace.c)104
-rw-r--r--src/lib/err/backtrace.h (renamed from src/common/backtrace.h)14
-rw-r--r--src/lib/err/include.am19
-rw-r--r--src/lib/err/torerr.c230
-rw-r--r--src/lib/err/torerr.h47
-rw-r--r--src/lib/fdio/.may_include4
-rw-r--r--src/lib/fdio/fdio.c109
-rw-r--r--src/lib/fdio/fdio.h17
-rw-r--r--src/lib/fdio/include.am17
-rw-r--r--src/lib/include.libdonna.am24
-rw-r--r--src/lib/intmath/.may_include4
-rw-r--r--src/lib/intmath/addsub.c20
-rw-r--r--src/lib/intmath/addsub.h13
-rw-r--r--src/lib/intmath/bits.c88
-rw-r--r--src/lib/intmath/bits.h16
-rw-r--r--src/lib/intmath/cmp.h20
-rw-r--r--src/lib/intmath/include.am22
-rw-r--r--src/lib/intmath/muldiv.c75
-rw-r--r--src/lib/intmath/muldiv.h22
-rw-r--r--src/lib/lock/.may_include5
-rw-r--r--src/lib/lock/compat_mutex.c34
-rw-r--r--src/lib/lock/compat_mutex.h60
-rw-r--r--src/lib/lock/compat_mutex_pthreads.c97
-rw-r--r--src/lib/lock/compat_mutex_winthreads.c40
-rw-r--r--src/lib/lock/include.am24
-rw-r--r--src/lib/log/.may_include15
-rw-r--r--src/lib/log/include.am24
-rw-r--r--src/lib/log/ratelim.c55
-rw-r--r--src/lib/log/ratelim.h48
-rw-r--r--src/lib/log/torlog.c (renamed from src/common/log.c)161
-rw-r--r--src/lib/log/torlog.h (renamed from src/common/torlog.h)17
-rw-r--r--src/lib/log/util_bug.c (renamed from src/common/util_bug.c)41
-rw-r--r--src/lib/log/util_bug.h (renamed from src/common/util_bug.h)16
-rw-r--r--src/lib/malloc/.may_include6
-rw-r--r--src/lib/malloc/include.am17
-rw-r--r--src/lib/malloc/util_malloc.c230
-rw-r--r--src/lib/malloc/util_malloc.h92
-rw-r--r--src/lib/string/.may_include9
-rw-r--r--src/lib/string/compat_ctype.c67
-rw-r--r--src/lib/string/compat_ctype.h62
-rw-r--r--src/lib/string/compat_string.c14
-rw-r--r--src/lib/string/compat_string.h39
-rw-r--r--src/lib/string/include.am25
-rw-r--r--src/lib/string/printf.c152
-rw-r--r--src/lib/string/printf.h25
-rw-r--r--src/lib/string/scanf.c312
-rw-r--r--src/lib/string/scanf.h19
-rw-r--r--src/lib/string/util_string.c340
-rw-r--r--src/lib/string/util_string.h42
-rw-r--r--src/lib/testsupport/.may_include (renamed from src/test/geoip_dummy)0
-rw-r--r--src/lib/testsupport/include.am3
-rw-r--r--src/lib/testsupport/testsupport.h (renamed from src/common/testsupport.h)2
-rw-r--r--src/lib/tls/.may_include13
-rw-r--r--src/lib/tls/buffers_tls.c (renamed from src/common/buffers_tls.c)18
-rw-r--r--src/lib/tls/buffers_tls.h (renamed from src/common/buffers_tls.h)2
-rw-r--r--src/lib/tls/ciphers.inc (renamed from src/common/ciphers.inc)0
-rw-r--r--src/lib/tls/include.am20
-rw-r--r--src/lib/tls/tortls.c (renamed from src/common/tortls.c)21
-rw-r--r--src/lib/tls/tortls.h (renamed from src/common/tortls.h)10
-rw-r--r--src/lib/trace/.may_include3
-rw-r--r--src/lib/trace/debug.h (renamed from src/trace/debug.h)4
-rw-r--r--src/lib/trace/events.h (renamed from src/trace/events.h)4
-rw-r--r--src/lib/trace/include.am18
-rw-r--r--src/lib/trace/trace.c (renamed from src/trace/trace.c)4
-rw-r--r--src/lib/trace/trace.h (renamed from src/trace/trace.h)2
-rw-r--r--src/lib/wallclock/.may_include6
-rw-r--r--src/lib/wallclock/approx_time.c38
-rw-r--r--src/lib/wallclock/approx_time.h20
-rw-r--r--src/lib/wallclock/include.am21
-rw-r--r--src/lib/wallclock/tm_cvt.c195
-rw-r--r--src/lib/wallclock/tm_cvt.h17
-rw-r--r--src/lib/wallclock/tor_gettimeofday.c82
-rw-r--r--src/lib/wallclock/tor_gettimeofday.h15
-rw-r--r--src/or/addressmap.c24
-rw-r--r--src/or/addressmap.h4
-rw-r--r--src/or/auth_dirs.inc1
-rw-r--r--src/or/authority_cert_st.h32
-rw-r--r--src/or/bridges.c33
-rw-r--r--src/or/bridges.h2
-rw-r--r--src/or/cached_dir_st.h25
-rw-r--r--src/or/cell_queue_st.h28
-rw-r--r--src/or/cell_st.h20
-rw-r--r--src/or/channel.c48
-rw-r--r--src/or/channel.h10
-rw-r--r--src/or/channelpadding.c33
-rw-r--r--src/or/channelpadding.h4
-rw-r--r--src/or/channeltls.c53
-rw-r--r--src/or/channeltls.h6
-rw-r--r--src/or/circpathbias.c34
-rw-r--r--src/or/circpathbias.h2
-rw-r--r--src/or/circuit_st.h172
-rw-r--r--src/or/circuitbuild.c86
-rw-r--r--src/or/circuitbuild.h2
-rw-r--r--src/or/circuitlist.c110
-rw-r--r--src/or/circuitlist.h15
-rw-r--r--src/or/circuitmux.c16
-rw-r--r--src/or/circuitmux.h6
-rw-r--r--src/or/circuitmux_ewma.c12
-rw-r--r--src/or/circuitmux_ewma.h6
-rw-r--r--src/or/circuitstats.c50
-rw-r--r--src/or/circuitstats.h17
-rw-r--r--src/or/circuituse.c67
-rw-r--r--src/or/circuituse.h2
-rw-r--r--src/or/command.c45
-rw-r--r--src/or/command.h4
-rw-r--r--src/or/config.c127
-rw-r--r--src/or/config.h8
-rw-r--r--src/or/confparse.c12
-rw-r--r--src/or/confparse.h2
-rw-r--r--src/or/connection.c137
-rw-r--r--src/or/connection.h51
-rw-r--r--src/or/connection_edge.c118
-rw-r--r--src/or/connection_edge.h10
-rw-r--r--src/or/connection_or.c87
-rw-r--r--src/or/connection_or.h4
-rw-r--r--src/or/connection_st.h131
-rw-r--r--src/or/conscache.c12
-rw-r--r--src/or/conscache.h4
-rw-r--r--src/or/consdiff.c11
-rw-r--r--src/or/consdiff.h7
-rw-r--r--src/or/consdiffmgr.c23
-rw-r--r--src/or/consdiffmgr.h2
-rw-r--r--src/or/control.c152
-rw-r--r--src/or/control.h4
-rw-r--r--src/or/control_connection_st.h46
-rw-r--r--src/or/cpath_build_state_st.h38
-rw-r--r--src/or/cpuworker.c32
-rw-r--r--src/or/cpuworker.h2
-rw-r--r--src/or/crypt_path_reference_st.h23
-rw-r--r--src/or/crypt_path_st.h56
-rw-r--r--src/or/desc_store_st.h34
-rw-r--r--src/or/destroy_cell_queue_st.h27
-rw-r--r--src/or/dir_connection_st.h66
-rw-r--r--src/or/dir_server_st.h54
-rw-r--r--src/or/dirauth/dircollate.c9
-rw-r--r--src/or/dirauth/dircollate.h6
-rw-r--r--src/or/dirauth/dirvote.c82
-rw-r--r--src/or/dirauth/dirvote.h6
-rw-r--r--src/or/dirauth/mode.h4
-rw-r--r--src/or/dirauth/shared_random.c39
-rw-r--r--src/or/dirauth/shared_random.h4
-rw-r--r--src/or/dirauth/shared_random_state.c24
-rw-r--r--src/or/dirauth/shared_random_state.h4
-rw-r--r--src/or/directory.c128
-rw-r--r--src/or/directory.h31
-rw-r--r--src/or/dirserv.c112
-rw-r--r--src/or/dirserv.h15
-rw-r--r--src/or/dns.c34
-rw-r--r--src/or/dns.h4
-rw-r--r--src/or/dns_structs.h2
-rw-r--r--src/or/dnsserv.c24
-rw-r--r--src/or/dnsserv.h2
-rw-r--r--src/or/document_signature_st.h29
-rw-r--r--src/or/dos.c29
-rw-r--r--src/or/dos.h2
-rw-r--r--src/or/download_status_st.h65
-rw-r--r--src/or/edge_connection_st.h77
-rw-r--r--src/or/entry_connection_st.h100
-rw-r--r--src/or/entry_port_cfg_st.h54
-rw-r--r--src/or/entrynodes.c60
-rw-r--r--src/or/entrynodes.h4
-rw-r--r--src/or/ext_orport.c26
-rw-r--r--src/or/ext_orport.h2
-rw-r--r--src/or/extend_info_st.h28
-rw-r--r--src/or/extrainfo_st.h30
-rw-r--r--src/or/fp_pair.c6
-rw-r--r--src/or/fp_pair.h8
-rw-r--r--src/or/geoip.c23
-rw-r--r--src/or/geoip.h6
-rw-r--r--src/or/git_revision.c4
-rw-r--r--src/or/git_revision.h2
-rw-r--r--src/or/hibernate.c30
-rw-r--r--src/or/hibernate.h4
-rw-r--r--src/or/hs_cache.c26
-rw-r--r--src/or/hs_cache.h12
-rw-r--r--src/or/hs_cell.c30
-rw-r--r--src/or/hs_cell.h6
-rw-r--r--src/or/hs_circuit.c53
-rw-r--r--src/or/hs_circuit.h8
-rw-r--r--src/or/hs_circuitmap.c13
-rw-r--r--src/or/hs_circuitmap.h2
-rw-r--r--src/or/hs_client.c59
-rw-r--r--src/or/hs_client.h8
-rw-r--r--src/or/hs_common.c69
-rw-r--r--src/or/hs_common.h6
-rw-r--r--src/or/hs_config.c10
-rw-r--r--src/or/hs_config.h4
-rw-r--r--src/or/hs_control.c21
-rw-r--r--src/or/hs_control.h4
-rw-r--r--src/or/hs_descriptor.c26
-rw-r--r--src/or/hs_descriptor.h15
-rw-r--r--src/or/hs_ident.c6
-rw-r--r--src/or/hs_ident.h6
-rw-r--r--src/or/hs_intropoint.c36
-rw-r--r--src/or/hs_intropoint.h10
-rw-r--r--src/or/hs_ntor.c8
-rw-r--r--src/or/hs_ntor.h4
-rw-r--r--src/or/hs_service.c90
-rw-r--r--src/or/hs_service.h18
-rw-r--r--src/or/hs_stats.c6
-rw-r--r--src/or/hsdir_index_st.h24
-rw-r--r--src/or/include.am95
-rw-r--r--src/or/keypin.c22
-rw-r--r--src/or/keypin.h4
-rw-r--r--src/or/listener_connection_st.h25
-rw-r--r--src/or/main.c180
-rw-r--r--src/or/main.h4
-rw-r--r--src/or/microdesc.c37
-rw-r--r--src/or/microdesc.h2
-rw-r--r--src/or/microdesc_st.h71
-rw-r--r--src/or/networkstatus.c94
-rw-r--r--src/or/networkstatus.h4
-rw-r--r--src/or/networkstatus_sr_info_st.h23
-rw-r--r--src/or/networkstatus_st.h95
-rw-r--r--src/or/networkstatus_voter_info_st.h30
-rw-r--r--src/or/node_st.h102
-rw-r--r--src/or/nodelist.c113
-rw-r--r--src/or/nodelist.h4
-rw-r--r--src/or/ns_detached_signatures_st.h22
-rw-r--r--src/or/ntmain.c10
-rw-r--r--src/or/ntmain.h2
-rw-r--r--src/or/onion.c36
-rw-r--r--src/or/onion.h2
-rw-r--r--src/or/onion_fast.c10
-rw-r--r--src/or/onion_fast.h2
-rw-r--r--src/or/onion_ntor.c15
-rw-r--r--src/or/onion_ntor.h8
-rw-r--r--src/or/onion_tap.c14
-rw-r--r--src/or/onion_tap.h2
-rw-r--r--src/or/or.h2361
-rw-r--r--src/or/or_circuit_st.h80
-rw-r--r--src/or/or_connection_st.h90
-rw-r--r--src/or/or_handshake_certs_st.h39
-rw-r--r--src/or/or_handshake_state_st.h78
-rw-r--r--src/or/origin_circuit_st.h235
-rw-r--r--src/or/parsecommon.c10
-rw-r--r--src/or/parsecommon.h19
-rw-r--r--src/or/periodic.c12
-rw-r--r--src/or/periodic.h2
-rw-r--r--src/or/policies.c31
-rw-r--r--src/or/policies.h2
-rw-r--r--src/or/port_cfg_st.h35
-rw-r--r--src/or/proto_cell.c12
-rw-r--r--src/or/proto_cell.h2
-rw-r--r--src/or/proto_control0.c8
-rw-r--r--src/or/proto_control0.h2
-rw-r--r--src/or/proto_ext_or.c10
-rw-r--r--src/or/proto_ext_or.h2
-rw-r--r--src/or/proto_http.c8
-rw-r--r--src/or/proto_http.h2
-rw-r--r--src/or/proto_socks.c22
-rw-r--r--src/or/proto_socks.h2
-rw-r--r--src/or/protover.c58
-rw-r--r--src/or/protover.h14
-rw-r--r--src/or/protover_rust.c23
-rw-r--r--src/or/reasons.c8
-rw-r--r--src/or/reasons.h2
-rw-r--r--src/or/relay.c109
-rw-r--r--src/or/relay.h2
-rw-r--r--src/or/relay_crypto.c17
-rw-r--r--src/or/relay_crypto.h2
-rw-r--r--src/or/relay_crypto_st.h27
-rw-r--r--src/or/rend_authorized_client_st.h18
-rw-r--r--src/or/rend_encoded_v2_service_descriptor_st.h17
-rw-r--r--src/or/rend_intro_point_st.h74
-rw-r--r--src/or/rend_service_descriptor_st.h34
-rw-r--r--src/or/rendcache.c22
-rw-r--r--src/or/rendcache.h6
-rw-r--r--src/or/rendclient.c62
-rw-r--r--src/or/rendclient.h4
-rw-r--r--src/or/rendcommon.c51
-rw-r--r--src/or/rendcommon.h2
-rw-r--r--src/or/rendmid.c28
-rw-r--r--src/or/rendmid.h2
-rw-r--r--src/or/rendservice.c67
-rw-r--r--src/or/rendservice.h6
-rw-r--r--src/or/rephist.c35
-rw-r--r--src/or/rephist.h2
-rw-r--r--src/or/replaycache.c6
-rw-r--r--src/or/replaycache.h2
-rw-r--r--src/or/router.c85
-rw-r--r--src/or/router.h4
-rw-r--r--src/or/routerinfo_st.h107
-rw-r--r--src/or/routerkeys.c16
-rw-r--r--src/or/routerkeys.h4
-rw-r--r--src/or/routerlist.c98
-rw-r--r--src/or/routerlist.h7
-rw-r--r--src/or/routerlist_st.h40
-rw-r--r--src/or/routerparse.c72
-rw-r--r--src/or/routerparse.h3
-rw-r--r--src/or/routerset.c26
-rw-r--r--src/or/routerset.h5
-rw-r--r--src/or/routerstatus_st.h80
-rw-r--r--src/or/scheduler.c18
-rw-r--r--src/or/scheduler.h8
-rw-r--r--src/or/scheduler_kist.c20
-rw-r--r--src/or/scheduler_vanilla.c10
-rw-r--r--src/or/server_port_cfg_st.h20
-rw-r--r--src/or/shared_random_client.c16
-rw-r--r--src/or/shared_random_client.h4
-rw-r--r--src/or/signed_descriptor_st.h61
-rw-r--r--src/or/socks_request_st.h59
-rw-r--r--src/or/statefile.c28
-rw-r--r--src/or/statefile.h2
-rw-r--r--src/or/status.c36
-rw-r--r--src/or/status.h4
-rw-r--r--src/or/tor_api.c6
-rw-r--r--src/or/tor_api.h2
-rw-r--r--src/or/tor_api_internal.h2
-rw-r--r--src/or/tor_main.c2
-rw-r--r--src/or/tor_version_st.h32
-rw-r--r--src/or/torcert.c22
-rw-r--r--src/or/torcert.h4
-rw-r--r--src/or/transports.c24
-rw-r--r--src/or/transports.h2
-rw-r--r--src/or/var_cell_st.h23
-rw-r--r--src/or/vote_microdesc_hash_st.h22
-rw-r--r--src/or/vote_routerstatus_st.h41
-rw-r--r--src/or/vote_timing_st.h24
-rw-r--r--src/or/voting_schedule.c38
-rw-r--r--src/or/voting_schedule.h8
-rw-r--r--src/rust/.cargo/config.in15
-rw-r--r--src/rust/build.rs187
-rw-r--r--src/rust/crypto/Cargo.toml6
-rw-r--r--src/rust/crypto/digests/sha2.rs47
-rw-r--r--src/rust/crypto/lib.rs26
-rw-r--r--src/rust/crypto/rand/mod.rs10
-rw-r--r--src/rust/crypto/rand/rng.rs4
-rw-r--r--src/rust/external/crypto_digest.rs20
-rw-r--r--src/rust/external/external.rs2
-rw-r--r--src/rust/include.am1
-rw-r--r--src/rust/protover/Cargo.toml1
-rw-r--r--src/rust/protover/ffi.rs42
-rw-r--r--src/rust/protover/lib.rs2
-rw-r--r--src/rust/protover/protover.rs95
-rw-r--r--src/rust/protover/tests/protover.rs2
-rw-r--r--src/rust/smartlist/lib.rs2
-rw-r--r--src/rust/smartlist/smartlist.rs2
-rw-r--r--src/rust/tor_allocate/lib.rs2
-rw-r--r--src/rust/tor_allocate/tor_allocate.rs2
-rw-r--r--src/rust/tor_log/Cargo.toml1
-rw-r--r--src/rust/tor_log/lib.rs2
-rw-r--r--src/rust/tor_log/tor_log.rs6
-rw-r--r--src/rust/tor_rust/include.am25
-rw-r--r--src/rust/tor_util/ffi.rs2
-rw-r--r--src/rust/tor_util/lib.rs2
-rw-r--r--src/rust/tor_util/strings.rs2
-rw-r--r--src/test/bench.c26
-rwxr-xr-xsrc/test/bt_test.py2
-rw-r--r--src/test/ed25519_exts_ref.py2
-rw-r--r--src/test/fakechans.h2
-rw-r--r--src/test/fuzz/dict/http2
-rw-r--r--src/test/fuzz/fuzz_consensus.c10
-rw-r--r--src/test/fuzz/fuzz_descriptor.c12
-rw-r--r--src/test/fuzz/fuzz_diff.c8
-rw-r--r--src/test/fuzz/fuzz_diff_apply.c8
-rw-r--r--src/test/fuzz/fuzz_extrainfo.c12
-rw-r--r--src/test/fuzz/fuzz_hsdescv2.c10
-rw-r--r--src/test/fuzz/fuzz_hsdescv3.c16
-rw-r--r--src/test/fuzz/fuzz_http.c20
-rw-r--r--src/test/fuzz/fuzz_http_connect.c23
-rw-r--r--src/test/fuzz/fuzz_iptsv2.c13
-rw-r--r--src/test/fuzz/fuzz_microdesc.c10
-rw-r--r--src/test/fuzz/fuzz_vrs.c18
-rw-r--r--src/test/fuzz/fuzzing.h2
-rw-r--r--src/test/fuzz/fuzzing_common.c14
-rw-r--r--src/test/fuzz/include.am18
-rwxr-xr-xsrc/test/fuzz_static_testcases.sh2
-rw-r--r--src/test/hs_ntor_ref.py2
-rw-r--r--src/test/hs_test_helpers.c14
-rw-r--r--src/test/hs_test_helpers.h6
-rw-r--r--src/test/include.am82
-rw-r--r--src/test/log_test_helpers.c6
-rw-r--r--src/test/log_test_helpers.h4
-rwxr-xr-xsrc/test/ntor_ref.py2
-rw-r--r--src/test/rend_test_helpers.c16
-rw-r--r--src/test/rend_test_helpers.h4
-rw-r--r--src/test/rust_supp.txt1
-rw-r--r--src/test/test-child.c2
-rw-r--r--src/test/test-memwipe.c8
-rw-r--r--src/test/test-timers.c12
-rw-r--r--src/test/test.c56
-rw-r--r--src/test/test.h8
-rw-r--r--src/test/test_accounting.c12
-rw-r--r--src/test/test_addr.c12
-rw-r--r--src/test/test_address.c10
-rw-r--r--src/test/test_address_set.c27
-rw-r--r--src/test/test_bridges.c21
-rw-r--r--src/test/test_bt_cl.c10
-rw-r--r--src/test/test_buffers.c16
-rw-r--r--src/test/test_bwmgt.c6
-rw-r--r--src/test/test_cell_formats.c31
-rw-r--r--src/test/test_cell_queue.c15
-rw-r--r--src/test/test_channel.c34
-rw-r--r--src/test/test_channelpadding.c35
-rw-r--r--src/test/test_channeltls.c26
-rw-r--r--src/test/test_checkdir.c10
-rw-r--r--src/test/test_circuitbuild.c16
-rw-r--r--src/test/test_circuitlist.c24
-rw-r--r--src/test/test_circuitmux.c18
-rw-r--r--src/test/test_circuitstats.c27
-rw-r--r--src/test/test_circuituse.c21
-rw-r--r--src/test/test_compat_libevent.c10
-rw-r--r--src/test/test_config.c76
-rw-r--r--src/test/test_connection.c40
-rw-r--r--src/test/test_connection.h2
-rw-r--r--src/test/test_conscache.c10
-rw-r--r--src/test/test_consdiff.c12
-rw-r--r--src/test/test_consdiffmgr.c30
-rw-r--r--src/test/test_containers.c15
-rw-r--r--src/test/test_controller.c105
-rw-r--r--src/test/test_controller_events.c17
-rw-r--r--src/test/test_crypto.c75
-rw-r--r--src/test/test_crypto_openssl.c14
-rw-r--r--src/test/test_crypto_slow.c12
-rw-r--r--src/test/test_data.c4
-rw-r--r--src/test/test_dir.c207
-rw-r--r--src/test/test_dir_common.c24
-rw-r--r--src/test/test_dir_common.h8
-rw-r--r--src/test/test_dir_handle_get.c57
-rw-r--r--src/test/test_dns.c15
-rw-r--r--src/test/test_dos.c29
-rw-r--r--src/test/test_entryconn.c25
-rw-r--r--src/test/test_entrynodes.c59
-rw-r--r--src/test/test_extorport.c25
-rw-r--r--src/test/test_geoip.c91
-rw-r--r--src/test/test_guardfraction.c29
-rw-r--r--src/test/test_handles.c8
-rw-r--r--src/test/test_helpers.c40
-rw-r--r--src/test/test_helpers.h4
-rw-r--r--src/test/test_hs.c28
-rw-r--r--src/test/test_hs_cache.c27
-rw-r--r--src/test/test_hs_cell.c20
-rw-r--r--src/test/test_hs_client.c55
-rw-r--r--src/test/test_hs_common.c50
-rw-r--r--src/test/test_hs_config.c18
-rw-r--r--src/test/test_hs_control.c32
-rw-r--r--src/test/test_hs_descriptor.c26
-rw-r--r--src/test/test_hs_intropoint.c36
-rw-r--r--src/test/test_hs_ntor.c10
-rw-r--r--src/test/test_hs_ntor_cl.c16
-rw-r--r--src/test/test_hs_service.c71
-rw-r--r--src/test/test_introduce.c10
-rw-r--r--src/test/test_keypin.c10
-rw-r--r--src/test/test_link_handshake.c37
-rw-r--r--src/test/test_logging.c15
-rw-r--r--src/test/test_mainloop.c8
-rw-r--r--src/test/test_microdesc.c27
-rw-r--r--src/test/test_nodelist.c21
-rw-r--r--src/test/test_ntor_cl.c14
-rw-r--r--src/test/test_oom.c27
-rw-r--r--src/test/test_oos.c17
-rw-r--r--src/test/test_options.c28
-rw-r--r--src/test/test_periodic_event.c18
-rw-r--r--src/test/test_policy.c19
-rw-r--r--src/test/test_procmon.c10
-rw-r--r--src/test/test_proto_http.c12
-rw-r--r--src/test/test_proto_misc.c20
-rw-r--r--src/test/test_protover.c37
-rw-r--r--src/test/test_pt.c20
-rw-r--r--src/test/test_pubsub.c85
-rw-r--r--src/test/test_relay.c17
-rw-r--r--src/test/test_relaycell.c54
-rw-r--r--src/test/test_relaycrypt.c19
-rw-r--r--src/test/test_rendcache.c27
-rw-r--r--src/test/test_replay.c8
-rw-r--r--src/test/test_router.c18
-rw-r--r--src/test/test_routerkeys.c18
-rw-r--r--src/test/test_routerlist.c54
-rw-r--r--src/test/test_routerset.c22
-rwxr-xr-xsrc/test/test_rust.sh23
-rw-r--r--src/test/test_scheduler.c22
-rw-r--r--src/test/test_shared_random.c35
-rw-r--r--src/test/test_slow.c6
-rw-r--r--src/test/test_socks.c15
-rw-r--r--src/test/test_status.c32
-rw-r--r--src/test/test_storagedir.c10
-rw-r--r--src/test/test_switch_id.c4
-rw-r--r--src/test/test_threads.c8
-rw-r--r--src/test/test_tortls.c16
-rw-r--r--src/test/test_util.c25
-rw-r--r--src/test/test_util_format.c10
-rw-r--r--src/test/test_util_process.c10
-rw-r--r--src/test/test_util_slow.c12
-rw-r--r--src/test/test_voting_schedule.c6
-rw-r--r--src/test/test_workqueue.c16
-rw-r--r--src/test/testing_common.c38
-rw-r--r--src/test/testing_rsakeys.c8
-rw-r--r--src/tools/include.am25
-rw-r--r--src/tools/tor-gencert.c44
-rw-r--r--src/tools/tor-resolve.c13
-rw-r--r--src/tools/tor_runner.c6
-rw-r--r--src/trace/include.am22
-rw-r--r--src/trunnel/include.am11
-rw-r--r--src/trunnel/trunnel-local.h6
-rw-r--r--src/win32/orconfig.h2
688 files changed, 21328 insertions, 14579 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
new file mode 100644
index 0000000000..197097d1fd
--- /dev/null
+++ b/.appveyor.yml
@@ -0,0 +1,62 @@
+version: 1.0.{build}
+
+clone_depth: 50
+
+environment:
+ compiler: mingw
+
+ matrix:
+ - target: i686-w64-mingw32
+ compiler_path: mingw32
+ openssl_path: /c/OpenSSL-Win32
+ - target: x86_64-w64-mingw32
+ compiler_path: mingw64
+ openssl_path: /c/OpenSSL-Win64
+
+install:
+- ps: >-
+ Function Execute-Command ($commandPath)
+ {
+ & $commandPath $args 2>&1
+ if ( $LastExitCode -ne 0 ) {
+ $host.SetShouldExit( $LastExitCode )
+ }
+ }
+ Function Execute-Bash ()
+ {
+ Execute-Command 'c:\msys64\usr\bin\bash' '-e' '-c' $args
+ }
+ Execute-Command "C:\msys64\usr\bin\pacman" -Sy --noconfirm openssl-devel openssl libevent-devel libevent mingw-w64-i686-libevent mingw-w64-x86_64-libevent mingw-w64-i686-openssl mingw-w64-x86_64-openssl mingw-w64-i686-zstd mingw-w64-x86_64-zstd
+
+build_script:
+- ps: >-
+ if ($env:compiler -eq "mingw") {
+ $oldpath = ${env:Path} -split ';'
+ $buildpath = @("C:\msys64\${env:compiler_path}\bin", "C:\msys64\usr\bin") + $oldpath
+ $env:Path = @($buildpath) -join ';'
+ $env:build = @("${env:APPVEYOR_BUILD_FOLDER}", $env:target) -join '\'
+ Set-Location "${env:APPVEYOR_BUILD_FOLDER}"
+ Execute-Bash 'autoreconf -i'
+ mkdir "${env:build}"
+ Set-Location "${env:build}"
+ Execute-Bash "../configure --prefix=/${env:compiler_path} --build=${env:target} --host=${env:target} --disable-asciidoc --enable-fatal-warnings --with-openssl-dir=${env:openssl_path}"
+ Execute-Bash "V=1 make -j2"
+ Execute-Bash "V=1 make -j2 install"
+ }
+
+test_script:
+- ps: >-
+ if ($env:compiler -eq "mingw") {
+ $oldpath = ${env:Path} -split ';'
+ $buildpath = @("C:\msys64\${env:compiler_path}\bin") + $oldpath
+ $env:Path = $buildpath -join ';'
+ Set-Location "${env:build}"
+ Execute-Bash "VERBOSE=1 make -j2 check"
+ }
+
+on_success:
+- cmd: C:\Python27\python.exe %APPVEYOR_BUILD_FOLDER%\scripts\test\appveyor-irc-notify.py irc.oftc.net:6697 tor-ci success
+
+on_failure:
+- cmd: C:\Python27\python.exe %APPVEYOR_BUILD_FOLDER%\scripts\test\appveyor-irc-notify.py irc.oftc.net:6697 tor-ci failure
+
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000000..27ed90fafd
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,33 @@
+# this should work for all editors that support .editorconfig!
+#
+# on debian, emacs users should install elpa-editorconfig and vim
+# users should install vim-editorconfig.
+
+root = true
+
+[*]
+indent_style = space
+# this remove final newline in some editors, instead of inserting it
+# insert_final_newline = true
+trim_trailing_whitespace = true
+end_of_line = lf
+charset = utf-8
+max_line_length = 79
+
+[*.py]
+indent_size = 4
+# to do not have final newline in python code
+insert_final_newline = true
+
+[*.c, *.h]
+# done in tests and other cases do not use 2 spaces identations, so this
+# should be commented on those cases
+indent_size = 2
+trim_trailing_whitespace = true
+
+[Makefile, *.am]
+indent_style = tab
+
+[*-spec.txt]
+# specs seem to have 76 chars max per lines as RFCs
+max_line_length = 76 \ No newline at end of file
diff --git a/.gitignore b/.gitignore
index c00fbe97e1..025d7202d1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -45,6 +45,7 @@ uptime-*.json
/autom4te.cache
/build-stamp
/compile
+/config.rust
/configure
/Doxyfile
/orconfig.h
@@ -55,6 +56,7 @@ uptime-*.json
/config.guess
/config.sub
/conftest*
+/link_rust.sh
/micro-revision.*
/patch-stamp
/stamp-h
@@ -139,14 +141,9 @@ uptime-*.json
/src/common/libor-ctime.a
/src/common/libor-ctime-testing.a
/src/common/libor-ctime.lib
-/src/common/libor-crypto.a
-/src/common/libor-crypto-testing.a
-/src/common/libor-crypto.lib
/src/common/libor-event.a
/src/common/libor-event-testing.a
/src/common/libor-event.lib
-/src/common/libcurve25519_donna.a
-/src/common/libcurve25519_donna.lib
# /src/config/
/src/config/Makefile
@@ -164,6 +161,36 @@ uptime-*.json
/src/ext/keccak-tiny/libkeccak-tiny.a
/src/ext/keccak-tiny/libkeccak-tiny.lib
+# /src/lib
+/src/lib/libcurve25519_donna.a
+/src/lib/libtor-compress.a
+/src/lib/libtor-compress-testing.a
+/src/lib/libtor-container.a
+/src/lib/libtor-container-testing.a
+/src/lib/libtor-crypt-ops.a
+/src/lib/libtor-crypt-ops-testing.a
+/src/lib/libtor-ctime.a
+/src/lib/libtor-ctime-testing.a
+/src/lib/libtor-err.a
+/src/lib/libtor-err-testing.a
+/src/lib/libtor-fdio.a
+/src/lib/libtor-fdio-testing.a
+/src/lib/libtor-intmath.a
+/src/lib/libtor-intmath-testing.a
+/src/lib/libtor-lock.a
+/src/lib/libtor-lock-testing.a
+/src/lib/libtor-log.a
+/src/lib/libtor-log-testing.a
+/src/lib/libtor-malloc.a
+/src/lib/libtor-malloc-testing.a
+/src/lib/libtor-string.a
+/src/lib/libtor-string-testing.a
+/src/lib/libtor-tls.a
+/src/lib/libtor-tls-testing.a
+/src/lib/libtor-trace.a
+/src/lib/libtor-wallclock.a
+/src/lib/libtor-wallclock-testing.a
+
# /src/or/
/src/or/Makefile
/src/or/Makefile.in
@@ -171,8 +198,8 @@ uptime-*.json
/src/or/tor.exe
/src/or/tor-cov
/src/or/tor-cov.exe
-/src/or/libtor.a
-/src/or/libtor-testing.a
+/src/or/libtor-app.a
+/src/or/libtor-app-testing.a
/src/or/libtor.lib
# /src/rust
diff --git a/.travis.yml b/.travis.yml
index aab6f6b3d5..f37f9a23ff 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -87,8 +87,9 @@ matrix:
## branches and build history pages. See
## https://github.com/travis-ci/travis-ci/issues/8716
allow_failures:
- # - env: RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true
- # - env: RUST_OPTIONS="--enable-rust --enable-cargo-online-mode
+ - env: RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true
+ - env: RUST_OPTIONS="--enable-rust --enable-cargo-online-mode"
+ - env: DISTCHECK="yes" RUST_OPTIONS="--enable-rust --enable-cargo-online-mode"
# - compiler: clang
## Create explicit matrix entries to work around a Travis CI
diff --git a/ChangeLog b/ChangeLog
index 53ddf4976d..5d2c6e6ec8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,279 @@
-Changes in version 0.3.4.1-alpha - 2018-05-16
+Changes in version 0.3.4.3-alpha - 2018-06-26
+ Tor 0.3.4.3-alpha fixes several bugs in earlier versions, including
+ one that was causing stability issues on directory authorities.
+
+ o Major bugfixes (directory authority):
+ - Stop leaking memory on directory authorities when planning to
+ vote. This bug was crashing authorities by exhausting their
+ memory. Fixes bug 26435; bugfix on 0.3.3.6.
+
+ o Major bugfixes (rust, testing):
+ - Make sure that failing tests in Rust will actually cause the build
+ to fail: previously, they were ignored. Fixes bug 26258; bugfix
+ on 0.3.3.4-alpha.
+
+ o Minor feature (directory authorities):
+ - Stop warning about incomplete bw lines before the first complete
+ bw line has been found, so that additional header lines can be
+ ignored. Fixes bug 25960; bugfix on 0.2.2.1-alpha
+
+ o Minor features (relay, diagnostic):
+ - Add several checks to detect whether Tor relays are uploading
+ their descriptors without specifying why they regenerated them.
+ Diagnostic for ticket 25686.
+
+ o Minor features (unit tests):
+ - Test complete bandwidth measurements files, and test that
+ incomplete bandwidth lines only give warnings when the end of the
+ header has not been detected. Fixes bug 25947; bugfix
+ on 0.2.2.1-alpha
+
+ o Minor bugfixes (compilation):
+ - Refrain from compiling unit testing related object files when
+ --disable-unittests is set to configure script. Fixes bug 24891;
+ bugfix on 0.2.5.1-alpha.
+ - When linking the libtor_testing.a library, only include the
+ dirauth object files once. Previously, they were getting added
+ twice. Fixes bug 26402; bugfix on 0.3.4.1-alpha.
+ - The --enable-fatal-warnings flag now affects Rust code as well.
+ Closes ticket 26245.
+
+ o Minor bugfixes (onion services):
+ - Recompute some consensus information after detecting a clock jump,
+ or after transitioning from a non-live consensus to a live
+ consensus. We do this to avoid having an outdated state, and
+ miscalculating the index for next-generation onion services. Fixes
+ bug 24977; bugfix on 0.3.2.1-alpha.
+
+ o Minor bugfixes (relay):
+ - Relays now correctly block attempts to re-extend to the previous
+ relay by Ed25519 identity. Previously they would warn in this
+ case, but not actually reject the attempt. Fixes bug 26158; bugfix
+ on 0.3.0.1-alpha.
+
+ o Minor bugfixes (testing):
+ - Fix compilation of the doctests in the Rust crypto crate. Fixes
+ bug 26415; bugfix on 0.3.4.1-alpha.
+ - Instead of trying to read the geoip configuration files from
+ within the unit tests, instead create our own ersatz files with
+ just enough geoip data in the format we expect. Trying to read
+ from the source directory created problems on Windows with mingw,
+ where the build system's paths are not the same as the platform's
+ paths. Fixes bug 25787; bugfix on 0.3.4.1-alpha.
+ - Refrain from trying to get an item from an empty smartlist in
+ test_bridges_clear_bridge_list. Set DEBUG_SMARTLIST in unit tests
+ to catch improper smartlist usage. Furthermore, enable
+ DEBUG_SMARTLIST globally when build is configured with fragile
+ hardening. Fixes bug 26196; bugfix on 0.3.4.1-alpha.
+
+
+Changes in version 0.3.3.7 - 2018-06-12
+ Tor 0.3.3.7 backports several changes from the 0.3.4.x series, including
+ fixes for bugs affecting compatibility and stability.
+
+ o Directory authority changes:
+ - Add an IPv6 address for the "dannenberg" directory authority.
+ Closes ticket 26343.
+
+ o Minor features (geoip):
+ - Update geoip and geoip6 to the June 7 2018 Maxmind GeoLite2
+ Country database. Closes ticket 26351.
+
+ o Minor bugfixes (compatibility, openssl, backport from 0.3.4.2-alpha):
+ - Work around a change in OpenSSL 1.1.1 where return values that
+ would previously indicate "no password" now indicate an empty
+ password. Without this workaround, Tor instances running with
+ OpenSSL 1.1.1 would accept descriptors that other Tor instances
+ would reject. Fixes bug 26116; bugfix on 0.2.5.16.
+
+ o Minor bugfixes (compilation, backport from 0.3.4.2-alpha):
+ - Silence unused-const-variable warnings in zstd.h with some GCC
+ versions. Fixes bug 26272; bugfix on 0.3.1.1-alpha.
+
+ o Minor bugfixes (controller, backport from 0.3.4.2-alpha):
+ - Improve accuracy of the BUILDTIMEOUT_SET control port event's
+ TIMEOUT_RATE and CLOSE_RATE fields. (We were previously
+ miscounting the total number of circuits for these field values.)
+ Fixes bug 26121; bugfix on 0.3.3.1-alpha.
+
+ o Minor bugfixes (hardening, backport from 0.3.4.2-alpha):
+ - Prevent a possible out-of-bounds smartlist read in
+ protover_compute_vote(). Fixes bug 26196; bugfix on 0.2.9.4-alpha.
+
+ o Minor bugfixes (path selection, backport from 0.3.4.1-alpha):
+ - Only select relays when they have the descriptors we prefer to use
+ for them. This change fixes a bug where we could select a relay
+ because it had _some_ descriptor, but reject it later with a
+ nonfatal assertion error because it didn't have the exact one we
+ wanted. Fixes bugs 25691 and 25692; bugfix on 0.3.3.4-alpha.
+
+
+Changes in version 0.3.4.2-alpha - 2018-06-12
+ Tor 0.3.4.2-alpha fixes several minor bugs in the previous alpha
+ release, and forward-ports an authority-only security fix from 0.3.3.6.
+
+ o Directory authority changes:
+ - Add an IPv6 address for the "dannenberg" directory authority.
+ Closes ticket 26343.
+
+ o Major bugfixes (security, directory authority, denial-of-service, also in 0.3.3.6):
+ - Fix a bug that could have allowed an attacker to force a directory
+ authority to use up all its RAM by passing it a maliciously
+ crafted protocol versions string. Fixes bug 25517; bugfix on
+ 0.2.9.4-alpha. This issue is also tracked as TROVE-2018-005.
+
+ o Minor features (continuous integration):
+ - Add the necessary configuration files for continuous integration
+ testing on Windows, via the Appveyor platform. Closes ticket
+ 25549. Patches from Marcin Cieślak and Isis Lovecruft.
+
+ o Minor features (geoip):
+ - Update geoip and geoip6 to the June 7 2018 Maxmind GeoLite2
+ Country database. Closes ticket 26351.
+
+ o Minor bugfixes (compatibility, openssl):
+ - Work around a change in OpenSSL 1.1.1 where return values that
+ would previously indicate "no password" now indicate an empty
+ password. Without this workaround, Tor instances running with
+ OpenSSL 1.1.1 would accept descriptors that other Tor instances
+ would reject. Fixes bug 26116; bugfix on 0.2.5.16.
+
+ o Minor bugfixes (compilation):
+ - Silence unused-const-variable warnings in zstd.h with some GCC
+ versions. Fixes bug 26272; bugfix on 0.3.1.1-alpha.
+ - Fix compilation when using OpenSSL 1.1.0 with the "no-deprecated"
+ flag enabled. Fixes bug 26156; bugfix on 0.3.4.1-alpha.
+ - Avoid a compiler warning when casting the return value of
+ smartlist_len() to double with DEBUG_SMARTLIST enabled. Fixes bug
+ 26283; bugfix on 0.2.4.10-alpha.
+
+ o Minor bugfixes (control port):
+ - Do not count 0-length RELAY_COMMAND_DATA cells as valid data in
+ CIRC_BW events. Previously, such cells were counted entirely in
+ the OVERHEAD field. Now they are not. Fixes bug 26259; bugfix
+ on 0.3.4.1-alpha.
+
+ o Minor bugfixes (controller):
+ - Improve accuracy of the BUILDTIMEOUT_SET control port event's
+ TIMEOUT_RATE and CLOSE_RATE fields. (We were previously
+ miscounting the total number of circuits for these field values.)
+ Fixes bug 26121; bugfix on 0.3.3.1-alpha.
+
+ o Minor bugfixes (hardening):
+ - Prevent a possible out-of-bounds smartlist read in
+ protover_compute_vote(). Fixes bug 26196; bugfix on 0.2.9.4-alpha.
+
+ o Minor bugfixes (onion services):
+ - Fix a bug that blocked the creation of ephemeral v3 onion
+ services. Fixes bug 25939; bugfix on 0.3.4.1-alpha.
+
+ o Minor bugfixes (test coverage tools):
+ - Update our "cov-diff" script to handle output from the latest
+ version of gcov, and to remove extraneous timestamp information
+ from its output. Fixes bugs 26101 and 26102; bugfix
+ on 0.2.5.1-alpha.
+
+
+Changes in version 0.3.3.6 - 2018-05-22
+ Tor 0.3.3.6 is the first stable release in the 0.3.3 series. It
+ backports several important fixes from the 0.3.4.1-alpha.
+
+ The Tor 0.3.3 series includes controller support and other
+ improvements for v3 onion services, official support for embedding Tor
+ within other applications, and our first non-trivial module written in
+ the Rust programming language. (Rust is still not enabled by default
+ when building Tor.) And as usual, there are numerous other smaller
+ bugfixes, features, and improvements.
+
+ Below are the changes since 0.3.3.5-rc. For a list of all changes
+ since 0.3.2.10, see the ReleaseNotes file.
+
+ o Major bugfixes (directory authorities, security, backport from 0.3.4.1-alpha):
+ - When directory authorities read a zero-byte bandwidth file, they
+ would previously log a warning with the contents of an
+ uninitialised buffer. They now log a warning about the empty file
+ instead. Fixes bug 26007; bugfix on 0.2.2.1-alpha.
+
+ o Major bugfixes (security, directory authority, denial-of-service):
+ - Fix a bug that could have allowed an attacker to force a directory
+ authority to use up all its RAM by passing it a maliciously
+ crafted protocol versions string. Fixes bug 25517; bugfix on
+ 0.2.9.4-alpha. This issue is also tracked as TROVE-2018-005.
+
+ o Major bugfixes (crash, backport from 0.3.4.1-alpha):
+ - Avoid a rare assertion failure in the circuit build timeout code
+ if we fail to allow any circuits to actually complete. Fixes bug
+ 25733; bugfix on 0.2.2.2-alpha.
+
+ o Major bugfixes (directory authorities, backport from 0.3.4.1-alpha):
+ - Avoid a crash when testing router reachability on a router that
+ could have an ed25519 ID, but which does not. Fixes bug 25415;
+ bugfix on 0.3.3.2-alpha.
+
+ o Major bugfixes (onion service, backport from 0.3.4.1-alpha):
+ - Correctly detect when onion services get disabled after HUP. Fixes
+ bug 25761; bugfix on 0.3.2.1.
+
+ o Major bugfixes (relay, denial of service, backport from 0.3.4.1-alpha):
+ - Impose a limit on circuit cell queue size. The limit can be
+ controlled by a consensus parameter. Fixes bug 25226; bugfix
+ on 0.2.4.14-alpha.
+
+ o Minor features (compatibility, backport from 0.3.4.1-alpha):
+ - Avoid some compilation warnings with recent versions of LibreSSL.
+ Closes ticket 26006.
+
+ o Minor features (continuous integration, backport from 0.3.4.1-alpha):
+ - Our .travis.yml configuration now includes support for testing the
+ results of "make distcheck". (It's not uncommon for "make check"
+ to pass but "make distcheck" to fail.) Closes ticket 25814.
+ - Our Travis CI configuration now integrates with the Coveralls
+ coverage analysis tool. Closes ticket 25818.
+
+ o Minor features (geoip):
+ - Update geoip and geoip6 to the May 1 2018 Maxmind GeoLite2 Country
+ database. Closes ticket 26104.
+
+ o Minor bugfixes (client, backport from 0.3.4.1-alpha):
+ - Don't consider Tor running as a client if the ControlPort is open,
+ but no actual client ports are open. Fixes bug 26062; bugfix
+ on 0.2.9.4-alpha.
+
+ o Minor bugfixes (correctness, client, backport from 0.3.4.1-alpha):
+ - Upon receiving a malformed connected cell, stop processing the
+ cell immediately. Previously we would mark the connection for
+ close, but continue processing the cell as if the connection were
+ open. Fixes bug 26072; bugfix on 0.2.4.7-alpha.
+
+ o Minor bugfixes (documentation, backport from 0.3.4.1-alpha):
+ - Stop saying in the manual that clients cache ipv4 dns answers from
+ exit relays. We haven't used them since 0.2.6.3-alpha, and in
+ ticket 24050 we stopped even caching them as of 0.3.2.6-alpha, but
+ we forgot to say so in the man page. Fixes bug 26052; bugfix
+ on 0.3.2.6-alpha.
+
+ o Minor bugfixes (Linux seccomp2 sandbox, backport from 0.3.4.1-alpha):
+ - Allow the nanosleep() system call, which glibc uses to implement
+ sleep() and usleep(). Fixes bug 24969; bugfix on 0.2.5.1-alpha.
+
+ o Minor bugfixes (onion service, backport from 0.3.4.1-alpha):
+ - Fix a memory leak when a v3 onion service is configured and gets a
+ SIGHUP signal. Fixes bug 25901; bugfix on 0.3.2.1-alpha.
+ - When parsing the descriptor signature, look for the token plus an
+ extra white-space at the end. This is more correct but also will
+ allow us to support new fields that might start with "signature".
+ Fixes bug 26069; bugfix on 0.3.0.1-alpha.
+
+ o Minor bugfixes (relay, crash, backport from 0.3.4.1-alpha):
+ - Avoid a crash when running with DirPort set but ORPort tuned off.
+ Fixes a case of bug 23693; bugfix on 0.3.1.1-alpha.
+
+ o Documentation (backport from 0.3.4.1-alpha):
+ - Correct an IPv6 error in the documentation for ExitPolicy. Closes
+ ticket 25857. Patch from "CTassisF".
+
+
+Changes in version 0.3.4.1-alpha - 2018-05-17
Tor 0.3.4.1-alpha is the first release in the 0.3.4.x series. It
includes refactoring to begin reducing Tor's binary size and idle CPU
usage on mobile, along with prep work for new bandwidth scanners,
@@ -226,6 +501,12 @@ Changes in version 0.3.4.1-alpha - 2018-05-16
counting bug when STREAM_BW events were enabled. Fixes bug 25400;
bugfix on 0.2.5.2-alpha.
+ o Minor bugfixes (correctness, client):
+ - Upon receiving a malformed connected cell, stop processing the cell
+ immediately. Previously we would mark the connection for close, but
+ continue processing the cell as if the connection were open. Fixes bug
+ 26072; bugfix on 0.2.4.7-alpha.
+
o Minor bugfixes (directory client):
- When unverified-consensus is verified, rename it to cached-
consenus. Fixes bug 4187; bugfix on 0.2.0.3-alpha.
@@ -507,7 +788,7 @@ Changes in version 0.3.3.5-rc - 2018-04-15
- Revert a misformatting issue in the ExitPolicy documentation.
Fixes bug 25582; bugfix on 0.3.3.1-alpha.
- o Minor bugfixes (exit node DNS retries):
+ o Minor bugfixes (exit relay DNS retries):
- Re-attempt timed-out DNS queries 3 times before failure, since our
timeout is 5 seconds for them, but clients wait 10-15. Also allow
slightly more timeouts per resolver when an exit has multiple
@@ -534,7 +815,7 @@ Changes in version 0.3.3.5-rc - 2018-04-15
Changes in version 0.3.3.4-alpha - 2018-03-29
Tor 0.3.3.4-alpha includes various bugfixes for issues found during
the alpha testing of earlier releases in its series. We are
- approaching a stable 0.3.3 release: more testing is welcome!
+ approaching a stable 0.3.3.4-alpha release: more testing is welcome!
o New system requirements:
- When built with Rust, Tor now depends on version 0.2.39 of the
@@ -579,15 +860,17 @@ Changes in version 0.3.3.4-alpha - 2018-03-29
circuit from the controller to become a multihop circuit. Fixes
bug 24903; bugfix on 0.2.5.2-alpha.
- o Minor bugfixes (networking):
- - Tor will no longer reject IPv6 address strings from TorBrowser
+ o Major bugfixes (networking):
+ - Tor will no longer reject IPv6 address strings from Tor Browser
when they are passed as hostnames in SOCKS5 requests. Fixes bug
25036, bugfix on Tor 0.3.1.2.
+
+ o Minor bugfixes (networking):
- string_is_valid_hostname() will not consider IP strings to be
valid hostnames. Fixes bug 25055; bugfix on Tor 0.2.5.5.
o Minor bugfixes (onion service v3):
- - Avoid an assertion failure when the next the next onion service
+ - Avoid an assertion failure when the next onion service
descriptor rotation type is out of sync with the consensus's
valid-after time. Instead, log a warning message with extra
information, so we can better hunt down the cause of this
@@ -627,265 +910,6 @@ Changes in version 0.3.3.4-alpha - 2018-03-29
logging domains. Closes ticket 25378.
-Changes in version 0.3.3.3-alpha - 2018-03-03
- Tor 0.3.3.3-alpha is the third alpha release for the 0.3.3.x series.
- It includes an important security fix for a remote crash attack
- against directory authorities tracked as TROVE-2018-001.
-
- Additionally, with this release, we are upgrading the severity of a
- bug fixed in 0.3.3.2-alpha. Bug 24700, which was fixed in
- 0.3.3.2-alpha, can be remotely triggered in order to crash relays with
- a use-after-free pattern. As such, we are now tracking that bug as
- TROVE-2018-002 and CVE-2018-0491. This bug affected versions
- 0.3.2.1-alpha through 0.3.2.9, as well as 0.3.3.1-alpha.
-
- This release also fixes several minor bugs and annoyances from
- earlier releases.
-
- Relays running 0.3.2.x should upgrade to one of the versions released
- today, for the fix to TROVE-2018-002. Directory authorities should
- also upgrade. (Relays on earlier versions might want to update too for
- the DoS mitigations.)
-
- o Major bugfixes (denial-of-service, directory authority):
- - Fix a protocol-list handling bug that could be used to remotely crash
- directory authorities with a null-pointer exception. Fixes bug 25074;
- bugfix on 0.2.9.4-alpha. Also tracked as TROVE-2018-001 and
- CVE-2018-0490.
-
- o Minor features (compatibility, OpenSSL):
- - Tor will now support TLS1.3 once OpenSSL 1.1.1 is released.
- Previous versions of Tor would not have worked with OpenSSL 1.1.1,
- since they neither disabled TLS 1.3 nor enabled any of the
- ciphersuites it requires. Now we enable the TLS 1.3 ciphersuites.
- Closes ticket 24978.
-
- o Minor features (logging):
- - Clarify the log messages produced when getrandom() or a related
- entropy-generation mechanism gives an error. Closes ticket 25120.
-
- o Minor features (testing):
- - Add a "make test-rust" target to run the rust tests only. Closes
- ticket 25071.
-
- o Minor bugfixes (denial-of-service):
- - Fix a possible crash on malformed consensus. If a consensus had
- contained an unparseable protocol line, it could have made clients
- and relays crash with a null-pointer exception. To exploit this
- issue, however, an attacker would need to be able to subvert the
- directory authority system. Fixes bug 25251; bugfix on
- 0.2.9.4-alpha. Also tracked as TROVE-2018-004.
-
- o Minor bugfixes (DoS mitigation):
- - Add extra safety checks when refilling the circuit creation bucket
- to ensure we never set a value above the allowed maximum burst.
- Fixes bug 25202; bugfix on 0.3.3.2-alpha.
- - When a new consensus arrives, don't update our DoS-mitigation
- parameters if we aren't a public relay. Fixes bug 25223; bugfix
- on 0.3.3.2-alpha.
-
- o Minor bugfixes (man page, SocksPort):
- - Remove dead code from the old "SocksSocket" option, and rename
- SocksSocketsGroupWritable to UnixSocksGroupWritable. The old option
- still works, but is deprecated. Fixes bug 24343; bugfix on 0.2.6.3.
-
- o Minor bugfixes (performance):
- - Reduce the number of circuits that will be opened at once during
- the circuit build timeout phase. This is done by increasing the
- idle timeout to 3 minutes, and lowering the maximum number of
- concurrent learning circuits to 10. Fixes bug 24769; bugfix
- on 0.3.1.1-alpha.
-
- o Minor bugfixes (spec conformance):
- - Forbid "-0" as a protocol version. Fixes part of bug 25249; bugfix on
- 0.2.9.4-alpha.
- - Forbid UINT32_MAX as a protocol version. Fixes part of bug 25249;
- bugfix on 0.2.9.4-alpha.
-
- o Minor bugfixes (spec conformance, rust):
- - Resolve a denial-of-service issue caused by an infinite loop in
- the rust protover code. Fixes bug 25250, bugfix on 0.3.3.1-alpha.
- Also tracked as TROVE-2018-003.
-
- o Code simplification and refactoring:
- - Update the "rust dependencies" submodule to be a project-level
- repository, rather than a user repository. Closes ticket 25323.
-
-
-Changes in version 0.3.2.10 - 2018-03-03
- Tor 0.3.2.10 is the second stable release in the 0.3.2 series. It
- backports a number of bugfixes, including important fixes for security
- issues.
-
- It includes an important security fix for a remote crash attack
- against directory authorities, tracked as TROVE-2018-001.
-
- Additionally, it backports a fix for a bug whose severity we have
- upgraded: Bug 24700, which was fixed in 0.3.3.2-alpha, can be remotely
- triggered in order to crash relays with a use-after-free pattern. As
- such, we are now tracking that bug as TROVE-2018-002 and
- CVE-2018-0491, and backporting it to earlier releases. This bug
- affected versions 0.3.2.1-alpha through 0.3.2.9, as well as version
- 0.3.3.1-alpha.
-
- This release also backports our new system for improved resistance to
- denial-of-service attacks against relays.
-
- This release also fixes several minor bugs and annoyances from
- earlier releases.
-
- Relays running 0.3.2.x SHOULD upgrade to one of the versions released
- today, for the fix to TROVE-2018-002. Directory authorities should
- also upgrade. (Relays on earlier versions might want to update too for
- the DoS mitigations.)
-
- o Major bugfixes (denial-of-service, directory authority, backport from 0.3.3.3-alpha):
- - Fix a protocol-list handling bug that could be used to remotely crash
- directory authorities with a null-pointer exception. Fixes bug 25074;
- bugfix on 0.2.9.4-alpha. Also tracked as TROVE-2018-001 and
- CVE-2018-0490.
-
- o Major bugfixes (scheduler, KIST, denial-of-service, backport from 0.3.3.2-alpha):
- - Avoid adding the same channel twice in the KIST scheduler pending
- list, which could lead to remote denial-of-service use-after-free
- attacks against relays. Fixes bug 24700; bugfix on 0.3.2.1-alpha.
-
- o Major features (denial-of-service mitigation, backport from 0.3.3.2-alpha):
- - Give relays some defenses against the recent network overload. We
- start with three defenses (default parameters in parentheses).
- First: if a single client address makes too many concurrent
- connections (>100), hang up on further connections. Second: if a
- single client address makes circuits too quickly (more than 3 per
- second, with an allowed burst of 90) while also having too many
- connections open (3), refuse new create cells for the next while
- (1-2 hours). Third: if a client asks to establish a rendezvous
- point to you directly, ignore the request. These defenses can be
- manually controlled by new torrc options, but relays will also
- take guidance from consensus parameters, so there's no need to
- configure anything manually. Implements ticket 24902.
-
- o Major bugfixes (onion services, retry behavior, backport from 0.3.3.1-alpha):
- - Fix an "off by 2" error in counting rendezvous failures on the
- onion service side. While we thought we would stop the rendezvous
- attempt after one failed circuit, we were actually making three
- circuit attempts before giving up. Now switch to a default of 2,
- and allow the consensus parameter "hs_service_max_rdv_failures" to
- override. Fixes bug 24895; bugfix on 0.0.6.
- - New-style (v3) onion services now obey the "max rendezvous circuit
- attempts" logic. Previously they would make as many rendezvous
- circuit attempts as they could fit in the MAX_REND_TIMEOUT second
- window before giving up. Fixes bug 24894; bugfix on 0.3.2.1-alpha.
-
- o Major bugfixes (protocol versions, backport from 0.3.3.2-alpha):
- - Add Link protocol version 5 to the supported protocols list. Fixes
- bug 25070; bugfix on 0.3.1.1-alpha.
-
- o Major bugfixes (relay, backport from 0.3.3.1-alpha):
- - Fix a set of false positives where relays would consider
- connections to other relays as being client-only connections (and
- thus e.g. deserving different link padding schemes) if those
- relays fell out of the consensus briefly. Now we look only at the
- initial handshake and whether the connection authenticated as a
- relay. Fixes bug 24898; bugfix on 0.3.1.1-alpha.
-
- o Major bugfixes (scheduler, consensus, backport from 0.3.3.2-alpha):
- - The scheduler subsystem was failing to promptly notice changes in
- consensus parameters, making it harder to switch schedulers
- network-wide. Fixes bug 24975; bugfix on 0.3.2.1-alpha.
-
- o Minor features (denial-of-service avoidance, backport from 0.3.3.2-alpha):
- - Make our OOM handler aware of the geoip client history cache so it
- doesn't fill up the memory. This check is important for IPv6 and
- our DoS mitigation subsystem. Closes ticket 25122.
-
- o Minor features (compatibility, OpenSSL, backport from 0.3.3.3-alpha):
- - Tor will now support TLS1.3 once OpenSSL 1.1.1 is released.
- Previous versions of Tor would not have worked with OpenSSL 1.1.1,
- since they neither disabled TLS 1.3 nor enabled any of the
- ciphersuites it requires. Now we enable the TLS 1.3 ciphersuites.
- Closes ticket 24978.
-
- o Minor features (geoip):
- - Update geoip and geoip6 to the February 7 2018 Maxmind GeoLite2
- Country database.
-
- o Minor features (logging, diagnostic, backport from 0.3.3.2-alpha):
- - When logging a failure to check a hidden service's certificate,
- also log what the problem with the certificate was. Diagnostic
- for ticket 24972.
-
- o Minor bugfix (channel connection, backport from 0.3.3.2-alpha):
- - Use the actual observed address of an incoming relay connection,
- not the canonical address of the relay from its descriptor, when
- making decisions about how to handle the incoming connection.
- Fixes bug 24952; bugfix on 0.2.4.11-alpha. Patch by "ffmancera".
-
- o Minor bugfixes (denial-of-service, backport from 0.3.3.3-alpha):
- - Fix a possible crash on malformed consensus. If a consensus had
- contained an unparseable protocol line, it could have made clients
- and relays crash with a null-pointer exception. To exploit this
- issue, however, an attacker would need to be able to subvert the
- directory authority system. Fixes bug 25251; bugfix on
- 0.2.9.4-alpha. Also tracked as TROVE-2018-004.
-
- o Minor bugfix (directory authority, backport from 0.3.3.2-alpha):
- - Directory authorities, when refusing a descriptor from a rejected
- relay, now explicitly tell the relay (in its logs) to set a valid
- ContactInfo address and contact the bad-relays@ mailing list.
- Fixes bug 25170; bugfix on 0.2.9.1.
-
- o Minor bugfixes (build, rust, backport from 0.3.3.1-alpha):
- - When building with Rust on OSX, link against libresolv, to work
- around the issue at https://github.com/rust-lang/rust/issues/46797.
- Fixes bug 24652; bugfix on 0.3.1.1-alpha.
-
- o Minor bugfixes (onion services, backport from 0.3.3.2-alpha):
- - Remove a BUG() statement when a client fetches an onion descriptor
- that has a lower revision counter than the one in its cache. This
- can happen in normal circumstances due to HSDir desync. Fixes bug
- 24976; bugfix on 0.3.2.1-alpha.
-
- o Minor bugfixes (logging, backport from 0.3.3.2-alpha):
- - Don't treat inability to store a cached consensus object as a bug:
- it can happen normally when we are out of disk space. Fixes bug
- 24859; bugfix on 0.3.1.1-alpha.
-
- o Minor bugfixes (performance, fragile-hardening, backport from 0.3.3.1-alpha):
- - Improve the performance of our consensus-diff application code
- when Tor is built with the --enable-fragile-hardening option set.
- Fixes bug 24826; bugfix on 0.3.1.1-alpha.
-
- o Minor bugfixes (OSX, backport from 0.3.3.1-alpha):
- - Don't exit the Tor process if setrlimit() fails to change the file
- limit (which can happen sometimes on some versions of OSX). Fixes
- bug 21074; bugfix on 0.0.9pre5.
-
- o Minor bugfixes (spec conformance, backport from 0.3.3.3-alpha):
- - Forbid "-0" as a protocol version. Fixes part of bug 25249; bugfix on
- 0.2.9.4-alpha.
- - Forbid UINT32_MAX as a protocol version. Fixes part of bug 25249;
- bugfix on 0.2.9.4-alpha.
-
- o Minor bugfixes (testing, backport from 0.3.3.1-alpha):
- - Fix a memory leak in the scheduler/loop_kist unit test. Fixes bug
- 25005; bugfix on 0.3.2.7-rc.
-
- o Minor bugfixes (v3 onion services, backport from 0.3.3.2-alpha):
- - Look at the "HSRend" protocol version, not the "HSDir" protocol
- version, when deciding whether a consensus entry can support the
- v3 onion service protocol as a rendezvous point. Fixes bug 25105;
- bugfix on 0.3.2.1-alpha.
-
- o Code simplification and refactoring (backport from 0.3.3.3-alpha):
- - Update the "rust dependencies" submodule to be a project-level
- repository, rather than a user repository. Closes ticket 25323.
-
- o Documentation (backport from 0.3.3.1-alpha)
- - Document that operators who run more than one relay or bridge are
- expected to set MyFamily and ContactInfo correctly. Closes
- ticket 24526.
-
-
Changes in version 0.3.1.10 - 2018-03-03
Tor 0.3.1.10 backports a number of bugfixes, including important fixes for
security issues.
@@ -900,11 +924,11 @@ Changes in version 0.3.1.10 - 2018-03-03
earlier releases.
All directory authorities should upgrade to one of the versions
- released today. Relays running 0.3.1.x may wish to update to one of
+ released today. Relays running 0.3.1.x may wish to update to one of
the versions released today, for the DoS mitigations.
Please note: according to our release calendar, Tor 0.3.1 will no
- longer be supported after 1 July 2018. If you will be running Tor
+ longer be supported after 1 July 2018. If you will be running Tor
after that date, you should make sure to plan to upgrade to the latest
stable version, or downgrade to 0.2.9 (which will receive long-term
support).
@@ -1108,7 +1132,7 @@ Changes in version 0.3.1.10 - 2018-03-03
o Minor bugfixes (spec conformance, backport from 0.3.3.3-alpha):
- Forbid "-0" as a protocol version. Fixes part of bug 25249; bugfix on
0.2.9.4-alpha.
- - Forbid UINT32_MAX as a protocol version. Fixes part of bug 25249;
+ - Forbid UINT32_MAX as a protocol version. Fixes part of bug 25249;
bugfix on 0.2.9.4-alpha.
o Code simplification and refactoring (backport from 0.3.3.3-alpha):
@@ -1130,7 +1154,7 @@ Changes in version 0.2.9.15 - 2018-03-03
earlier releases.
All directory authorities should upgrade to one of the versions
- released today. Relays running 0.2.9.x may wish to update to one of
+ released today. Relays running 0.2.9.x may wish to update to one of
the versions released today, for the DoS mitigations.
o Major bugfixes (denial-of-service, directory authority, backport from 0.3.3.3-alpha):
@@ -1289,10 +1313,269 @@ Changes in version 0.2.9.15 - 2018-03-03
o Minor bugfixes (spec conformance, backport from 0.3.3.3-alpha):
- Forbid "-0" as a protocol version. Fixes part of bug 25249; bugfix on
0.2.9.4-alpha.
- - Forbid UINT32_MAX as a protocol version. Fixes part of bug 25249;
+ - Forbid UINT32_MAX as a protocol version. Fixes part of bug 25249;
bugfix on 0.2.9.4-alpha.
+Changes in version 0.3.2.10 - 2018-03-03
+ Tor 0.3.2.10 is the second stable release in the 0.3.2 series. It
+ backports a number of bugfixes, including important fixes for security
+ issues.
+
+ It includes an important security fix for a remote crash attack
+ against directory authorities, tracked as TROVE-2018-001.
+
+ Additionally, it backports a fix for a bug whose severity we have
+ upgraded: Bug 24700, which was fixed in 0.3.3.2-alpha, can be remotely
+ triggered in order to crash relays with a use-after-free pattern. As
+ such, we are now tracking that bug as TROVE-2018-002 and
+ CVE-2018-0491, and backporting it to earlier releases. This bug
+ affected versions 0.3.2.1-alpha through 0.3.2.9, as well as version
+ 0.3.3.1-alpha.
+
+ This release also backports our new system for improved resistance to
+ denial-of-service attacks against relays.
+
+ This release also fixes several minor bugs and annoyances from
+ earlier releases.
+
+ Relays running 0.3.2.x SHOULD upgrade to one of the versions released
+ today, for the fix to TROVE-2018-002. Directory authorities should
+ also upgrade. (Relays on earlier versions might want to update too for
+ the DoS mitigations.)
+
+ o Major bugfixes (denial-of-service, directory authority, backport from 0.3.3.3-alpha):
+ - Fix a protocol-list handling bug that could be used to remotely crash
+ directory authorities with a null-pointer exception. Fixes bug 25074;
+ bugfix on 0.2.9.4-alpha. Also tracked as TROVE-2018-001 and
+ CVE-2018-0490.
+
+ o Major bugfixes (scheduler, KIST, denial-of-service, backport from 0.3.3.2-alpha):
+ - Avoid adding the same channel twice in the KIST scheduler pending
+ list, which could lead to remote denial-of-service use-after-free
+ attacks against relays. Fixes bug 24700; bugfix on 0.3.2.1-alpha.
+
+ o Major features (denial-of-service mitigation, backport from 0.3.3.2-alpha):
+ - Give relays some defenses against the recent network overload. We
+ start with three defenses (default parameters in parentheses).
+ First: if a single client address makes too many concurrent
+ connections (>100), hang up on further connections. Second: if a
+ single client address makes circuits too quickly (more than 3 per
+ second, with an allowed burst of 90) while also having too many
+ connections open (3), refuse new create cells for the next while
+ (1-2 hours). Third: if a client asks to establish a rendezvous
+ point to you directly, ignore the request. These defenses can be
+ manually controlled by new torrc options, but relays will also
+ take guidance from consensus parameters, so there's no need to
+ configure anything manually. Implements ticket 24902.
+
+ o Major bugfixes (onion services, retry behavior, backport from 0.3.3.1-alpha):
+ - Fix an "off by 2" error in counting rendezvous failures on the
+ onion service side. While we thought we would stop the rendezvous
+ attempt after one failed circuit, we were actually making three
+ circuit attempts before giving up. Now switch to a default of 2,
+ and allow the consensus parameter "hs_service_max_rdv_failures" to
+ override. Fixes bug 24895; bugfix on 0.0.6.
+ - New-style (v3) onion services now obey the "max rendezvous circuit
+ attempts" logic. Previously they would make as many rendezvous
+ circuit attempts as they could fit in the MAX_REND_TIMEOUT second
+ window before giving up. Fixes bug 24894; bugfix on 0.3.2.1-alpha.
+
+ o Major bugfixes (protocol versions, backport from 0.3.3.2-alpha):
+ - Add Link protocol version 5 to the supported protocols list. Fixes
+ bug 25070; bugfix on 0.3.1.1-alpha.
+
+ o Major bugfixes (relay, backport from 0.3.3.1-alpha):
+ - Fix a set of false positives where relays would consider
+ connections to other relays as being client-only connections (and
+ thus e.g. deserving different link padding schemes) if those
+ relays fell out of the consensus briefly. Now we look only at the
+ initial handshake and whether the connection authenticated as a
+ relay. Fixes bug 24898; bugfix on 0.3.1.1-alpha.
+
+ o Major bugfixes (scheduler, consensus, backport from 0.3.3.2-alpha):
+ - The scheduler subsystem was failing to promptly notice changes in
+ consensus parameters, making it harder to switch schedulers
+ network-wide. Fixes bug 24975; bugfix on 0.3.2.1-alpha.
+
+ o Minor features (denial-of-service avoidance, backport from 0.3.3.2-alpha):
+ - Make our OOM handler aware of the geoip client history cache so it
+ doesn't fill up the memory. This check is important for IPv6 and
+ our DoS mitigation subsystem. Closes ticket 25122.
+
+ o Minor features (compatibility, OpenSSL, backport from 0.3.3.3-alpha):
+ - Tor will now support TLS1.3 once OpenSSL 1.1.1 is released.
+ Previous versions of Tor would not have worked with OpenSSL 1.1.1,
+ since they neither disabled TLS 1.3 nor enabled any of the
+ ciphersuites it requires. Now we enable the TLS 1.3 ciphersuites.
+ Closes ticket 24978.
+
+ o Minor features (geoip):
+ - Update geoip and geoip6 to the February 7 2018 Maxmind GeoLite2
+ Country database.
+
+ o Minor features (logging, diagnostic, backport from 0.3.3.2-alpha):
+ - When logging a failure to create an onion service's descriptor,
+ also log what the problem with the descriptor was. Diagnostic
+ for ticket 24972.
+
+ o Minor bugfix (channel connection, backport from 0.3.3.2-alpha):
+ - Use the actual observed address of an incoming relay connection,
+ not the canonical address of the relay from its descriptor, when
+ making decisions about how to handle the incoming connection.
+ Fixes bug 24952; bugfix on 0.2.4.11-alpha. Patch by "ffmancera".
+
+ o Minor bugfixes (denial-of-service, backport from 0.3.3.3-alpha):
+ - Fix a possible crash on malformed consensus. If a consensus had
+ contained an unparseable protocol line, it could have made clients
+ and relays crash with a null-pointer exception. To exploit this
+ issue, however, an attacker would need to be able to subvert the
+ directory authority system. Fixes bug 25251; bugfix on
+ 0.2.9.4-alpha. Also tracked as TROVE-2018-004.
+
+ o Minor bugfix (directory authority, backport from 0.3.3.2-alpha):
+ - Directory authorities, when refusing a descriptor from a rejected
+ relay, now explicitly tell the relay (in its logs) to set a valid
+ ContactInfo address and contact the bad-relays@ mailing list.
+ Fixes bug 25170; bugfix on 0.2.9.1.
+
+ o Minor bugfixes (build, rust, backport from 0.3.3.1-alpha):
+ - When building with Rust on OSX, link against libresolv, to work
+ around the issue at https://github.com/rust-lang/rust/issues/46797.
+ Fixes bug 24652; bugfix on 0.3.1.1-alpha.
+
+ o Minor bugfixes (onion services, backport from 0.3.3.2-alpha):
+ - Remove a BUG() statement when a client fetches an onion descriptor
+ that has a lower revision counter than the one in its cache. This
+ can happen in normal circumstances due to HSDir desync. Fixes bug
+ 24976; bugfix on 0.3.2.1-alpha.
+
+ o Minor bugfixes (logging, backport from 0.3.3.2-alpha):
+ - Don't treat inability to store a cached consensus object as a bug:
+ it can happen normally when we are out of disk space. Fixes bug
+ 24859; bugfix on 0.3.1.1-alpha.
+
+ o Minor bugfixes (performance, fragile-hardening, backport from 0.3.3.1-alpha):
+ - Improve the performance of our consensus-diff application code
+ when Tor is built with the --enable-fragile-hardening option set.
+ Fixes bug 24826; bugfix on 0.3.1.1-alpha.
+
+ o Minor bugfixes (OSX, backport from 0.3.3.1-alpha):
+ - Don't exit the Tor process if setrlimit() fails to change the file
+ limit (which can happen sometimes on some versions of OSX). Fixes
+ bug 21074; bugfix on 0.0.9pre5.
+
+ o Minor bugfixes (spec conformance, backport from 0.3.3.3-alpha):
+ - Forbid "-0" as a protocol version. Fixes part of bug 25249; bugfix on
+ 0.2.9.4-alpha.
+ - Forbid UINT32_MAX as a protocol version. Fixes part of bug 25249;
+ bugfix on 0.2.9.4-alpha.
+
+ o Minor bugfixes (testing, backport from 0.3.3.1-alpha):
+ - Fix a memory leak in the scheduler/loop_kist unit test. Fixes bug
+ 25005; bugfix on 0.3.2.7-rc.
+
+ o Minor bugfixes (v3 onion services, backport from 0.3.3.2-alpha):
+ - Look at the "HSRend" protocol version, not the "HSDir" protocol
+ version, when deciding whether a consensus entry can support the
+ v3 onion service protocol as a rendezvous point. Fixes bug 25105;
+ bugfix on 0.3.2.1-alpha.
+
+ o Code simplification and refactoring (backport from 0.3.3.3-alpha):
+ - Update the "rust dependencies" submodule to be a project-level
+ repository, rather than a user repository. Closes ticket 25323.
+
+ o Documentation (backport from 0.3.3.1-alpha)
+ - Document that operators who run more than one relay or bridge are
+ expected to set MyFamily and ContactInfo correctly. Closes
+ ticket 24526.
+
+
+Changes in version 0.3.3.3-alpha - 2018-03-03
+ Tor 0.3.3.3-alpha is the third alpha release for the 0.3.3.x series.
+ It includes an important security fix for a remote crash attack
+ against directory authorities tracked as TROVE-2018-001.
+
+ Additionally, with this release, we are upgrading the severity of a
+ bug fixed in 0.3.3.2-alpha. Bug 24700, which was fixed in
+ 0.3.3.2-alpha, can be remotely triggered in order to crash relays with
+ a use-after-free pattern. As such, we are now tracking that bug as
+ TROVE-2018-002 and CVE-2018-0491. This bug affected versions
+ 0.3.2.1-alpha through 0.3.2.9, as well as 0.3.3.1-alpha.
+
+ This release also fixes several minor bugs and annoyances from
+ earlier releases.
+
+ Relays running 0.3.2.x should upgrade to one of the versions released
+ today, for the fix to TROVE-2018-002. Directory authorities should
+ also upgrade. (Relays on earlier versions might want to update too for
+ the DoS mitigations.)
+
+ o Major bugfixes (denial-of-service, directory authority):
+ - Fix a protocol-list handling bug that could be used to remotely crash
+ directory authorities with a null-pointer exception. Fixes bug 25074;
+ bugfix on 0.2.9.4-alpha. Also tracked as TROVE-2018-001 and
+ CVE-2018-0490.
+
+ o Minor features (compatibility, OpenSSL):
+ - Tor will now support TLS1.3 once OpenSSL 1.1.1 is released.
+ Previous versions of Tor would not have worked with OpenSSL 1.1.1,
+ since they neither disabled TLS 1.3 nor enabled any of the
+ ciphersuites it requires. Now we enable the TLS 1.3 ciphersuites.
+ Closes ticket 24978.
+
+ o Minor features (logging):
+ - Clarify the log messages produced when getrandom() or a related
+ entropy-generation mechanism gives an error. Closes ticket 25120.
+
+ o Minor features (testing):
+ - Add a "make test-rust" target to run the rust tests only. Closes
+ ticket 25071.
+
+ o Minor bugfixes (denial-of-service):
+ - Fix a possible crash on malformed consensus. If a consensus had
+ contained an unparseable protocol line, it could have made clients
+ and relays crash with a null-pointer exception. To exploit this
+ issue, however, an attacker would need to be able to subvert the
+ directory authority system. Fixes bug 25251; bugfix on
+ 0.2.9.4-alpha. Also tracked as TROVE-2018-004.
+
+ o Minor bugfixes (DoS mitigation):
+ - Add extra safety checks when refilling the circuit creation bucket
+ to ensure we never set a value above the allowed maximum burst.
+ Fixes bug 25202; bugfix on 0.3.3.2-alpha.
+ - When a new consensus arrives, don't update our DoS-mitigation
+ parameters if we aren't a public relay. Fixes bug 25223; bugfix
+ on 0.3.3.2-alpha.
+
+ o Minor bugfixes (man page, SocksPort):
+ - Remove dead code from the old "SocksSocket" option, and rename
+ SocksSocketsGroupWritable to UnixSocksGroupWritable. The old option
+ still works, but is deprecated. Fixes bug 24343; bugfix on 0.2.6.3.
+
+ o Minor bugfixes (performance):
+ - Reduce the number of circuits that will be opened at once during
+ the circuit build timeout phase. This is done by increasing the
+ idle timeout to 3 minutes, and lowering the maximum number of
+ concurrent learning circuits to 10. Fixes bug 24769; bugfix
+ on 0.3.1.1-alpha.
+
+ o Minor bugfixes (spec conformance):
+ - Forbid "-0" as a protocol version. Fixes part of bug 25249; bugfix on
+ 0.2.9.4-alpha.
+ - Forbid UINT32_MAX as a protocol version. Fixes part of bug 25249;
+ bugfix on 0.2.9.4-alpha.
+
+ o Minor bugfixes (spec conformance, rust):
+ - Resolve a denial-of-service issue caused by an infinite loop in
+ the rust protover code. Fixes bug 25250, bugfix on 0.3.3.1-alpha.
+ Also tracked as TROVE-2018-003.
+
+ o Code simplification and refactoring:
+ - Update the "rust dependencies" submodule to be a project-level
+ repository, rather than a user repository. Closes ticket 25323.
+
+
Changes in version 0.3.3.2-alpha - 2018-02-10
Tor 0.3.3.2-alpha is the second alpha in the 0.3.3.x series. It
introduces a mechanism to handle the high loads that many relay
@@ -1466,12 +1749,12 @@ Changes in version 0.3.3.1-alpha - 2018-01-25
o Major features (IPv6, directory documents):
- Add consensus method 27, which adds IPv6 ORPorts to the microdesc
consensus. This information makes it easier for IPv6 clients to
- bootstrap and choose reachable entry guards. Implements 23826.
+ bootstrap and choose reachable entry guards. Implements ticket 23826.
- Add consensus method 28, which removes IPv6 ORPorts from
- microdescriptors. Now that the consensus contains IPv6 ORPorts,
- they are redundant in microdescs. This change will be used by Tor
- clients on 0.2.8.x and later. (That is to say, with all Tor
- clients having IPv6 bootstrap and guard support.) Implements 23828.
+ microdescriptors. Now that the consensus contains IPv6 ORPorts, they
+ are redundant in microdescs. This change will be used by Tor clients
+ on 0.2.8.x and later. (That is to say, with all Tor clients that
+ have IPv6 bootstrap and guard support.) Implements ticket 23828.
- Expand the documentation for AuthDirHasIPv6Connectivity when it is
set by different numbers of authorities. Fixes 23870
on 0.2.4.1-alpha.
@@ -1501,7 +1784,7 @@ Changes in version 0.3.3.1-alpha - 2018-01-25
experience with Rust, and plan future Rust integration work.
Implementation by Chelsea Komlo. Closes ticket 22840.
- o Major features (storage, configuration):
+ o Minor features (storage, configuration):
- Users can store cached directory documents somewhere other than
the DataDirectory by using the CacheDirectory option. Similarly,
the storage location for relay's keys can be overridden with the
@@ -1538,10 +1821,10 @@ Changes in version 0.3.3.1-alpha - 2018-01-25
o Minor feature (IPv6):
- Make IPv6-only clients wait for microdescs for relays, even if we
were previously using descriptors (or were using them as a bridge)
- and have a cached descriptor for them. Implements 23827.
+ and have a cached descriptor for them. Implements ticket 23827.
- When a consensus has IPv6 ORPorts, make IPv6-only clients use
them, rather than waiting to download microdescriptors.
- Implements 23827.
+ Implements ticket 23827.
o Minor features (cleanup):
- Tor now deletes the CookieAuthFile and ExtORPortCookieAuthFile
@@ -1555,14 +1838,8 @@ Changes in version 0.3.3.1-alpha - 2018-01-25
- Where possible, the tor_free() macro now only evaluates its input
once. Part of ticket 24337.
- Check that microdesc ed25519 ids are non-zero in
- node_get_ed25519_id() before returning them. Implements 24001,
- patch by "aruna1234".
-
- o Minor features (directory authority):
- - Make the "Exit" flag assignment only depend on whether the exit
- policy allows connections to ports 80 and 443. Previously relays
- would get the Exit flag if they allowed connections to one of
- these ports and also port 6667. Resolves ticket 23637.
+ node_get_ed25519_id() before returning them. Implements ticket
+ 24001, patch by "aruna1234".
o Minor features (embedding):
- Tor can now start with a preauthenticated control connection
@@ -1574,7 +1851,7 @@ Changes in version 0.3.3.1-alpha - 2018-01-25
- On most errors that would cause Tor to exit, it now tries to
return from the tor_main() function, rather than calling the
system exit() function. Most users won't notice a difference here,
- but it should make a significant for programs that run Tor inside
+ but it should be significant for programs that run Tor inside
a separate thread: they should now be able to survive Tor's exit
conditions rather than having Tor shut down the entire process.
Closes ticket 23848.
@@ -1674,7 +1951,7 @@ Changes in version 0.3.3.1-alpha - 2018-01-25
SIO_IDEAL_SEND_BACKLOG_QUERY. Closes ticket 22798. Patch
from Vort.
- o Minor features (relay):
+ o Major features (relay):
- Implement an option, ReducedExitPolicy, to allow an Tor exit relay
operator to use a more reasonable ("reduced") exit policy, rather
than the default one. If you want to run an exit node without
@@ -1834,7 +2111,7 @@ Changes in version 0.3.3.1-alpha - 2018-01-25
adding very little except for unit test.
o Code simplification and refactoring (circuit rendezvous):
- - Split the client-size rendezvous circuit lookup into two
+ - Split the client-side rendezvous circuit lookup into two
functions: one that returns only established circuits and another
that returns all kinds of circuits. Closes ticket 23459.
@@ -3035,7 +3312,7 @@ Changes in version 0.3.2.2-alpha - 2017-09-29
include better testing and logging.
The following comprises the complete list of changes included
- in tor-0.3.2.2-alpha:
+ in 0.3.2.2-alpha:
o Major bugfixes (relay, crash, assertion failure):
- Fix a timing-based assertion failure that could occur when the
@@ -5643,7 +5920,7 @@ Changes in version 0.3.0.4-rc - 2017-03-01
o Major bugfixes (hidden service directory v3):
- Stop crashing on a failed v3 hidden service descriptor lookup
- failure. Fixes bug 21471; bugfixes on tor-0.3.0.1-alpha.
+ failure. Fixes bug 21471; bugfixes on 0.3.0.1-alpha.
o Major bugfixes (parsing):
- When parsing a malformed content-length field from an HTTP
@@ -5728,7 +6005,7 @@ Changes in version 0.3.0.4-rc - 2017-03-01
o Minor bugfixes (testing):
- Fix Raspbian build issues related to missing socket errno in
- test_util.c. Fixes bug 21116; bugfix on tor-0.2.8.2. Patch
+ test_util.c. Fixes bug 21116; bugfix on 0.2.8.2. Patch
by "hein".
- Rename "make fuzz" to "make test-fuzz-corpora", since it doesn't
actually fuzz anything. Fixes bug 21447; bugfix on 0.3.0.3-alpha.
@@ -6362,7 +6639,7 @@ Changes in version 0.3.0.1-alpha - 2016-12-19
- When finishing writing a file to disk, if we were about to replace
the file with the temporary file created before and we fail to
replace it, remove the temporary file so it doesn't stay on disk.
- Fixes bug 20646; bugfix on tor-0.2.0.7-alpha. Patch by fk.
+ Fixes bug 20646; bugfix on 0.2.0.7-alpha. Patch by fk.
o Minor bugfixes (Windows):
- Check for getpagesize before using it to mmap files. This fixes
@@ -6398,13 +6675,13 @@ Changes in version 0.3.0.1-alpha - 2016-12-19
o Documentation:
- Include the "TBits" unit in Tor's man page. Fixes part of bug
- 20622; bugfix on tor-0.2.5.1-alpha.
+ 20622; bugfix on 0.2.5.1-alpha.
- Change '1' to 'weight_scale' in consensus bw weights calculation
comments, as that is reality. Closes ticket 20273. Patch
from pastly.
- Correct the value for AuthDirGuardBWGuarantee in the manpage, from
250 KBytes to 2 MBytes. Fixes bug 20435; bugfix
- on tor-0.2.5.6-alpha.
+ on 0.2.5.6-alpha.
- Stop the man page from incorrectly stating that HiddenServiceDir
must already exist. Fixes 20486.
- Clarify that when ClientRejectInternalAddresses is enabled (which
@@ -28268,4 +28545,3 @@ Changes in version 0.0.2pre13 - 2003-10-19
- If --DebugLogFile is specified, log to it at -l debug
- If --LogFile is specified, use it instead of commandline
- If --RunAsDaemon is set, tor forks and backgrounds on startup
-
diff --git a/LICENSE b/LICENSE
index 3d0f8c121b..057ae57652 100644
--- a/LICENSE
+++ b/LICENSE
@@ -13,7 +13,7 @@ Tor is distributed under this license:
Copyright (c) 2001-2004, Roger Dingledine
Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson
-Copyright (c) 2007-2017, The Tor Project, Inc.
+Copyright (c) 2007-2018, The Tor Project, Inc.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
diff --git a/Makefile.am b/Makefile.am
index 58ff9fb3e8..8fcf67924a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
# Copyright (c) 2001-2004, Roger Dingledine
# Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson
-# Copyright (c) 2007-2017, The Tor Project, Inc.
+# Copyright (c) 2007-2018, The Tor Project, Inc.
# See LICENSE for licensing information
ACLOCAL_AMFLAGS = -I m4
@@ -15,7 +15,12 @@ TESTS=
noinst_PROGRAMS=
DISTCLEANFILES=
bin_SCRIPTS=
-AM_CPPFLAGS=
+AM_CPPFLAGS=\
+ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/src/ext \
+ -I$(top_srcdir)/src/ext/trunnel \
+ -I$(top_srcdir)/src/trunnel
+
AM_CFLAGS=@TOR_SYSTEMD_CFLAGS@ @CFLAGS_BUGTRAP@ @TOR_LZMA_CFLAGS@ @TOR_ZSTD_CFLAGS@
SHELL=@SHELL@
@@ -26,12 +31,80 @@ TESTING_TOR_BINARY=$(top_builddir)/src/or/tor$(EXEEXT)
endif
if USE_RUST
-rust_ldadd=$(top_builddir)/src/rust/target/release/@TOR_RUST_STATIC_NAME@ \
- @TOR_RUST_EXTRA_LIBS@
+## this MUST be $(), otherwise am__DEPENDENCIES will not track it
+rust_ldadd=$(top_builddir)/$(TOR_RUST_LIB_PATH) \
+ $(TOR_RUST_EXTRA_LIBS)
else
rust_ldadd=
endif
+# "Common" libraries used to link tor's utility code.
+TOR_UTIL_LIBS = \
+ src/common/libor.a \
+ src/lib/libtor-log.a \
+ src/lib/libtor-lock.a \
+ src/lib/libtor-fdio.a \
+ src/lib/libtor-container.a \
+ src/lib/libtor-string.a \
+ src/lib/libtor-malloc.a \
+ src/lib/libtor-wallclock.a \
+ src/lib/libtor-err.a \
+ src/lib/libtor-intmath.a \
+ src/lib/libtor-ctime.a
+
+# Variants of the above for linking the testing variant of tor (for coverage
+# and tests)
+TOR_UTIL_TESTING_LIBS = \
+ src/common/libor-testing.a \
+ src/lib/libtor-log-testing.a \
+ src/lib/libtor-lock-testing.a \
+ src/lib/libtor-fdio-testing.a \
+ src/lib/libtor-container-testing.a \
+ src/lib/libtor-string-testing.a \
+ src/lib/libtor-malloc-testing.a \
+ src/lib/libtor-wallclock-testing.a \
+ src/lib/libtor-err-testing.a \
+ src/lib/libtor-intmath.a \
+ src/lib/libtor-ctime-testing.a
+
+# Internal crypto libraries used in Tor
+TOR_CRYPTO_LIBS = \
+ src/lib/libtor-tls.a \
+ src/lib/libtor-crypt-ops.a \
+ $(LIBKECCAK_TINY) \
+ $(LIBDONNA)
+
+# Variants of the above for linking the testing variant of tor (for coverage
+# and tests)
+TOR_CRYPTO_TESTING_LIBS = \
+ src/lib/libtor-tls-testing.a \
+ src/lib/libtor-crypt-ops-testing.a \
+ $(LIBKECCAK_TINY) \
+ $(LIBDONNA)
+
+# All static libraries used to link tor.
+TOR_INTERNAL_LIBS = \
+ src/or/libtor-app.a \
+ src/lib/libtor-compress.a \
+ $(TOR_CRYPTO_LIBS) \
+ $(TOR_UTIL_LIBS) \
+ src/common/libor-event.a \
+ src/trunnel/libor-trunnel.a \
+ src/lib/libtor-trace.a
+
+# Variants of the above for linking the testing variant of tor (for coverage
+# and tests)
+TOR_INTERNAL_TESTING_LIBS = \
+ src/or/libtor-app-testing.a \
+ src/lib/libtor-compress-testing.a \
+ $(TOR_CRYPTO_TESTING_LIBS) \
+ $(TOR_UTIL_TESTING_LIBS) \
+ src/common/libor-event-testing.a \
+ src/trunnel/libor-trunnel-testing.a \
+ src/lib/libtor-trace.a
+
+# All libraries used to link tor-cov
+
include src/include.am
include doc/include.am
include contrib/include.am
@@ -44,6 +117,7 @@ EXTRA_DIST+= \
Makefile.nmake \
README \
ReleaseNotes \
+ scripts/maint/checkIncludes.py \
scripts/maint/checkSpace.pl
## This tells etags how to find mockable function definitions.
@@ -205,12 +279,19 @@ check-spaces:
if USE_PERL
$(PERL) $(top_srcdir)/scripts/maint/checkSpace.pl -C \
$(top_srcdir)/src/common/*.[ch] \
+ $(top_srcdir)/src/lib/*/*.[ch] \
$(top_srcdir)/src/or/*.[ch] \
+ $(top_srcdir)/src/or/*/*.[ch] \
$(top_srcdir)/src/test/*.[ch] \
$(top_srcdir)/src/test/*/*.[ch] \
$(top_srcdir)/src/tools/*.[ch]
endif
+check-includes:
+if USEPYTHON
+ $(top_srcdir)/scripts/maint/checkIncludes.py
+endif
+
check-docs: all
$(PERL) $(top_builddir)/scripts/maint/checkOptionDocs.pl
@@ -238,6 +319,20 @@ check-typos:
echo "You can install the latest version of misspell here: https://github.com/client9/misspell#install"; \
fi
+.PHONY: clippy
+clippy:
+if USE_RUST
+ @if test -x "`which cargo-clippy 2>&1;true`"; then \
+ echo "Running cargo clippy ..."; \
+ echo "Prepare yourself for the onslaught of suggestions ..."; \
+ (cd "$(top_srcdir)/src/rust" && cargo clippy); \
+ else \
+ echo "Tor can use clippy to lint Rust code."; \
+ echo "However, it seems that you don't have clippy installed."; \
+ echo "You can install the latest version of clippy by following the directions here: https://github.com/rust-lang-nursery/rust-clippy"; \
+ fi
+endif
+
.PHONY: check-changes
check-changes:
if USEPYTHON
diff --git a/ReleaseNotes b/ReleaseNotes
index 93ff6d6ff6..8a38289c2c 100644
--- a/ReleaseNotes
+++ b/ReleaseNotes
@@ -1,179 +1,681 @@
-This document summarizes new features and bugfixes in each stable release
-of Tor. If you want to see more detailed descriptions of the changes in
-each development snapshot, see the ChangeLog file.
+This document summarizes new features and bugfixes in each stable
+release of Tor. If you want to see more detailed descriptions of the
+changes in each development snapshot, see the ChangeLog file.
-Changes in version 0.3.2.10 - 2018-03-03
- Tor 0.3.2.10 is the second stable release in the 0.3.2 series. It
- backports a number of bugfixes, including important fixes for security
- issues.
+Changes in version 0.3.3.7 - 2018-06-12
+ Tor 0.3.3.7 backports several changes from the 0.3.4.x series, including
+ fixes for bugs affecting compatibility and stability.
- It includes an important security fix for a remote crash attack
- against directory authorities, tracked as TROVE-2018-001.
+ o Directory authority changes:
+ - Add an IPv6 address for the "dannenberg" directory authority.
+ Closes ticket 26343.
- Additionally, it backports a fix for a bug whose severity we have
- upgraded: Bug 24700, which was fixed in 0.3.3.2-alpha, can be remotely
- triggered in order to crash relays with a use-after-free pattern. As
- such, we are now tracking that bug as TROVE-2018-002 and
- CVE-2018-0491, and backporting it to earlier releases. This bug
- affected versions 0.3.2.1-alpha through 0.3.2.9, as well as version
- 0.3.3.1-alpha.
+ o Minor features (geoip):
+ - Update geoip and geoip6 to the June 7 2018 Maxmind GeoLite2
+ Country database. Closes ticket 26351.
+
+ o Minor bugfixes (compatibility, openssl, backport from 0.3.4.2-alpha):
+ - Work around a change in OpenSSL 1.1.1 where return values that
+ would previously indicate "no password" now indicate an empty
+ password. Without this workaround, Tor instances running with
+ OpenSSL 1.1.1 would accept descriptors that other Tor instances
+ would reject. Fixes bug 26116; bugfix on 0.2.5.16.
+
+ o Minor bugfixes (compilation, backport from 0.3.4.2-alpha):
+ - Silence unused-const-variable warnings in zstd.h with some GCC
+ versions. Fixes bug 26272; bugfix on 0.3.1.1-alpha.
+
+ o Minor bugfixes (controller, backport from 0.3.4.2-alpha):
+ - Improve accuracy of the BUILDTIMEOUT_SET control port event's
+ TIMEOUT_RATE and CLOSE_RATE fields. (We were previously
+ miscounting the total number of circuits for these field values.)
+ Fixes bug 26121; bugfix on 0.3.3.1-alpha.
+
+ o Minor bugfixes (hardening, backport from 0.3.4.2-alpha):
+ - Prevent a possible out-of-bounds smartlist read in
+ protover_compute_vote(). Fixes bug 26196; bugfix on 0.2.9.4-alpha.
+
+ o Minor bugfixes (path selection, backport from 0.3.4.1-alpha):
+ - Only select relays when they have the descriptors we prefer to use
+ for them. This change fixes a bug where we could select a relay
+ because it had _some_ descriptor, but reject it later with a
+ nonfatal assertion error because it didn't have the exact one we
+ wanted. Fixes bugs 25691 and 25692; bugfix on 0.3.3.4-alpha.
+
+
+Changes in version 0.3.3.6 - 2018-05-22
+ Tor 0.3.3.6 is the first stable release in the 0.3.3 series. It
+ backports several important fixes from the 0.3.4.1-alpha.
+
+ The Tor 0.3.3 series includes controller support and other
+ improvements for v3 onion services, official support for embedding Tor
+ within other applications, and our first non-trivial module written in
+ the Rust programming language. (Rust is still not enabled by default
+ when building Tor.) And as usual, there are numerous other smaller
+ bugfixes, features, and improvements.
+
+ Below are the changes since 0.3.2.10. For a list of only the changes
+ since 0.3.3.5-rc, see the ChangeLog file.
- This release also backports our new system for improved resistance to
- denial-of-service attacks against relays.
+ o New system requirements:
+ - When built with Rust, Tor now depends on version 0.2.39 of the
+ libc crate. Closes tickets 25310 and 25664.
+
+ o Major features (embedding):
+ - There is now a documented stable API for programs that need to
+ embed Tor. See tor_api.h for full documentation and known bugs.
+ Closes ticket 23684.
+ - Tor now has support for restarting in the same process.
+ Controllers that run Tor using the "tor_api.h" interface can now
+ restart Tor after Tor has exited. This support is incomplete,
+ however: we fixed crash bugs that prevented it from working at
+ all, but many bugs probably remain, including a possibility of
+ security issues. Implements ticket 24581.
+
+ o Major features (IPv6, directory documents):
+ - Add consensus method 27, which adds IPv6 ORPorts to the microdesc
+ consensus. This information makes it easier for IPv6 clients to
+ bootstrap and choose reachable entry guards. Implements
+ ticket 23826.
+ - Add consensus method 28, which removes IPv6 ORPorts from
+ microdescriptors. Now that the consensus contains IPv6 ORPorts,
+ they are redundant in microdescs. This change will be used by Tor
+ clients on 0.2.8.x and later. (That is to say, with all Tor
+ clients that have IPv6 bootstrap and guard support.) Implements
+ ticket 23828.
+ - Expand the documentation for AuthDirHasIPv6Connectivity when it is
+ set by different numbers of authorities. Fixes 23870
+ on 0.2.4.1-alpha.
+
+ o Major features (onion service v3, control port):
+ - The control port now supports commands and events for v3 onion
+ services. It is now possible to create ephemeral v3 services using
+ ADD_ONION. Additionally, several events (HS_DESC, HS_DESC_CONTENT,
+ CIRC and CIRC_MINOR) and commands (GETINFO, HSPOST, ADD_ONION and
+ DEL_ONION) have been extended to support v3 onion services. Closes
+ ticket 20699; implements proposal 284.
+
+ o Major features (onion services):
+ - Provide torrc options to pin the second and third hops of onion
+ service circuits to a list of nodes. The option HSLayer2Guards
+ pins the second hop, and the option HSLayer3Guards pins the third
+ hop. These options are for use in conjunction with experiments
+ with "vanguards" for preventing guard enumeration attacks. Closes
+ ticket 13837.
+ - When v3 onion service clients send introduce cells, they now
+ include the IPv6 address of the rendezvous point, if it has one.
+ Current v3 onion services running 0.3.2 ignore IPv6 addresses, but
+ in future Tor versions, IPv6-only v3 single onion services will be
+ able to use IPv6 addresses to connect directly to the rendezvous
+ point. Closes ticket 23577. Patch by Neel Chauhan.
- This release also fixes several minor bugs and annoyances from
- earlier releases.
+ o Major features (relay):
+ - Implement an option, ReducedExitPolicy, to allow an Tor exit relay
+ operator to use a more reasonable ("reduced") exit policy, rather
+ than the default one. If you want to run an exit node without
+ thinking too hard about which ports to allow, this one is for you.
+ Closes ticket 13605. Patch from Neel Chauhan.
+
+ o Major features (rust, portability, experimental):
+ - Tor now ships with an optional implementation of one of its
+ smaller modules (protover.c) in the Rust programming language. To
+ try it out, install a Rust build environment, and configure Tor
+ with "--enable-rust --enable-cargo-online-mode". This should not
+ cause any user-visible changes, but should help us gain more
+ experience with Rust, and plan future Rust integration work.
+ Implementation by Chelsea Komlo. Closes ticket 22840.
+
+ o Major bugfixes (directory authorities, security, backport from 0.3.4.1-alpha):
+ - When directory authorities read a zero-byte bandwidth file, they
+ would previously log a warning with the contents of an
+ uninitialised buffer. They now log a warning about the empty file
+ instead. Fixes bug 26007; bugfix on 0.2.2.1-alpha.
+
+ o Major bugfixes (security, directory authority, denial-of-service):
+ - Fix a bug that could have allowed an attacker to force a directory
+ authority to use up all its RAM by passing it a maliciously
+ crafted protocol versions string. Fixes bug 25517; bugfix on
+ 0.2.9.4-alpha. This issue is also tracked as TROVE-2018-005.
+
+ o Major bugfixes (crash, backport from 0.3.4.1-alpha):
+ - Avoid a rare assertion failure in the circuit build timeout code
+ if we fail to allow any circuits to actually complete. Fixes bug
+ 25733; bugfix on 0.2.2.2-alpha.
+
+ o Major bugfixes (netflow padding):
+ - Stop adding unneeded channel padding right after we finish
+ flushing to a connection that has been trying to flush for many
+ seconds. Instead, treat all partial or complete flushes as
+ activity on the channel, which will defer the time until we need
+ to add padding. This fix should resolve confusing and scary log
+ messages like "Channel padding timeout scheduled 221453ms in the
+ past." Fixes bug 22212; bugfix on 0.3.1.1-alpha.
+
+ o Major bugfixes (networking):
+ - Tor will no longer reject IPv6 address strings from Tor Browser
+ when they are passed as hostnames in SOCKS5 requests. Fixes bug
+ 25036, bugfix on Tor 0.3.1.2.
+
+ o Major bugfixes (onion service, backport from 0.3.4.1-alpha):
+ - Correctly detect when onion services get disabled after HUP. Fixes
+ bug 25761; bugfix on 0.3.2.1.
+
+ o Major bugfixes (performance, load balancing):
+ - Directory authorities no longer vote in favor of the Guard flag
+ for relays without directory support. Starting in Tor
+ 0.3.0.1-alpha, clients have been avoiding using such relays in the
+ Guard position, leading to increasingly broken load balancing for
+ the 5%-or-so of Guards that don't advertise directory support.
+ Fixes bug 22310; bugfix on 0.3.0.6.
- Relays running 0.3.2.x SHOULD upgrade to one of the versions released
- today, for the fix to TROVE-2018-002. Directory authorities should
- also upgrade. (Relays on earlier versions might want to update too for
- the DoS mitigations.)
+ o Major bugfixes (relay):
+ - If we have failed to connect to a relay and received a connection
+ refused, timeout, or similar error (at the TCP level), do not try
+ that same address/port again for 60 seconds after the failure has
+ occurred. Fixes bug 24767; bugfix on 0.0.6.
- o Major bugfixes (denial-of-service, directory authority, backport from 0.3.3.3-alpha):
- - Fix a protocol-list handling bug that could be used to remotely crash
- directory authorities with a null-pointer exception. Fixes bug 25074;
- bugfix on 0.2.9.4-alpha. Also tracked as TROVE-2018-001 and
- CVE-2018-0490.
+ o Major bugfixes (relay, denial of service, backport from 0.3.4.1-alpha):
+ - Impose a limit on circuit cell queue size. The limit can be
+ controlled by a consensus parameter. Fixes bug 25226; bugfix
+ on 0.2.4.14-alpha.
- o Major bugfixes (scheduler, KIST, denial-of-service, backport from 0.3.3.2-alpha):
- - Avoid adding the same channel twice in the KIST scheduler pending
- list, which could lead to remote denial-of-service use-after-free
- attacks against relays. Fixes bug 24700; bugfix on 0.3.2.1-alpha.
+ o Minor features (cleanup):
+ - Tor now deletes the CookieAuthFile and ExtORPortCookieAuthFile
+ when it stops. Closes ticket 23271.
- o Major features (denial-of-service mitigation, backport from 0.3.3.2-alpha):
- - Give relays some defenses against the recent network overload. We
- start with three defenses (default parameters in parentheses).
- First: if a single client address makes too many concurrent
- connections (>100), hang up on further connections. Second: if a
- single client address makes circuits too quickly (more than 3 per
- second, with an allowed burst of 90) while also having too many
- connections open (3), refuse new create cells for the next while
- (1-2 hours). Third: if a client asks to establish a rendezvous
- point to you directly, ignore the request. These defenses can be
- manually controlled by new torrc options, but relays will also
- take guidance from consensus parameters, so there's no need to
- configure anything manually. Implements ticket 24902.
+ o Minor features (compatibility, backport from 0.3.4.1-alpha):
+ - Avoid some compilation warnings with recent versions of LibreSSL.
+ Closes ticket 26006.
- o Major bugfixes (onion services, retry behavior, backport from 0.3.3.1-alpha):
- - Fix an "off by 2" error in counting rendezvous failures on the
- onion service side. While we thought we would stop the rendezvous
- attempt after one failed circuit, we were actually making three
- circuit attempts before giving up. Now switch to a default of 2,
- and allow the consensus parameter "hs_service_max_rdv_failures" to
- override. Fixes bug 24895; bugfix on 0.0.6.
- - New-style (v3) onion services now obey the "max rendezvous circuit
- attempts" logic. Previously they would make as many rendezvous
- circuit attempts as they could fit in the MAX_REND_TIMEOUT second
- window before giving up. Fixes bug 24894; bugfix on 0.3.2.1-alpha.
+ o Minor features (config options):
+ - Change the way the default value for MaxMemInQueues is calculated.
+ We now use 40% of the hardware RAM if the system has 8 GB RAM or
+ more. Otherwise we use the former value of 75%. Closes
+ ticket 24782.
+
+ o Minor features (continuous integration):
+ - Update the Travis CI configuration to use the stable Rust channel,
+ now that we have decided to require that. Closes ticket 25714.
+
+ o Minor features (continuous integration, backport from 0.3.4.1-alpha):
+ - Our .travis.yml configuration now includes support for testing the
+ results of "make distcheck". (It's not uncommon for "make check"
+ to pass but "make distcheck" to fail.) Closes ticket 25814.
+ - Our Travis CI configuration now integrates with the Coveralls
+ coverage analysis tool. Closes ticket 25818.
- o Major bugfixes (protocol versions, backport from 0.3.3.2-alpha):
- - Add Link protocol version 5 to the supported protocols list. Fixes
- bug 25070; bugfix on 0.3.1.1-alpha.
+ o Minor features (defensive programming):
+ - Most of the functions in Tor that free objects have been replaced
+ with macros that free the objects and set the corresponding
+ pointers to NULL. This change should help prevent a large class of
+ dangling pointer bugs. Closes ticket 24337.
+ - Where possible, the tor_free() macro now only evaluates its input
+ once. Part of ticket 24337.
+ - Check that microdesc ed25519 ids are non-zero in
+ node_get_ed25519_id() before returning them. Implements ticket
+ 24001, patch by "aruna1234".
- o Major bugfixes (relay, backport from 0.3.3.1-alpha):
- - Fix a set of false positives where relays would consider
- connections to other relays as being client-only connections (and
- thus e.g. deserving different link padding schemes) if those
- relays fell out of the consensus briefly. Now we look only at the
- initial handshake and whether the connection authenticated as a
- relay. Fixes bug 24898; bugfix on 0.3.1.1-alpha.
+ o Minor features (directory authority):
+ - When directory authorities are unable to add signatures to a
+ pending consensus, log the reason why. Closes ticket 24849.
+
+ o Minor features (embedding):
+ - Tor can now start with a preauthenticated control connection
+ created by the process that launched it. This feature is meant for
+ use by programs that want to launch and manage a Tor process
+ without allowing other programs to manage it as well. For more
+ information, see the __OwningControllerFD option documented in
+ control-spec.txt. Closes ticket 23900.
+ - On most errors that would cause Tor to exit, it now tries to
+ return from the tor_main() function, rather than calling the
+ system exit() function. Most users won't notice a difference here,
+ but it should be significant for programs that run Tor inside a
+ separate thread: they should now be able to survive Tor's exit
+ conditions rather than having Tor shut down the entire process.
+ Closes ticket 23848.
+ - Applications that want to embed Tor can now tell Tor not to
+ register any of its own POSIX signal handlers, using the
+ __DisableSignalHandlers option. Closes ticket 24588.
- o Major bugfixes (scheduler, consensus, backport from 0.3.3.2-alpha):
- - The scheduler subsystem was failing to promptly notice changes in
- consensus parameters, making it harder to switch schedulers
- network-wide. Fixes bug 24975; bugfix on 0.3.2.1-alpha.
+ o Minor features (fallback directory list):
+ - Avoid selecting fallbacks that change their IP addresses too
+ often. Select more fallbacks by ignoring the Guard flag, and
+ allowing lower cutoffs for the Running and V2Dir flags. Also allow
+ a lower bandwidth, and a higher number of fallbacks per operator
+ (5% of the list). Implements ticket 24785.
+ - Update the fallback whitelist and blacklist based on opt-ins and
+ relay changes. Closes tickets 22321, 24678, 22527, 24135,
+ and 24695.
+
+ o Minor features (fallback directory mirror configuration):
+ - Add a nickname to each fallback in a C comment. This makes it
+ easier for operators to find their relays, and allows stem to use
+ nicknames to identify fallbacks. Implements ticket 24600.
+ - Add a type and version header to the fallback directory mirror
+ file. Also add a delimiter to the end of each fallback entry. This
+ helps external parsers like stem and Relay Search. Implements
+ ticket 24725.
+ - Add an extrainfo cache flag for each fallback in a C comment. This
+ allows stem to use fallbacks to fetch extra-info documents, rather
+ than using authorities. Implements ticket 22759.
+ - Add the generateFallbackDirLine.py script for automatically
+ generating fallback directory mirror lines from relay fingerprints.
+ No more typos! Add the lookupFallbackDirContact.py script for
+ automatically looking up operator contact info from relay
+ fingerprints. Implements ticket 24706, patch by teor and atagar.
+ - Reject any fallback directory mirror that serves an expired
+ consensus. Implements ticket 20942, patch by "minik".
+ - Remove commas and equals signs from external string inputs to the
+ fallback list. This avoids format confusion attacks. Implements
+ ticket 24726.
+ - Remove the "weight=10" line from fallback directory mirror
+ entries. Ticket 24681 will maintain the current fallback weights
+ by changing Tor's default fallback weight to 10. Implements
+ ticket 24679.
+ - Stop logging excessive information about fallback netblocks.
+ Implements ticket 24791.
+
+ o Minor features (forward-compatibility):
+ - If a relay supports some link authentication protocol that we do
+ not recognize, then include that relay's ed25519 key when telling
+ other relays to extend to it. Previously, we treated future
+ versions as if they were too old to support ed25519 link
+ authentication. Closes ticket 20895.
- o Minor features (denial-of-service avoidance, backport from 0.3.3.2-alpha):
- - Make our OOM handler aware of the geoip client history cache so it
- doesn't fill up the memory. This check is important for IPv6 and
- our DoS mitigation subsystem. Closes ticket 25122.
+ o Minor features (geoip):
+ - Update geoip and geoip6 to the May 1 2018 Maxmind GeoLite2 Country
+ database. Closes ticket 26104.
- o Minor features (compatibility, OpenSSL, backport from 0.3.3.3-alpha):
- - Tor will now support TLS1.3 once OpenSSL 1.1.1 is released.
- Previous versions of Tor would not have worked with OpenSSL 1.1.1,
- since they neither disabled TLS 1.3 nor enabled any of the
- ciphersuites it requires. Now we enable the TLS 1.3 ciphersuites.
- Closes ticket 24978.
+ o Minor features (heartbeat):
+ - Add onion service information to our heartbeat logs, displaying
+ stats about the activity of configured onion services. Closes
+ ticket 24896.
- o Minor features (geoip):
- - Update geoip and geoip6 to the February 7 2018 Maxmind GeoLite2
- Country database.
+ o Minor features (instrumentation, development):
+ - Add the MainloopStats option to allow developers to get
+ instrumentation information from the main event loop via the
+ heartbeat messages. We hope to use this to improve Tor's behavior
+ when it's trying to sleep. Closes ticket 24605.
- o Minor features (logging, diagnostic, backport from 0.3.3.2-alpha):
- - When logging a failure to check a hidden service's certificate,
- also log what the problem with the certificate was. Diagnostic
- for ticket 24972.
+ o Minor features (IPv6):
+ - Make IPv6-only clients wait for microdescs for relays, even if we
+ were previously using descriptors (or were using them as a bridge)
+ and have a cached descriptor for them. Implements ticket 23827.
+ - When a consensus has IPv6 ORPorts, make IPv6-only clients use
+ them, rather than waiting to download microdescriptors. Implements
+ ticket 23827.
- o Minor bugfix (channel connection, backport from 0.3.3.2-alpha):
- - Use the actual observed address of an incoming relay connection,
- not the canonical address of the relay from its descriptor, when
- making decisions about how to handle the incoming connection.
- Fixes bug 24952; bugfix on 0.2.4.11-alpha. Patch by "ffmancera".
+ o Minor features (log messages):
+ - Improve log message in the out-of-memory handler to include
+ information about memory usage from the different compression
+ backends. Closes ticket 25372.
+ - Improve a warning message that happens when we fail to re-parse an
+ old router because of an expired certificate. Closes ticket 20020.
+ - Make the log more quantitative when we hit MaxMemInQueues
+ threshold exposing some values. Closes ticket 24501.
- o Minor bugfixes (denial-of-service, backport from 0.3.3.3-alpha):
- - Fix a possible crash on malformed consensus. If a consensus had
- contained an unparseable protocol line, it could have made clients
- and relays crash with a null-pointer exception. To exploit this
- issue, however, an attacker would need to be able to subvert the
- directory authority system. Fixes bug 25251; bugfix on
- 0.2.9.4-alpha. Also tracked as TROVE-2018-004.
+ o Minor features (logging):
+ - Clarify the log messages produced when getrandom() or a related
+ entropy-generation mechanism gives an error. Closes ticket 25120.
+ - Added support for the Android logging subsystem. Closes
+ ticket 24362.
- o Minor bugfix (directory authority, backport from 0.3.3.2-alpha):
- - Directory authorities, when refusing a descriptor from a rejected
- relay, now explicitly tell the relay (in its logs) to set a valid
- ContactInfo address and contact the bad-relays@ mailing list.
- Fixes bug 25170; bugfix on 0.2.9.1.
+ o Minor features (performance):
+ - Support predictive circuit building for onion service circuits
+ with multiple layers of guards. Closes ticket 23101.
+ - Use stdatomic.h where available, rather than mutexes, to implement
+ atomic_counter_t. Closes ticket 23953.
+
+ o Minor features (performance, 32-bit):
+ - Improve performance on 32-bit systems by avoiding 64-bit division
+ when calculating the timestamp in milliseconds for channel padding
+ computations. Implements ticket 24613.
+ - Improve performance on 32-bit systems by avoiding 64-bit division
+ when timestamping cells and buffer chunks for OOM calculations.
+ Implements ticket 24374.
+
+ o Minor features (performance, OSX, iOS):
+ - Use the mach_approximate_time() function (when available) to
+ implement coarse monotonic time. Having a coarse time function
+ should avoid a large number of system calls, and improve
+ performance slightly, especially under load. Closes ticket 24427.
+
+ o Minor features (performance, windows):
+ - Improve performance on Windows Vista and Windows 7 by adjusting
+ TCP send window size according to the recommendation from
+ SIO_IDEAL_SEND_BACKLOG_QUERY. Closes ticket 22798. Patch
+ from Vort.
+
+ o Minor features (sandbox):
+ - Explicitly permit the poll() system call when the Linux
+ seccomp2-based sandbox is enabled: apparently, some versions of
+ libc use poll() when calling getpwnam(). Closes ticket 25313.
+
+ o Minor features (storage, configuration):
+ - Users can store cached directory documents somewhere other than
+ the DataDirectory by using the CacheDirectory option. Similarly,
+ the storage location for relay's keys can be overridden with the
+ KeyDirectory option. Closes ticket 22703.
- o Minor bugfixes (build, rust, backport from 0.3.3.1-alpha):
- - When building with Rust on OSX, link against libresolv, to work
- around the issue at https://github.com/rust-lang/rust/issues/46797.
- Fixes bug 24652; bugfix on 0.3.1.1-alpha.
+ o Minor features (testing):
+ - Add a "make test-rust" target to run the rust tests only. Closes
+ ticket 25071.
+
+ o Minor features (testing, debugging, embedding):
+ - For development purposes, Tor now has a mode in which it runs for
+ a few seconds, then stops, and starts again without exiting the
+ process. This mode is meant to help us debug various issues with
+ ticket 23847. To use this feature, compile with
+ --enable-restart-debugging, and set the TOR_DEBUG_RESTART
+ environment variable. This is expected to crash a lot, and is
+ really meant for developers only. It will likely be removed in a
+ future release. Implements ticket 24583.
+
+ o Minor bugfixes (build, rust):
+ - Fix output of autoconf checks to display success messages for Rust
+ dependencies and a suitable rustc compiler version. Fixes bug
+ 24612; bugfix on 0.3.1.3-alpha.
+ - Don't pass the --quiet option to cargo: it seems to suppress some
+ errors, which is not what we want to do when building. Fixes bug
+ 24518; bugfix on 0.3.1.7.
+ - Build correctly when building from outside Tor's source tree with
+ the TOR_RUST_DEPENDENCIES option set. Fixes bug 22768; bugfix
+ on 0.3.1.7.
- o Minor bugfixes (onion services, backport from 0.3.3.2-alpha):
- - Remove a BUG() statement when a client fetches an onion descriptor
- that has a lower revision counter than the one in its cache. This
- can happen in normal circumstances due to HSDir desync. Fixes bug
- 24976; bugfix on 0.3.2.1-alpha.
+ o Minor bugfixes (C correctness):
+ - Fix a very unlikely (impossible, we believe) null pointer
+ dereference. Fixes bug 25629; bugfix on 0.2.9.15. Found by
+ Coverity; this is CID 1430932.
- o Minor bugfixes (logging, backport from 0.3.3.2-alpha):
- - Don't treat inability to store a cached consensus object as a bug:
- it can happen normally when we are out of disk space. Fixes bug
- 24859; bugfix on 0.3.1.1-alpha.
+ o Minor bugfixes (channel, client):
+ - Better identify client connection when reporting to the geoip
+ client cache. Fixes bug 24904; bugfix on 0.3.1.7.
- o Minor bugfixes (performance, fragile-hardening, backport from 0.3.3.1-alpha):
- - Improve the performance of our consensus-diff application code
- when Tor is built with the --enable-fragile-hardening option set.
- Fixes bug 24826; bugfix on 0.3.1.1-alpha.
+ o Minor bugfixes (circuit, cannibalization):
+ - Don't cannibalize preemptively-built circuits if we no longer
+ recognize their first hop. This situation can happen if our Guard
+ relay went off the consensus after the circuit was created. Fixes
+ bug 24469; bugfix on 0.0.6.
- o Minor bugfixes (OSX, backport from 0.3.3.1-alpha):
- - Don't exit the Tor process if setrlimit() fails to change the file
- limit (which can happen sometimes on some versions of OSX). Fixes
- bug 21074; bugfix on 0.0.9pre5.
+ o Minor bugfixes (client, backport from 0.3.4.1-alpha):
+ - Don't consider Tor running as a client if the ControlPort is open,
+ but no actual client ports are open. Fixes bug 26062; bugfix
+ on 0.2.9.4-alpha.
- o Minor bugfixes (spec conformance, backport from 0.3.3.3-alpha):
- - Forbid "-0" as a protocol version. Fixes part of bug 25249; bugfix on
- 0.2.9.4-alpha.
- - Forbid UINT32_MAX as a protocol version. Fixes part of bug 25249;
- bugfix on 0.2.9.4-alpha.
+ o Minor bugfixes (compilation):
+ - Fix a C99 compliance issue in our configuration script that caused
+ compilation issues when compiling Tor with certain versions of
+ xtools. Fixes bug 25474; bugfix on 0.3.2.5-alpha.
- o Minor bugfixes (testing, backport from 0.3.3.1-alpha):
- - Fix a memory leak in the scheduler/loop_kist unit test. Fixes bug
- 25005; bugfix on 0.3.2.7-rc.
+ o Minor bugfixes (controller):
+ - Restore the correct operation of the RESOLVE command, which had
+ been broken since we added the ability to enable/disable DNS on
+ specific listener ports. Fixes bug 25617; bugfix on 0.2.9.3-alpha.
+ - Avoid a (nonfatal) assertion failure when extending a one-hop
+ circuit from the controller to become a multihop circuit. Fixes
+ bug 24903; bugfix on 0.2.5.2-alpha.
- o Minor bugfixes (v3 onion services, backport from 0.3.3.2-alpha):
- - Look at the "HSRend" protocol version, not the "HSDir" protocol
- version, when deciding whether a consensus entry can support the
- v3 onion service protocol as a rendezvous point. Fixes bug 25105;
+ o Minor bugfixes (correctness):
+ - Remove a nonworking, unnecessary check to see whether a circuit
+ hop's identity digest was set when the circuit failed. Fixes bug
+ 24927; bugfix on 0.2.4.4-alpha.
+
+ o Minor bugfixes (correctness, client, backport from 0.3.4.1-alpha):
+ - Upon receiving a malformed connected cell, stop processing the
+ cell immediately. Previously we would mark the connection for
+ close, but continue processing the cell as if the connection were
+ open. Fixes bug 26072; bugfix on 0.2.4.7-alpha.
+
+ o Minor bugfixes (directory authorities, IPv6):
+ - When creating a routerstatus (vote) from a routerinfo (descriptor),
+ set the IPv6 address to the unspecified IPv6 address, and
+ explicitly initialize the port to zero. Fixes bug 24488; bugfix
+ on 0.2.4.1-alpha.
+
+ o Minor bugfixes (documentation):
+ - Document that the PerConnBW{Rate,Burst} options will fall back to
+ their corresponding consensus parameters only if those parameters
+ are set. Previously we had claimed that these values would always
+ be set in the consensus. Fixes bug 25296; bugfix on 0.2.2.7-alpha.
+
+ o Minor bugfixes (documentation, backport from 0.3.4.1-alpha):
+ - Stop saying in the manual that clients cache ipv4 dns answers from
+ exit relays. We haven't used them since 0.2.6.3-alpha, and in
+ ticket 24050 we stopped even caching them as of 0.3.2.6-alpha, but
+ we forgot to say so in the man page. Fixes bug 26052; bugfix
+ on 0.3.2.6-alpha.
+
+ o Minor bugfixes (exit relay DNS retries):
+ - Re-attempt timed-out DNS queries 3 times before failure, since our
+ timeout is 5 seconds for them, but clients wait 10-15. Also allow
+ slightly more timeouts per resolver when an exit has multiple
+ resolvers configured. Fixes bug 21394; bugfix on 0.3.1.9.
+
+ o Minor bugfixes (fallback directory mirrors):
+ - Make updateFallbackDirs.py search harder for python. (Some OSs
+ don't put it in /usr/bin.) Fixes bug 24708; bugfix
+ on 0.2.8.1-alpha.
+
+ o Minor bugfixes (hibernation, bandwidth accounting, shutdown):
+ - When hibernating, close connections normally and allow them to
+ flush. Fixes bug 23571; bugfix on 0.2.4.7-alpha. Also fixes
+ bug 7267.
+ - Do not attempt to launch self-reachability tests when entering
+ hibernation. Fixes a case of bug 12062; bugfix on 0.0.9pre5.
+ - Resolve several bugs related to descriptor fetching on bridge
+ clients with bandwidth accounting enabled. (This combination is
+ not recommended!) Fixes a case of bug 12062; bugfix
+ on 0.2.0.3-alpha.
+ - When hibernating, do not attempt to launch DNS checks. Fixes a
+ case of bug 12062; bugfix on 0.1.2.2-alpha.
+ - When hibernating, do not try to upload or download descriptors.
+ Fixes a case of bug 12062; bugfix on 0.0.9pre5.
+
+ o Minor bugfixes (IPv6, bridges):
+ - Tor now always sets IPv6 preferences for bridges. Fixes bug 24573;
+ bugfix on 0.2.8.2-alpha.
+ - Tor now sets IPv6 address in the routerstatus as well as in the
+ router descriptors when updating addresses for a bridge. Closes
+ ticket 24572; bugfix on 0.2.4.5-alpha. Patch by "ffmancera".
+
+ o Minor bugfixes (Linux seccomp2 sandbox):
+ - When running with the sandbox enabled, reload configuration files
+ correctly even when %include was used. Previously we would crash.
+ Fixes bug 22605; bugfix on 0.3.1. Patch from Daniel Pinto.
+
+ o Minor bugfixes (Linux seccomp2 sandbox, backport from 0.3.4.1-alpha):
+ - Allow the nanosleep() system call, which glibc uses to implement
+ sleep() and usleep(). Fixes bug 24969; bugfix on 0.2.5.1-alpha.
+
+ o Minor bugfixes (logging):
+ - Fix a (mostly harmless) race condition when invoking
+ LOG_PROTOCOL_WARN message from a subthread while the torrc options
+ are changing. Fixes bug 23954; bugfix on 0.1.1.9-alpha.
+
+ o Minor bugfixes (man page, SocksPort):
+ - Remove dead code from the old "SocksSocket" option, and rename
+ SocksSocketsGroupWritable to UnixSocksGroupWritable. The old
+ option still works, but is deprecated. Fixes bug 24343; bugfix
+ on 0.2.6.3.
+
+ o Minor bugfixes (memory leaks):
+ - Avoid possible at-exit memory leaks related to use of Libevent's
+ event_base_once() function. (This function tends to leak memory if
+ the event_base is closed before the event fires.) Fixes bug 24584;
+ bugfix on 0.2.8.1-alpha.
+ - Fix a harmless memory leak in tor-resolve. Fixes bug 24582; bugfix
+ on 0.2.1.1-alpha.
+
+ o Minor bugfixes (network IPv6 test):
+ - Tor's test scripts now check if "ping -6 ::1" works when the user
+ runs "make test-network-all". Fixes bug 24677; bugfix on
+ 0.2.9.3-alpha. Patch by "ffmancera".
+
+ o Minor bugfixes (networking):
+ - string_is_valid_hostname() will not consider IP strings to be
+ valid hostnames. Fixes bug 25055; bugfix on Tor 0.2.5.5.
+
+ o Minor bugfixes (onion service v3):
+ - Avoid an assertion failure when the next onion service descriptor
+ rotation type is out of sync with the consensus's valid-after
+ time. Instead, log a warning message with extra information, so we
+ can better hunt down the cause of this assertion. Fixes bug 25306;
bugfix on 0.3.2.1-alpha.
- o Code simplification and refactoring (backport from 0.3.3.3-alpha):
- - Update the "rust dependencies" submodule to be a project-level
- repository, rather than a user repository. Closes ticket 25323.
+ o Minor bugfixes (onion service, backport from 0.3.4.1-alpha):
+ - Fix a memory leak when a v3 onion service is configured and gets a
+ SIGHUP signal. Fixes bug 25901; bugfix on 0.3.2.1-alpha.
+ - When parsing the descriptor signature, look for the token plus an
+ extra white-space at the end. This is more correct but also will
+ allow us to support new fields that might start with "signature".
+ Fixes bug 26069; bugfix on 0.3.0.1-alpha.
- o Documentation (backport from 0.3.3.1-alpha)
- - Document that operators who run more than one relay or bridge are
- expected to set MyFamily and ContactInfo correctly. Closes
- ticket 24526.
+ o Minor bugfixes (onion services):
+ - If we are configured to offer a single onion service, don't log
+ long-term established one hop rendezvous points in the heartbeat.
+ Fixes bug 25116; bugfix on 0.2.9.6-rc.
+
+ o Minor bugfixes (performance):
+ - Reduce the number of circuits that will be opened at once during
+ the circuit build timeout phase. This is done by increasing the
+ idle timeout to 3 minutes, and lowering the maximum number of
+ concurrent learning circuits to 10. Fixes bug 24769; bugfix
+ on 0.3.1.1-alpha.
+ - Avoid calling protocol_list_supports_protocol() from inside tight
+ loops when running with cached routerinfo_t objects. Instead,
+ summarize the relevant protocols as flags in the routerinfo_t, as
+ we do for routerstatus_t objects. This change simplifies our code
+ a little, and saves a large amount of short-term memory allocation
+ operations. Fixes bug 25008; bugfix on 0.2.9.4-alpha.
+
+ o Minor bugfixes (performance, timeouts):
+ - Consider circuits for timeout as soon as they complete a hop. This
+ is more accurate than applying the timeout in
+ circuit_expire_building() because that function is only called
+ once per second, which is now too slow for typical timeouts on the
+ current network. Fixes bug 23114; bugfix on 0.2.2.2-alpha.
+ - Use onion service circuits (and other circuits longer than 3 hops)
+ to calculate a circuit build timeout. Previously, Tor only
+ calculated its build timeout based on circuits that planned to be
+ exactly 3 hops long. With this change, we include measurements
+ from all circuits at the point where they complete their third
+ hop. Fixes bug 23100; bugfix on 0.2.2.2-alpha.
+
+ o Minor bugfixes (relay, crash, backport from 0.3.4.1-alpha):
+ - Avoid a crash when running with DirPort set but ORPort tuned off.
+ Fixes a case of bug 23693; bugfix on 0.3.1.1-alpha.
+
+ o Minor bugfixes (Rust FFI):
+ - Fix a minor memory leak which would happen whenever the C code
+ would call the Rust implementation of
+ protover_get_supported_protocols(). This was due to the C version
+ returning a static string, whereas the Rust version newly allocated
+ a CString to pass across the FFI boundary. Consequently, the C
+ code was not expecting to need to free() what it was given. Fixes
+ bug 25127; bugfix on 0.3.2.1-alpha.
+
+ o Minor bugfixes (spelling):
+ - Use the "misspell" tool to detect and fix typos throughout the
+ source code. Fixes bug 23650; bugfix on various versions of Tor.
+ Patch from Deepesh Pathak.
+
+ o Minor bugfixes (testing):
+ - Avoid intermittent test failures due to a test that had relied on
+ onion service introduction point creation finishing within 5
+ seconds of real clock time. Fixes bug 25450; bugfix
+ on 0.3.1.3-alpha.
+ - Give out Exit flags in bootstrapping networks. Fixes bug 24137;
+ bugfix on 0.2.3.1-alpha.
+
+ o Minor bugfixes (unit test, monotonic time):
+ - Increase a constant (1msec to 10msec) in the monotonic time test
+ that makes sure the nsec/usec/msec times read are synchronized.
+ This change was needed to accommodate slow systems like armel or
+ when the clock_gettime() is not a VDSO on the running kernel.
+ Fixes bug 25113; bugfix on 0.2.9.1.
+
+ o Code simplification and refactoring:
+ - Move the list of default directory authorities to its own file.
+ Closes ticket 24854. Patch by "beastr0".
+ - Remove the old (deterministic) directory retry logic entirely:
+ We've used exponential backoff exclusively for some time. Closes
+ ticket 23814.
+ - Remove the unused nodelist_recompute_all_hsdir_indices(). Closes
+ ticket 25108.
+ - Remove a series of counters used to track circuit extend attempts
+ and connection status but that in reality we aren't using for
+ anything other than stats logged by a SIGUSR1 signal. Closes
+ ticket 25163.
+ - Remove /usr/athena from search path in configure.ac. Closes
+ ticket 24363.
+ - Remove duplicate code in node_has_curve25519_onion_key() and
+ node_get_curve25519_onion_key(), and add a check for a zero
+ microdesc curve25519 onion key. Closes ticket 23966, patch by
+ "aruna1234" and teor.
+ - Rewrite channel_rsa_id_group_set_badness to reduce temporary
+ memory allocations with large numbers of OR connections (e.g.
+ relays). Closes ticket 24119.
+ - Separate the function that deletes ephemeral files when Tor
+ stops gracefully.
+ - Small changes to Tor's buf_t API to make it suitable for use as a
+ general-purpose safe string constructor. Closes ticket 22342.
+ - Switch -Wnormalized=id to -Wnormalized=nfkc in configure.ac to
+ avoid source code identifier confusion. Closes ticket 24467.
+ - The tor_git_revision[] constant no longer needs to be redeclared
+ by everything that links against the rest of Tor. Done as part of
+ ticket 23845, to simplify our external API.
+ - We make extend_info_from_node() use node_get_curve25519_onion_key()
+ introduced in ticket 23577 to access the curve25519 public keys
+ rather than accessing it directly. Closes ticket 23760. Patch by
+ Neel Chauhan.
+ - Add a function to log channels' scheduler state changes to aid
+ debugging efforts. Closes ticket 24531.
+
+ o Documentation:
+ - Improved the documentation of AccountingStart parameter. Closes
+ ticket 23635.
+ - Update the documentation for "Log" to include the current list of
+ logging domains. Closes ticket 25378.
+ - Add documentation on how to build tor with Rust dependencies
+ without having to be online. Closes ticket 22907; bugfix
+ on 0.3.0.3-alpha.
+ - Clarify the behavior of RelayBandwidth{Rate,Burst} with client
+ traffic. Closes ticket 24318.
+ - Document that OutboundBindAddress doesn't apply to DNS requests.
+ Closes ticket 22145. Patch from Aruna Maurya.
+
+ o Code simplification and refactoring (channels):
+ - Remove the incoming and outgoing channel queues. These were never
+ used, but still took up a step in our fast path.
+ - The majority of the channel unit tests have been rewritten and the
+ code coverage has now been raised to 83.6% for channel.c. Closes
+ ticket 23709.
+ - Remove other dead code from the channel subsystem: All together,
+ this cleanup has removed more than 1500 lines of code overall and
+ adding very little except for unit test.
+
+ o Code simplification and refactoring (circuit rendezvous):
+ - Split the client-side rendezvous circuit lookup into two
+ functions: one that returns only established circuits and another
+ that returns all kinds of circuits. Closes ticket 23459.
+
+ o Code simplification and refactoring (controller):
+ - Make most of the variables in networkstatus_getinfo_by_purpose()
+ const. Implements ticket 24489.
+
+ o Documentation (backport from 0.3.4.1-alpha):
+ - Correct an IPv6 error in the documentation for ExitPolicy. Closes
+ ticket 25857. Patch from "CTassisF".
+
+ o Documentation (man page):
+ - The HiddenServiceVersion torrc option accepts only one number:
+ either version 2 or 3. Closes ticket 25026; bugfix
+ on 0.3.2.2-alpha.
+
+ o Documentation (manpage, denial of service):
+ - Provide more detail about the denial-of-service options, by
+ listing each mitigation and explaining how they relate. Closes
+ ticket 25248.
Changes in version 0.3.1.10 - 2018-03-03
@@ -190,11 +692,11 @@ Changes in version 0.3.1.10 - 2018-03-03
earlier releases.
All directory authorities should upgrade to one of the versions
- released today. Relays running 0.3.1.x may wish to update to one of
+ released today. Relays running 0.3.1.x may wish to update to one of
the versions released today, for the DoS mitigations.
Please note: according to our release calendar, Tor 0.3.1 will no
- longer be supported after 1 July 2018. If you will be running Tor
+ longer be supported after 1 July 2018. If you will be running Tor
after that date, you should make sure to plan to upgrade to the latest
stable version, or downgrade to 0.2.9 (which will receive long-term
support).
@@ -398,13 +900,14 @@ Changes in version 0.3.1.10 - 2018-03-03
o Minor bugfixes (spec conformance, backport from 0.3.3.3-alpha):
- Forbid "-0" as a protocol version. Fixes part of bug 25249; bugfix on
0.2.9.4-alpha.
- - Forbid UINT32_MAX as a protocol version. Fixes part of bug 25249;
+ - Forbid UINT32_MAX as a protocol version. Fixes part of bug 25249;
bugfix on 0.2.9.4-alpha.
o Code simplification and refactoring (backport from 0.3.3.3-alpha):
- Update the "rust dependencies" submodule to be a project-level
repository, rather than a user repository. Closes ticket 25323.
+
Changes in version 0.2.9.15 - 2018-03-03
Tor 0.2.9.15 backports important security and stability bugfixes from
later Tor releases.
@@ -419,7 +922,7 @@ Changes in version 0.2.9.15 - 2018-03-03
earlier releases.
All directory authorities should upgrade to one of the versions
- released today. Relays running 0.2.9.x may wish to update to one of
+ released today. Relays running 0.2.9.x may wish to update to one of
the versions released today, for the DoS mitigations.
o Major bugfixes (denial-of-service, directory authority, backport from 0.3.3.3-alpha):
@@ -578,9 +1081,183 @@ Changes in version 0.2.9.15 - 2018-03-03
o Minor bugfixes (spec conformance, backport from 0.3.3.3-alpha):
- Forbid "-0" as a protocol version. Fixes part of bug 25249; bugfix on
0.2.9.4-alpha.
- - Forbid UINT32_MAX as a protocol version. Fixes part of bug 25249;
+ - Forbid UINT32_MAX as a protocol version. Fixes part of bug 25249;
+ bugfix on 0.2.9.4-alpha.
+
+
+Changes in version 0.3.2.10 - 2018-03-03
+ Tor 0.3.2.10 is the second stable release in the 0.3.2 series. It
+ backports a number of bugfixes, including important fixes for security
+ issues.
+
+ It includes an important security fix for a remote crash attack
+ against directory authorities, tracked as TROVE-2018-001.
+
+ Additionally, it backports a fix for a bug whose severity we have
+ upgraded: Bug 24700, which was fixed in 0.3.3.2-alpha, can be remotely
+ triggered in order to crash relays with a use-after-free pattern. As
+ such, we are now tracking that bug as TROVE-2018-002 and
+ CVE-2018-0491, and backporting it to earlier releases. This bug
+ affected versions 0.3.2.1-alpha through 0.3.2.9, as well as version
+ 0.3.3.1-alpha.
+
+ This release also backports our new system for improved resistance to
+ denial-of-service attacks against relays.
+
+ This release also fixes several minor bugs and annoyances from
+ earlier releases.
+
+ Relays running 0.3.2.x SHOULD upgrade to one of the versions released
+ today, for the fix to TROVE-2018-002. Directory authorities should
+ also upgrade. (Relays on earlier versions might want to update too for
+ the DoS mitigations.)
+
+ o Major bugfixes (denial-of-service, directory authority, backport from 0.3.3.3-alpha):
+ - Fix a protocol-list handling bug that could be used to remotely crash
+ directory authorities with a null-pointer exception. Fixes bug 25074;
+ bugfix on 0.2.9.4-alpha. Also tracked as TROVE-2018-001 and
+ CVE-2018-0490.
+
+ o Major bugfixes (scheduler, KIST, denial-of-service, backport from 0.3.3.2-alpha):
+ - Avoid adding the same channel twice in the KIST scheduler pending
+ list, which could lead to remote denial-of-service use-after-free
+ attacks against relays. Fixes bug 24700; bugfix on 0.3.2.1-alpha.
+
+ o Major features (denial-of-service mitigation, backport from 0.3.3.2-alpha):
+ - Give relays some defenses against the recent network overload. We
+ start with three defenses (default parameters in parentheses).
+ First: if a single client address makes too many concurrent
+ connections (>100), hang up on further connections. Second: if a
+ single client address makes circuits too quickly (more than 3 per
+ second, with an allowed burst of 90) while also having too many
+ connections open (3), refuse new create cells for the next while
+ (1-2 hours). Third: if a client asks to establish a rendezvous
+ point to you directly, ignore the request. These defenses can be
+ manually controlled by new torrc options, but relays will also
+ take guidance from consensus parameters, so there's no need to
+ configure anything manually. Implements ticket 24902.
+
+ o Major bugfixes (onion services, retry behavior, backport from 0.3.3.1-alpha):
+ - Fix an "off by 2" error in counting rendezvous failures on the
+ onion service side. While we thought we would stop the rendezvous
+ attempt after one failed circuit, we were actually making three
+ circuit attempts before giving up. Now switch to a default of 2,
+ and allow the consensus parameter "hs_service_max_rdv_failures" to
+ override. Fixes bug 24895; bugfix on 0.0.6.
+ - New-style (v3) onion services now obey the "max rendezvous circuit
+ attempts" logic. Previously they would make as many rendezvous
+ circuit attempts as they could fit in the MAX_REND_TIMEOUT second
+ window before giving up. Fixes bug 24894; bugfix on 0.3.2.1-alpha.
+
+ o Major bugfixes (protocol versions, backport from 0.3.3.2-alpha):
+ - Add Link protocol version 5 to the supported protocols list. Fixes
+ bug 25070; bugfix on 0.3.1.1-alpha.
+
+ o Major bugfixes (relay, backport from 0.3.3.1-alpha):
+ - Fix a set of false positives where relays would consider
+ connections to other relays as being client-only connections (and
+ thus e.g. deserving different link padding schemes) if those
+ relays fell out of the consensus briefly. Now we look only at the
+ initial handshake and whether the connection authenticated as a
+ relay. Fixes bug 24898; bugfix on 0.3.1.1-alpha.
+
+ o Major bugfixes (scheduler, consensus, backport from 0.3.3.2-alpha):
+ - The scheduler subsystem was failing to promptly notice changes in
+ consensus parameters, making it harder to switch schedulers
+ network-wide. Fixes bug 24975; bugfix on 0.3.2.1-alpha.
+
+ o Minor features (denial-of-service avoidance, backport from 0.3.3.2-alpha):
+ - Make our OOM handler aware of the geoip client history cache so it
+ doesn't fill up the memory. This check is important for IPv6 and
+ our DoS mitigation subsystem. Closes ticket 25122.
+
+ o Minor features (compatibility, OpenSSL, backport from 0.3.3.3-alpha):
+ - Tor will now support TLS1.3 once OpenSSL 1.1.1 is released.
+ Previous versions of Tor would not have worked with OpenSSL 1.1.1,
+ since they neither disabled TLS 1.3 nor enabled any of the
+ ciphersuites it requires. Now we enable the TLS 1.3 ciphersuites.
+ Closes ticket 24978.
+
+ o Minor features (geoip):
+ - Update geoip and geoip6 to the February 7 2018 Maxmind GeoLite2
+ Country database.
+
+ o Minor features (logging, diagnostic, backport from 0.3.3.2-alpha):
+ - When logging a failure to create an onion service's descriptor,
+ also log what the problem with the descriptor was. Diagnostic
+ for ticket 24972.
+
+ o Minor bugfix (channel connection, backport from 0.3.3.2-alpha):
+ - Use the actual observed address of an incoming relay connection,
+ not the canonical address of the relay from its descriptor, when
+ making decisions about how to handle the incoming connection.
+ Fixes bug 24952; bugfix on 0.2.4.11-alpha. Patch by "ffmancera".
+
+ o Minor bugfixes (denial-of-service, backport from 0.3.3.3-alpha):
+ - Fix a possible crash on malformed consensus. If a consensus had
+ contained an unparseable protocol line, it could have made clients
+ and relays crash with a null-pointer exception. To exploit this
+ issue, however, an attacker would need to be able to subvert the
+ directory authority system. Fixes bug 25251; bugfix on
+ 0.2.9.4-alpha. Also tracked as TROVE-2018-004.
+
+ o Minor bugfix (directory authority, backport from 0.3.3.2-alpha):
+ - Directory authorities, when refusing a descriptor from a rejected
+ relay, now explicitly tell the relay (in its logs) to set a valid
+ ContactInfo address and contact the bad-relays@ mailing list.
+ Fixes bug 25170; bugfix on 0.2.9.1.
+
+ o Minor bugfixes (build, rust, backport from 0.3.3.1-alpha):
+ - When building with Rust on OSX, link against libresolv, to work
+ around the issue at https://github.com/rust-lang/rust/issues/46797.
+ Fixes bug 24652; bugfix on 0.3.1.1-alpha.
+
+ o Minor bugfixes (onion services, backport from 0.3.3.2-alpha):
+ - Remove a BUG() statement when a client fetches an onion descriptor
+ that has a lower revision counter than the one in its cache. This
+ can happen in normal circumstances due to HSDir desync. Fixes bug
+ 24976; bugfix on 0.3.2.1-alpha.
+
+ o Minor bugfixes (logging, backport from 0.3.3.2-alpha):
+ - Don't treat inability to store a cached consensus object as a bug:
+ it can happen normally when we are out of disk space. Fixes bug
+ 24859; bugfix on 0.3.1.1-alpha.
+
+ o Minor bugfixes (performance, fragile-hardening, backport from 0.3.3.1-alpha):
+ - Improve the performance of our consensus-diff application code
+ when Tor is built with the --enable-fragile-hardening option set.
+ Fixes bug 24826; bugfix on 0.3.1.1-alpha.
+
+ o Minor bugfixes (OSX, backport from 0.3.3.1-alpha):
+ - Don't exit the Tor process if setrlimit() fails to change the file
+ limit (which can happen sometimes on some versions of OSX). Fixes
+ bug 21074; bugfix on 0.0.9pre5.
+
+ o Minor bugfixes (spec conformance, backport from 0.3.3.3-alpha):
+ - Forbid "-0" as a protocol version. Fixes part of bug 25249; bugfix on
+ 0.2.9.4-alpha.
+ - Forbid UINT32_MAX as a protocol version. Fixes part of bug 25249;
bugfix on 0.2.9.4-alpha.
+ o Minor bugfixes (testing, backport from 0.3.3.1-alpha):
+ - Fix a memory leak in the scheduler/loop_kist unit test. Fixes bug
+ 25005; bugfix on 0.3.2.7-rc.
+
+ o Minor bugfixes (v3 onion services, backport from 0.3.3.2-alpha):
+ - Look at the "HSRend" protocol version, not the "HSDir" protocol
+ version, when deciding whether a consensus entry can support the
+ v3 onion service protocol as a rendezvous point. Fixes bug 25105;
+ bugfix on 0.3.2.1-alpha.
+
+ o Code simplification and refactoring (backport from 0.3.3.3-alpha):
+ - Update the "rust dependencies" submodule to be a project-level
+ repository, rather than a user repository. Closes ticket 25323.
+
+ o Documentation (backport from 0.3.3.1-alpha)
+ - Document that operators who run more than one relay or bridge are
+ expected to set MyFamily and ContactInfo correctly. Closes
+ ticket 24526.
+
Changes in version 0.3.2.9 - 2018-01-09
Tor 0.3.2.9 is the first stable release in the 0.3.2 series.
diff --git a/acinclude.m4 b/acinclude.m4
index 49d4f14471..c9cfc3f014 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -2,7 +2,7 @@ dnl Helper macros for Tor configure.ac
dnl Copyright (c) 2001-2004, Roger Dingledine
dnl Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson
dnl Copyright (c) 2007-2008, Roger Dingledine, Nick Mathewson
-dnl Copyright (c) 2007-2017, The Tor Project, Inc.
+dnl Copyright (c) 2007-2018, The Tor Project, Inc.
dnl See LICENSE for licensing information
AC_DEFUN([TOR_EXTEND_CODEPATH],
diff --git a/changes/bug22156 b/changes/bug22156
new file mode 100644
index 0000000000..685f2a551b
--- /dev/null
+++ b/changes/bug22156
@@ -0,0 +1,3 @@
+ o Minor features (development):
+ - Tor's makefile now supports running the "clippy" Rust style tool
+ on our Rust code. Closes ticket 22156.
diff --git a/changes/bug24891 b/changes/bug24891
new file mode 100644
index 0000000000..403b2b1123
--- /dev/null
+++ b/changes/bug24891
@@ -0,0 +1,4 @@
+ o Minor bugfixes (compilation):
+ - Refrain from compiling unit testing related object files
+ when --disable-unittests is set to configure script.
+ Fixes bug 24891; bugfix on 0.2.5.1-alpha.
diff --git a/changes/bug24977 b/changes/bug24977
new file mode 100644
index 0000000000..f8127a2a73
--- /dev/null
+++ b/changes/bug24977
@@ -0,0 +1,5 @@
+ o Minor bugfixes (onion services):
+ - Recompute some consensus information after clock skews or when we
+ transition from a non-live consensus to a live consensus. We do this to
+ avoid having an outdated state which could impact next-generation onion
+ services. Fixes bug 24977; bugfix on 0.3.2.1-alpha.
diff --git a/changes/bug25477 b/changes/bug25477
new file mode 100644
index 0000000000..0eac06137f
--- /dev/null
+++ b/changes/bug25477
@@ -0,0 +1,3 @@
+ o Minor bugfixes (logging):
+ - Refrain from mentioning bug 21018, as it is already fixed.
+ Fixes bug 25477; bugfix on 0.2.9.8.
diff --git a/changes/bug25686_diagnostic b/changes/bug25686_diagnostic
new file mode 100644
index 0000000000..96323145d8
--- /dev/null
+++ b/changes/bug25686_diagnostic
@@ -0,0 +1,4 @@
+ o Minor features (relay, diagnostic):
+ - Add several checks to detect whether Tor relays are uploading their
+ descriptors without specifying why they regenerated. Diagnostic for
+ ticket 25686.
diff --git a/changes/bug25787 b/changes/bug25787
new file mode 100644
index 0000000000..3041e8a603
--- /dev/null
+++ b/changes/bug25787
@@ -0,0 +1,7 @@
+ o Minor bugfixes (testing):
+ - Instead of trying to read the geoip configuration files from within the
+ unit tests, instead create our own ersatz files with just enough
+ geoip data in the format we expect. Trying to read from the source
+ directory created problems on Windows with mingw, where the
+ build system's paths are not the same as the platform's paths.
+ Fixes bug 25787; bugfix on 0.3.4.1-alpha.
diff --git a/changes/bug25886 b/changes/bug25886
new file mode 100644
index 0000000000..45f9a54069
--- /dev/null
+++ b/changes/bug25886
@@ -0,0 +1,7 @@
+ o Minor bugfixes (relay):
+ - In frac_nodes_with_descriptors(), add for_direct_connect, and replace
+ node_has_any_descriptor() with node_has_preferred_descriptor(). Also,
+ if we are using bridges and there is at least one bridge with a full
+ descriptor, set f_guard in compute_frac_paths_available() to 1.0.
+ Fixes bug 25886; bugfix on 0.3.5.1-alpha. Patch by Neel Chauhan.
+
diff --git a/changes/bug26072 b/changes/bug26072
deleted file mode 100644
index 2489e4fbb5..0000000000
--- a/changes/bug26072
+++ /dev/null
@@ -1,5 +0,0 @@
- o Minor bugfixes (correctness, client):
- - Upon receiving a malformed connected cell, stop processing the cell
- immediately. Previously we would mark the connection for close, but
- continue processing the cell as if the connection were open. Fixes bug
- 26072; bugfix on 0.2.4.7-alpha.
diff --git a/changes/bug26152 b/changes/bug26152
new file mode 100644
index 0000000000..34fda09b25
--- /dev/null
+++ b/changes/bug26152
@@ -0,0 +1,4 @@
+ o Minor bugfixes (testing):
+ - When logging a version mismatch in our openssl_version tests,
+ report the actual offending version strings. Fixes bug 26152; bugfix on
+ 0.2.9.1-alpha.
diff --git a/changes/bug26158 b/changes/bug26158
new file mode 100644
index 0000000000..0d74cf1167
--- /dev/null
+++ b/changes/bug26158
@@ -0,0 +1,5 @@
+ o Minor bugfixes (relay):
+ - Relays now correctly block attempts to re-extend to the previous
+ relay by Ed25519 identity. Previously they would warn in this case,
+ but not actually reject the attempt. Fixes bug 26158; bugfix on
+ 0.3.0.1-alpha.
diff --git a/changes/bug26196 b/changes/bug26196
new file mode 100644
index 0000000000..e63f09a2d6
--- /dev/null
+++ b/changes/bug26196
@@ -0,0 +1,7 @@
+ o Minor bugfixes (testing, compilation):
+ - Refrain from trying to get an item from empty smartlist in
+ test_bridges_clear_bridge_list. Set DEBUG_SMARTLIST in unit
+ tests to catch improper smartlist usage. Furthermore,
+ enable DEBUG_SMARTLIST globally when build is configured
+ with fragile hardening. Fixes bug 26196; bugfix on
+ 0.3.4.1-alpha.
diff --git a/changes/bug26214 b/changes/bug26214
new file mode 100644
index 0000000000..4277b9c6ec
--- /dev/null
+++ b/changes/bug26214
@@ -0,0 +1,3 @@
+ o Minor bugfixes (correctness, flow control):
+ - Upon receiving a stream-level SENDME cell, verify that our window has
+ not grown too large. Fixes bug 26214; bugfix on svn r54 (pre-0.0.1)
diff --git a/changes/bug26245 b/changes/bug26245
new file mode 100644
index 0000000000..7a14cea0bc
--- /dev/null
+++ b/changes/bug26245
@@ -0,0 +1,3 @@
+ o Minor features (compilation):
+ o The --enable-fatal-warnings flag now affects Rust code as well.
+ Closes ticket 26245.
diff --git a/changes/bug26258_033 b/changes/bug26258_033
new file mode 100644
index 0000000000..ceca383335
--- /dev/null
+++ b/changes/bug26258_033
@@ -0,0 +1,4 @@
+ o Major bugfixes (rust, testing):
+ - Fix a bug where a failure in the rust unit tests would not actually
+ cause the build to fail. Fixes bug 26258; bugfix on 0.3.3.4-alpha.
+
diff --git a/changes/bug26282 b/changes/bug26282
new file mode 100644
index 0000000000..c278f0b60a
--- /dev/null
+++ b/changes/bug26282
@@ -0,0 +1,4 @@
+ o Minor bugfixes (C correctness):
+ - Avoid casting smartlist index to int implicitly, as it may trigger
+ a warning (-Wshorten-64-to-32). Fixes bug 26282; bugfix on
+ 0.2.3.13-alpha, 0.2.7.1-alpha and 0.2.1.1-alpha.
diff --git a/changes/bug26402 b/changes/bug26402
new file mode 100644
index 0000000000..b21283a2d2
--- /dev/null
+++ b/changes/bug26402
@@ -0,0 +1,4 @@
+ o Minor bugfixes (compilation):
+ - When linking the libtor_testing.a library, only include the dirauth
+ object files once. Previously, they were getting added twice.
+ Fixes bug 26402; bugfix on 0.3.4.1-alpha.
diff --git a/changes/bug26415 b/changes/bug26415
new file mode 100644
index 0000000000..497fbb7365
--- /dev/null
+++ b/changes/bug26415
@@ -0,0 +1,3 @@
+ o Minor bugfixes (testing):
+ - Fix compilation of the doctests in the Rust crypto crate. Fixes
+ bug 26415; bugfix on 0.3.4.1-alpha.
diff --git a/changes/bug26435 b/changes/bug26435
new file mode 100644
index 0000000000..f66c503dd5
--- /dev/null
+++ b/changes/bug26435
@@ -0,0 +1,5 @@
+ o Major bugfixes (directory authority):
+ - Fix a memory leak where directory authorities would leak a chunk
+ of memory for every router descriptor every time they considered
+ voting. This bug was taking down directory authorities due to
+ out-of-memory issues. Fixes bug 26435; bugfix on 0.3.3.6.
diff --git a/changes/cargo_global_cache b/changes/cargo_global_cache
deleted file mode 100644
index b814950810..0000000000
--- a/changes/cargo_global_cache
+++ /dev/null
@@ -1,4 +0,0 @@
- o Minor features (Rust):
- - --enable-cargo-online-mode now uses the global cargo cache instead of the
- build directory. This is to be consistent with other Rust programs.
- Override with CARGO_HOME.
diff --git a/changes/feature26372_029 b/changes/feature26372_029
new file mode 100644
index 0000000000..150ac30555
--- /dev/null
+++ b/changes/feature26372_029
@@ -0,0 +1,4 @@
+ o Minor features (compilation):
+
+ - When building Tor, prefer to use Python 3 over Python 2, and more
+ recent (contemplated) versions over older ones. Closes ticket 26372.
diff --git a/changes/feature8323 b/changes/feature8323
new file mode 100644
index 0000000000..6fbc972d26
--- /dev/null
+++ b/changes/feature8323
@@ -0,0 +1,3 @@
+ o Minor features (controller):
+ - Implement 'GETINFO md/all' controller command to enable
+ getting all known microdesriptors. Closes ticket 8323.
diff --git a/changes/full_include_paths b/changes/full_include_paths
new file mode 100644
index 0000000000..c0ac0a05d3
--- /dev/null
+++ b/changes/full_include_paths
@@ -0,0 +1,3 @@
+ o Code simplification and refactoring:
+ - Include paths to header files within Tor are now qualified by directory
+ within the top-level src directory.
diff --git a/changes/rust_cross b/changes/rust_cross
new file mode 100644
index 0000000000..d490403a28
--- /dev/null
+++ b/changes/rust_cross
@@ -0,0 +1,2 @@
+ o Minor feature (Rust, portability):
+ - Rust cross-compilation is now supported. Closes ticket 25895.
diff --git a/changes/split_or_h b/changes/split_or_h
new file mode 100644
index 0000000000..53d54ca6dd
--- /dev/null
+++ b/changes/split_or_h
@@ -0,0 +1,5 @@
+ o Code simplification and refactoring:
+ - Many structures have been removed from the centralized "or.h" header,
+ and moved into their own headers. This will allow us to reduce
+ the number of places in the code that rely on each structure's
+ contents and layout. Closes ticket 26383.
diff --git a/changes/ticket19979 b/changes/ticket19979
new file mode 100644
index 0000000000..a6bf93f1a4
--- /dev/null
+++ b/changes/ticket19979
@@ -0,0 +1,3 @@
+ o Minor features (openssl):
+ - When possible, use RFC5869 HKDF implementation from OpenSSL.
+ Resolves ticket 19979.
diff --git a/changes/ticket25947 b/changes/ticket25947
new file mode 100644
index 0000000000..68559a73f8
--- /dev/null
+++ b/changes/ticket25947
@@ -0,0 +1,4 @@
+ o Minor feature (unit tests):
+ - Test complete bandwidth measurements files and test that incomplete lines
+ only give warnings when the end of the header has not been
+ detected. Fixes bug 25947; bugfix on 0.2.2.1-alpha
diff --git a/changes/ticket25960 b/changes/ticket25960
new file mode 100644
index 0000000000..0d1be2119b
--- /dev/null
+++ b/changes/ticket25960
@@ -0,0 +1,5 @@
+ o Minor feature (directory authorities):
+ - Stop warning about incomplete bw lines before the first complete bw line
+ has been found, so that additional header lines can be ignored.
+ Fixes bug 25960; bugfix on 0.2.2.1-alpha
+
diff --git a/changes/ticket26426 b/changes/ticket26426
new file mode 100644
index 0000000000..05fa974943
--- /dev/null
+++ b/changes/ticket26426
@@ -0,0 +1,4 @@
+ o Removed features:
+ - Tor no longer supports building with the dmalloc library. For debugging
+ memory issues, we suggest using gperftools or msan instead.
+ Closes ticket 26426.
diff --git a/changes/ticket26427 b/changes/ticket26427
new file mode 100644
index 0000000000..ff33f7bd4c
--- /dev/null
+++ b/changes/ticket26427
@@ -0,0 +1,6 @@
+ o Minor features (code layout):
+ - Make a new lowest-level error-handling API for use by code invoked
+ from within the logging module. This interface it makes it so
+ the logging code is no longer at risk of calling into itself if
+ a failure occurs while trying to log something.
+ Closes ticket 26427.
diff --git a/config.rust.in b/config.rust.in
new file mode 100644
index 0000000000..4ca5351aec
--- /dev/null
+++ b/config.rust.in
@@ -0,0 +1,22 @@
+# Used by our cargo build.rs script to get variables from autoconf.
+#
+# The "configure" script will generate "config.rust" from "config.rust.in",
+# and then build.rs will read "config.rust".
+
+BUILDDIR=@BUILDDIR@
+TOR_LDFLAGS_zlib=@TOR_LDFLAGS_zlib@
+TOR_LDFLAGS_openssl=@TOR_LDFLAGS_openssl@
+TOR_LDFLAGS_libevent=@TOR_LDFLAGS_libevent@
+TOR_ZLIB_LIBS=@TOR_ZLIB_LIBS@
+TOR_LIB_MATH=@TOR_LIB_MATH@
+TOR_LIBEVENT_LIBS=@TOR_LIBEVENT_LIBS@
+TOR_OPENSSL_LIBS=@TOR_OPENSSL_LIBS@
+TOR_LIB_WS32=@TOR_LIB_WS32@
+TOR_LIB_GDI=@TOR_LIB_GDI@
+TOR_LIB_USERENV=@TOR_LIB_USERENV@
+CURVE25519_LIBS=@CURVE25519_LIBS@
+TOR_SYSTEMD_LIBS=@TOR_SYSTEMD_LIBS@
+TOR_LZMA_LIBS=@TOR_LZMA_LIBS@
+TOR_ZSTD_LIBS=@TOR_ZSTD_LIBS@
+LIBS=@LIBS@
+LDFLAGS=@LDFLAGS@
diff --git a/configure.ac b/configure.ac
index 1caf0ad110..a6d13820e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,10 @@
dnl Copyright (c) 2001-2004, Roger Dingledine
dnl Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson
-dnl Copyright (c) 2007-2017, The Tor Project, Inc.
+dnl Copyright (c) 2007-2018, The Tor Project, Inc.
dnl See LICENSE for licensing information
AC_PREREQ([2.63])
-AC_INIT([tor],[0.3.4.1-alpha])
+AC_INIT([tor],[0.3.5.0-alpha-dev])
AC_CONFIG_SRCDIR([src/or/main.c])
AC_CONFIG_MACRO_DIR([m4])
@@ -21,16 +21,6 @@ AC_CANONICAL_HOST
PKG_PROG_PKG_CONFIG
-if test -f "/etc/redhat-release"; then
- if test -f "/usr/kerberos/include"; then
- CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
- fi
-fi
-
-# Not a no-op; we want to make sure that CPPFLAGS is set before we use
-# the += operator on it in src/or/Makefile.am
-CPPFLAGS="$CPPFLAGS -I\${top_srcdir}/src/common"
-
AC_ARG_ENABLE(openbsd-malloc,
AS_HELP_STRING(--enable-openbsd-malloc, [use malloc code from OpenBSD. Linux only]))
AC_ARG_ENABLE(static-openssl,
@@ -176,6 +166,7 @@ AC_ARG_ENABLE(fragile-hardening,
AS_HELP_STRING(--enable-fragile-hardening, [enable more fragile and expensive compiler hardening; makes Tor slower]))
if test "x$enable_expensive_hardening" = "xyes" || test "x$enable_fragile_hardening" = "xyes"; then
fragile_hardening="yes"
+ AC_DEFINE(DEBUG_SMARTLIST, 1, [Enable smartlist debugging])
fi
dnl Linker hardening options
@@ -299,7 +290,11 @@ AM_PROG_CC_C_O
AC_PROG_CC_C99
AC_ARG_VAR([PYTHON], [path to Python binary])
-AC_CHECK_PROGS(PYTHON, [python python2 python2.7 python3 python3.3])
+AC_CHECK_PROGS(PYTHON, [ \
+ python3 \
+ python3.8 python3.7 python3.6 python3.5 python3.4 \
+ python \
+ python2 python2.7])
if test "x$PYTHON" = "x"; then
AC_MSG_WARN([Python unavailable; some tests will not be run.])
fi
@@ -448,6 +443,8 @@ fi
AC_C_BIGENDIAN
+AC_ARG_VAR([TARGET], [Rust target, must be specified when cross-compiling (CHOST != CBUILD). example: i386-pc-windows-gnu])
+
if test "x$enable_rust" = "xyes"; then
AC_ARG_VAR([RUSTC], [path to the rustc binary])
AC_CHECK_PROG([RUSTC], [rustc], [rustc],[no])
@@ -462,14 +459,14 @@ if test "x$enable_rust" = "xyes"; then
fi
AC_DEFINE([HAVE_RUST], 1, [have Rust])
+ if test "x$enable_fatal_warnings" = "xyes"; then
+ RUST_WARN=
+ else
+ RUST_WARN=#
+ fi
if test "x$enable_cargo_online_mode" = "xyes"; then
CARGO_ONLINE=
RUST_DL=#
-
- # assume that the user knows what they want if CARGO_HOME is set
- if test -z "$CARGO_HOME"; then
- AC_MSG_WARN([Cargo online mode is enabled. Cargo will download into ~/.cargo. Set CARGO_HOME to override this. Note that relative CARGO_HOME paths are not supported by Tor's build system.])
- fi
else
CARGO_ONLINE=--frozen
RUST_DL=
@@ -513,13 +510,31 @@ if test "x$enable_rust" = "xyes"; then
dnl For now both MSVC and MinGW rust libraries will output static libs with
dnl the MSVC naming convention.
if test "$bwin32" = "true"; then
- TOR_RUST_STATIC_NAME=tor_rust.lib
+ tor_rust_static_name=tor_rust.lib
+ else
+ tor_rust_static_name=libtor_rust.a
+ fi
+
+ AC_CANONICAL_BUILD
+
+ if test -n "$TARGET"; then
+ if test "$host" = "$build"; then
+ AC_MSG_ERROR([CHOST = CBUILD is invalid if TARGET is specified, see configure --help for more information.])
+ fi
+ RUST_TARGET_PROP="target = '$TARGET'"
+ TOR_RUST_LIB_PATH="src/rust/target/$TARGET/release/$tor_rust_static_name"
else
- TOR_RUST_STATIC_NAME=libtor_rust.a
+ if test "$host" != "$build"; then
+ AC_MSG_ERROR([TARGET must be specified when cross-compiling with Rust enabled.])
+ fi
+ RUST_TARGET_PROP=
+ TOR_RUST_LIB_PATH="src/rust/target/release/$tor_rust_static_name"
fi
- AC_SUBST(TOR_RUST_STATIC_NAME)
+ AC_SUBST(RUST_TARGET_PROP)
+ AC_SUBST(TOR_RUST_LIB_PATH)
AC_SUBST(CARGO_ONLINE)
+ AC_SUBST(RUST_WARN)
AC_SUBST(RUST_DL)
dnl Let's check the rustc version, too
@@ -1116,6 +1131,33 @@ if test "$fragile_hardening" = "yes"; then
TOR_CHECK_CFLAGS([-fno-omit-frame-pointer])
fi
+dnl Find the correct libraries to add in order to use the sanitizers.
+dnl
+dnl When building Rust, Cargo will run the linker with the -nodefaultlibs
+dnl option, which will prevent the compiler from linking the sanitizer
+dnl libraries it needs. We need to specify them manually.
+dnl
+dnl What's more, we need to specify them in a linker script rather than
+dnl from build.rs: these options aren't allowed in the cargo:rustc-flags
+dnl variable.
+RUST_LINKER_OPTIONS=""
+if test "x$have_clang" = "xyes"; then
+ if test "x$CFLAGS_ASAN" != "x"; then
+ RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS $CFLAGS_ASAN"
+ fi
+ if test "x$CFLAGS_UBSAN" != "x"; then
+ RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS $CFLAGS_UBSAN"
+ fi
+else
+ if test "x$CFLAGS_ASAN" != "x"; then
+ RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS -lasan"
+ fi
+ if test "x$CFLAGS_UBSAN" != "x"; then
+ RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS -lubsan"
+ fi
+fi
+AC_SUBST(RUST_LINKER_OPTIONS)
+
CFLAGS_BUGTRAP="$CFLAGS_FTRAPV $CFLAGS_ASAN $CFLAGS_UBSAN"
CFLAGS_CONSTTIME="$CFLAGS_FWRAPV"
@@ -1320,8 +1362,7 @@ AC_SUBST(CURVE25519_LIBS)
dnl Make sure to enable support for large off_t if available.
AC_SYS_LARGEFILE
-AC_CHECK_HEADERS([assert.h \
- errno.h \
+AC_CHECK_HEADERS([errno.h \
fcntl.h \
signal.h \
string.h \
@@ -1734,26 +1775,6 @@ if test "$tor_cv_uint8_uchar" = "no"; then
AC_MSG_ERROR([We assume that uint8_t is the same type as unsigned char, but your compiler disagrees.])
fi
-# Whether we should use the dmalloc memory allocation debugging library.
-AC_MSG_CHECKING(whether to use dmalloc (debug memory allocation library))
-AC_ARG_WITH(dmalloc,
-AS_HELP_STRING(--with-dmalloc, [use debug memory allocation library]),
-[if [[ "$withval" = "yes" ]]; then
- dmalloc=1
- AC_MSG_RESULT(yes)
-else
- dmalloc=1
- AC_MSG_RESULT(no)
-fi], [ dmalloc=0; AC_MSG_RESULT(no) ]
-)
-
-if [[ $dmalloc -eq 1 ]]; then
- AC_CHECK_HEADERS(dmalloc.h, , AC_MSG_ERROR(dmalloc header file not found. Do you have the development files for dmalloc installed?))
- AC_SEARCH_LIBS(dmalloc_malloc, [dmallocth dmalloc], , AC_MSG_ERROR(Libdmalloc library not found. If you enable it you better have it installed.))
- AC_DEFINE(USE_DMALLOC, 1, [Debug memory allocation library])
- AC_CHECK_FUNCS(dmalloc_strdup dmalloc_strndup)
-fi
-
AC_ARG_WITH(tcmalloc,
AS_HELP_STRING(--with-tcmalloc, [use tcmalloc memory allocation library]),
[ tcmalloc=yes ], [ tcmalloc=no ])
@@ -2265,6 +2286,8 @@ CPPFLAGS="$CPPFLAGS $TOR_CPPFLAGS_libevent $TOR_CPPFLAGS_openssl $TOR_CPPFLAGS_z
AC_CONFIG_FILES([
Doxyfile
Makefile
+ config.rust
+ link_rust.sh
contrib/dist/suse/tor.sh
contrib/operator-tools/tor.logrotate
contrib/dist/tor.sh
diff --git a/contrib/win32build/tor-mingw.nsi.in b/contrib/win32build/tor-mingw.nsi.in
index fa9b6eb643..c9822790bb 100644
--- a/contrib/win32build/tor-mingw.nsi.in
+++ b/contrib/win32build/tor-mingw.nsi.in
@@ -8,7 +8,7 @@
!include "LogicLib.nsh"
!include "FileFunc.nsh"
!insertmacro GetParameters
-!define VERSION "0.3.4.1-alpha"
+!define VERSION "0.3.5.0-alpha-dev"
!define INSTALLER "tor-${VERSION}-win32.exe"
!define WEBSITE "https://www.torproject.org/"
!define LICENSE "LICENSE"
diff --git a/doc/HACKING/CodingStandards.md b/doc/HACKING/CodingStandards.md
index 3711f70198..b830ecea93 100644
--- a/doc/HACKING/CodingStandards.md
+++ b/doc/HACKING/CodingStandards.md
@@ -172,7 +172,6 @@ deviations from our C whitespace style. Generally, we use:
- Unix-style line endings
- K&R-style indentation
- No space before newlines
- - A blank line at the end of each file
- Never more than one blank line in a row
- Always spaces, never tabs
- No more than 79-columns per line.
@@ -185,6 +184,9 @@ deviations from our C whitespace style. Generally, we use:
`puts (x)`.
- Function declarations at the start of the line.
+If you use an editor that has plugins for editorconfig.org, the file
+`.editorconfig` will help you to conform this coding style.
+
We try hard to build without warnings everywhere. In particular, if
you're using gcc, you should invoke the configure script with the
option `--enable-fatal-warnings`. This will tell the compiler
@@ -434,4 +436,3 @@ the functions that call your function rely on it doing something, then your
function should mention that it does that something in the documentation. If
you rely on a function doing something beyond what is in its documentation,
then you should watch out, or it might do something else later.
-
diff --git a/doc/HACKING/HelpfulTools.md b/doc/HACKING/HelpfulTools.md
index a0795076e0..eb068a91f3 100644
--- a/doc/HACKING/HelpfulTools.md
+++ b/doc/HACKING/HelpfulTools.md
@@ -25,16 +25,6 @@ Jenkins
https://jenkins.torproject.org
-Dmalloc
--------
-
-The dmalloc library will keep track of memory allocation, so you can find out
-if we're leaking memory, doing any double-frees, or so on.
-
- dmalloc -l -/dmalloc.log
- (run the commands it tells you)
- ./configure --with-dmalloc
-
Valgrind
--------
diff --git a/link_rust.sh.in b/link_rust.sh.in
new file mode 100644
index 0000000000..59f4142baa
--- /dev/null
+++ b/link_rust.sh.in
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# A linker script used when building Rust tests. Autoconf makes link_rust.sh
+# from link_rust_sh.in, and uses it to pass extra options to the linker
+# when linking Rust stuff.
+#
+# We'd like to remove the need for this, but build.rs doesn't let us pass
+# -static-libasan and -static-libubsan to the linker.
+
+$CCLD @RUST_LINKER_OPTIONS@ "$@"
diff --git a/scripts/codegen/gen_server_ciphers.py b/scripts/codegen/gen_server_ciphers.py
index 7ea39c540d..5b2eef07ef 100755
--- a/scripts/codegen/gen_server_ciphers.py
+++ b/scripts/codegen/gen_server_ciphers.py
@@ -1,5 +1,5 @@
#!/usr/bin/python
-# Copyright 2014-2017, The Tor Project, Inc
+# Copyright 2014-2018, The Tor Project, Inc
# See LICENSE for licensing information
# This script parses openssl headers to find ciphersuite names, determines
diff --git a/scripts/codegen/get_mozilla_ciphers.py b/scripts/codegen/get_mozilla_ciphers.py
index 946957ac77..4f986daba9 100755
--- a/scripts/codegen/get_mozilla_ciphers.py
+++ b/scripts/codegen/get_mozilla_ciphers.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
# coding=utf-8
-# Copyright 2011-2017, The Tor Project, Inc
+# Copyright 2011-2018, The Tor Project, Inc
# original version by Arturo Filastò
# See LICENSE for licensing information
diff --git a/scripts/codegen/makedesc.py b/scripts/codegen/makedesc.py
index 8d9d4edaaf..4ee8106f03 100644
--- a/scripts/codegen/makedesc.py
+++ b/scripts/codegen/makedesc.py
@@ -1,5 +1,5 @@
#!/usr/bin/python
-# Copyright 2014-2017, The Tor Project, Inc.
+# Copyright 2014-2018, The Tor Project, Inc.
# See LICENSE for license information
# This is a kludgey python script that uses ctypes and openssl to sign
diff --git a/scripts/maint/checkIncludes.py b/scripts/maint/checkIncludes.py
new file mode 100755
index 0000000000..3c611675e4
--- /dev/null
+++ b/scripts/maint/checkIncludes.py
@@ -0,0 +1,72 @@
+#!/usr/bin/python3
+# Copyright 2018 The Tor Project, Inc. See LICENSE file for licensing info.
+
+import fnmatch
+import os
+import re
+import sys
+
+trouble = False
+
+def err(msg):
+ global trouble
+ trouble = True
+ print(msg, file=sys.stderr)
+
+def fname_is_c(fname):
+ return fname.endswith(".h") or fname.endswith(".c")
+
+INCLUDE_PATTERN = re.compile(r'\s*#\s*include\s+"([^"]*)"')
+RULES_FNAME = ".may_include"
+
+class Rules(object):
+ def __init__(self):
+ self.patterns = []
+
+ def addPattern(self, pattern):
+ self.patterns.append(pattern)
+
+ def includeOk(self, path):
+ for pattern in self.patterns:
+ if fnmatch.fnmatchcase(path, pattern):
+ return True
+ return False
+
+ def applyToLines(self, lines, context=""):
+ lineno = 0
+ for line in lines:
+ lineno += 1
+ m = INCLUDE_PATTERN.match(line)
+ if m:
+ include = m.group(1)
+ if not self.includeOk(include):
+ err("Forbidden include of {} on line {}{}".format(
+ include, lineno, context))
+
+ def applyToFile(self, fname):
+ with open(fname, 'r') as f:
+ #print(fname)
+ self.applyToLines(iter(f), " of {}".format(fname))
+
+def load_include_rules(fname):
+ result = Rules()
+ with open(fname, 'r') as f:
+ for line in f:
+ line = line.strip()
+ if line.startswith("#") or not line:
+ continue
+ result.addPattern(line)
+ return result
+
+for dirpath, dirnames, fnames in os.walk("src"):
+ if ".may_include" in fnames:
+ rules = load_include_rules(os.path.join(dirpath, RULES_FNAME))
+ for fname in fnames:
+ if fname_is_c(fname):
+ rules.applyToFile(os.path.join(dirpath,fname))
+
+if trouble:
+ err(
+"""To change which includes are allowed in a C file, edit the {} files in its
+enclosing directory.""".format(RULES_FNAME))
+ sys.exit(1)
diff --git a/scripts/maint/checkSpace.pl b/scripts/maint/checkSpace.pl
index 9929932cc5..633b47e314 100755
--- a/scripts/maint/checkSpace.pl
+++ b/scripts/maint/checkSpace.pl
@@ -16,12 +16,21 @@ if ($ARGV[0] =~ /^-/) {
$C = ($lang eq '-C');
}
+our %basenames = ();
+
for my $fn (@ARGV) {
open(F, "$fn");
my $lastnil = 0;
my $lastline = "";
my $incomment = 0;
my $in_func_head = 0;
+ my $basename = $fn;
+ $basename =~ s#.*/##;
+ if ($basenames{$basename}) {
+ msg "Duplicate fnames: $fn and $basenames{$basename}.\n";
+ } else {
+ $basenames{$basename} = $fn;
+ }
while (<F>) {
## Warn about windows-style newlines.
# (We insist on lines that end with a single LF character, not
@@ -126,7 +135,7 @@ for my $fn (@ARGV) {
## Warn about double semi-colons at the end of a line.
if (/;;$/) {
msg " double semi-colons at the end of $. in $fn\n"
- }
+ }
## Warn about multiple internal spaces.
#if (/[^\s,:]\s{2,}[^\s\\=]/) {
# msg " X X:$fn:$.\n";
@@ -192,11 +201,6 @@ for my $fn (@ARGV) {
}
}
}
- ## Warn if the file doesn't end with a blank line.
- # (End each file with a single blank line.)
- if (! $lastnil) {
- msg " EOL\@EOF:$fn:$.\n";
- }
close(F);
}
diff --git a/scripts/maint/format_changelog.py b/scripts/maint/format_changelog.py
index c5a0cfc81b..98fbbfb516 100755
--- a/scripts/maint/format_changelog.py
+++ b/scripts/maint/format_changelog.py
@@ -1,5 +1,5 @@
#!/usr/bin/python
-# Copyright (c) 2014-2017, The Tor Project, Inc.
+# Copyright (c) 2014-2018, The Tor Project, Inc.
# See LICENSE for licensing information
#
# This script reformats a section of the changelog to wrap everything to
diff --git a/scripts/maint/rectify_include_paths.py b/scripts/maint/rectify_include_paths.py
new file mode 100755
index 0000000000..401fadae6d
--- /dev/null
+++ b/scripts/maint/rectify_include_paths.py
@@ -0,0 +1,60 @@
+#!/usr/bin/python3
+
+import os
+import os.path
+import re
+
+# Find all the include files, map them to their real names.
+
+def exclude(paths, dirnames):
+ for p in paths:
+ if p in dirnames:
+ dirnames.remove(p)
+
+def get_include_map():
+ includes = { }
+
+ for dirpath,dirnames,fnames in os.walk("src"):
+ exclude(["ext", "win32"], dirnames)
+
+ for fname in fnames:
+ if fname.endswith(".h"):
+ assert fname not in includes
+ include = os.path.join(dirpath, fname)
+ assert include.startswith("src/")
+ includes[fname] = include[4:]
+
+ return includes
+
+INCLUDE_PAT = re.compile(r'( *# *include +")([^"]+)(".*)')
+
+def get_base_header_name(hdr):
+ return os.path.split(hdr)[1]
+
+def fix_includes(inp, out, mapping):
+ for line in inp:
+ m = INCLUDE_PAT.match(line)
+ if m:
+ include,hdr,rest = m.groups()
+ basehdr = get_base_header_name(hdr)
+ if basehdr in mapping:
+ out.write('{}{}{}\n'.format(include,mapping[basehdr],rest))
+ continue
+
+ out.write(line)
+
+incs = get_include_map()
+
+for dirpath,dirnames,fnames in os.walk("src"):
+ exclude(["trunnel"], dirnames)
+
+ for fname in fnames:
+ if fname.endswith(".c") or fname.endswith(".h"):
+ fname = os.path.join(dirpath, fname)
+ tmpfile = fname+".tmp"
+ f_in = open(fname, 'r')
+ f_out = open(tmpfile, 'w')
+ fix_includes(f_in, f_out, incs)
+ f_in.close()
+ f_out.close()
+ os.rename(tmpfile, fname)
diff --git a/scripts/maint/redox.py b/scripts/maint/redox.py
index 53d3d902eb..e8b2622ab9 100755
--- a/scripts/maint/redox.py
+++ b/scripts/maint/redox.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
#
-# Copyright (c) 2008-2017, The Tor Project, Inc.
+# Copyright (c) 2008-2018, The Tor Project, Inc.
# See LICENSE for licensing information.
#
# Hi!
diff --git a/scripts/maint/sortChanges.py b/scripts/maint/sortChanges.py
index 22e40fd369..c85e6563b8 100755
--- a/scripts/maint/sortChanges.py
+++ b/scripts/maint/sortChanges.py
@@ -1,5 +1,5 @@
#!/usr/bin/python
-# Copyright (c) 2014-2017, The Tor Project, Inc.
+# Copyright (c) 2014-2018, The Tor Project, Inc.
# See LICENSE for licensing information
"""This script sorts a bunch of changes files listed on its command
diff --git a/scripts/maint/updateCopyright.pl b/scripts/maint/updateCopyright.pl
index beb0b8f26e..bd24377d38 100755
--- a/scripts/maint/updateCopyright.pl
+++ b/scripts/maint/updateCopyright.pl
@@ -1,7 +1,7 @@
#!/usr/bin/perl -i -w -p
-$NEWYEAR=2017;
+$NEWYEAR=2018;
-s/Copyright(.*) (201[^7]), The Tor Project/Copyright$1 $2-${NEWYEAR}, The Tor Project/;
+s/Copyright(.*) (201[^8]), The Tor Project/Copyright$1 $2-${NEWYEAR}, The Tor Project/;
s/Copyright(.*)-(20..), The Tor Project/Copyright$1-${NEWYEAR}, The Tor Project/;
diff --git a/scripts/test/appveyor-irc-notify.py b/scripts/test/appveyor-irc-notify.py
new file mode 100644
index 0000000000..4ffea52684
--- /dev/null
+++ b/scripts/test/appveyor-irc-notify.py
@@ -0,0 +1,192 @@
+# coding=utf8
+# Copyright (C) 2015-2016 Christopher R. Wood
+# Copyright (c) 2018 The Tor Project
+# Copyright (c) 2018 isis agora lovecruft
+#
+# From: https://raw.githubusercontent.com/gridsync/gridsync/def54f8166089b733d166665fdabcad4cdc526d8/misc/irc-notify.py
+# and: https://github.com/gridsync/gridsync
+#
+# Modified by nexB on October 2016:
+# - rework the handling of environment variables.
+# - made the script use functions
+# - support only Appveyor loading its environment variable to craft IRC notices.
+#
+# Modified by isis agora lovecruft <isis@torproject.org> in 2018:
+# - Make IRC server configurable.
+# - Make bot IRC nick deterministic.
+# - Make bot join the channel rather than sending NOTICE messages externally.
+# - Fix a bug which always caused sys.exit() to be logged as a traceback.
+# - Actually reset the IRC colour codes after printing.
+#
+# Modified by Marcin Cieślak in 2018:
+# - Accept UTF-8
+# - only guess github URLs
+# - stop using ANSI colors
+
+# This program is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software Foundation;
+# either version 2 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with this
+# program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
+# Fifth Floor, Boston, MA 02110-1301 USA.
+
+"""Simple AppVeyor IRC notification script.
+
+The first argument is an IRC server and port; the second is the channel. Other
+arguments passed to the script will be sent as notice messages content and any
+{var}-formatted environment variables will be expanded automatically, replaced
+with a corresponding Appveyor environment variable value. Use commas to
+delineate multiple messages.
+
+
+Example:
+export APPVEYOR_URL=https://ci.appveyor.com
+export APPVEYOR_PROJECT_NAME=tor
+export APPVEYOR_REPO_COMMIT_AUTHOR=isislovecruft
+export APPVEYOR_REPO_COMMIT_TIMESTAMP=2018-04-23
+export APPVEYOR_REPO_PROVIDER=gihub
+export APPVEYOR_REPO_BRANCH=repo_branch
+export APPVEYOR_PULL_REQUEST_TITLE=pull_request_title
+export APPVEYOR_BUILD_VERSION=1
+export APPVEYOR_REPO_COMMIT=22c95b72e29248dc4de9b85e590ee18f6f587de8
+export APPVEYOR_REPO_COMMIT_MESSAGE="some IRC test"
+export APPVEYOR_ACCOUNT_NAME=isislovecruft
+export APPVEYOR_PULL_REQUEST_NUMBER=pull_request_number
+export APPVEYOR_REPO_NAME=isislovecruft/tor
+python ./appveyor-irc-notify.py irc.oftc.net:6697 tor-ci '{repo_name} {repo_branch} {short_commit} - {repo_commit_author}: {repo_commit_message}','Build #{build_version} passed. Details: {build_url} | Commit: {commit_url}
+
+See also https://github.com/gridsync/gridsync/blob/master/appveyor.yml for examples
+in Appveyor's YAML:
+
+ on_success:
+ - "python scripts/test/appveyor-irc-notify.py irc.oftc.net:6697 tor-ci success
+ on_failure:
+ - "python scripts/test/appveyor-irc-notify.py irc.oftc.net:6697 tor-ci failure
+"""
+
+from __future__ import print_function
+from __future__ import absolute_import
+
+import os
+import random
+import socket
+import ssl
+import sys
+import time
+
+
+def appveyor_vars():
+ """
+ Return a dict of key value carfted from appveyor environment variables.
+ """
+
+ vars = dict([
+ (
+ v.replace('APPVEYOR_', '').lower(),
+ os.getenv(v, '').decode('utf-8')
+ ) for v in [
+ 'APPVEYOR_URL',
+ 'APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED',
+ 'APPVEYOR_REPO_BRANCH',
+ 'APPVEYOR_REPO_COMMIT_AUTHOR',
+ 'APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL',
+ 'APPVEYOR_REPO_COMMIT_TIMESTAMP',
+ 'APPVEYOR_REPO_PROVIDER',
+ 'APPVEYOR_PROJECT_NAME',
+ 'APPVEYOR_PULL_REQUEST_TITLE',
+ 'APPVEYOR_BUILD_VERSION',
+ 'APPVEYOR_REPO_COMMIT',
+ 'APPVEYOR_REPO_COMMIT_MESSAGE',
+ 'APPVEYOR_ACCOUNT_NAME',
+ 'APPVEYOR_PULL_REQUEST_NUMBER',
+ 'APPVEYOR_REPO_NAME'
+ ]
+ ])
+
+ BUILD_FMT = u'{url}/project/{account_name}/{project_name}/build/{build_version}'
+
+ if vars["repo_provider"] == 'github':
+ COMMIT_FMT = u'https://{repo_provider}.com/{repo_name}/commit/{repo_commit}'
+ vars.update(commit_url=COMMIT_FMT.format(**vars))
+
+ vars.update(
+ build_url=BUILD_FMT.format(**vars),
+ short_commit=vars["repo_commit"][:7],
+ )
+ return vars
+
+
+def notify():
+ """
+ Send IRC notification
+ """
+ apvy_vars = appveyor_vars()
+
+ server, port = sys.argv[1].rsplit(":", 1)
+ channel = sys.argv[2]
+ success = sys.argv[3] == "success"
+ failure = sys.argv[3] == "failure"
+
+ if success or failure:
+ messages = []
+ messages.append(u"{repo_name} {repo_branch} {short_commit} - {repo_commit_author}: {repo_commit_message}")
+
+ if success:
+ m = u"Build #{build_version} passed. Details: {build_url}"
+ if failure:
+ m = u"Build #{build_version} failed. Details: {build_url}"
+
+ if "commit_url" in apvy_vars:
+ m += " Commit: {commit_url}"
+
+ messages.append(m)
+ else:
+ messages = sys.argv[3:]
+ messages = ' '.join(messages)
+ messages = messages.decode("utf-8").split(',')
+
+ print(repr(apvy_vars))
+ messages = [msg.format(**apvy_vars).strip() for msg in messages]
+
+ irc_username = 'appveyor-ci'
+ irc_nick = irc_username
+
+ # establish connection
+ irc_sock = ssl.wrap_socket(socket.socket(socket.AF_INET, socket.SOCK_STREAM))
+ irc_sock.connect((socket.gethostbyname(server), int(port)))
+ irc_sock.send('NICK {0}\r\nUSER {0} * 0 :{0}\r\n'.format(irc_username).encode())
+ irc_sock.send('JOIN #{0}\r\n'.format(channel).encode())
+ irc_file = irc_sock.makefile()
+
+ while irc_file:
+ line = irc_file.readline()
+ print(line.rstrip())
+ response = line.split()
+
+ if response[0] == 'PING':
+ irc_file.send('PONG {}\r\n'.format(response[1]).encode())
+
+ elif response[1] == '433':
+ irc_sock.send('NICK {}\r\n'.format(irc_nick).encode())
+
+ elif response[1] == '001':
+ time.sleep(5)
+ # send notification
+ for msg in messages:
+ print(u'PRIVMSG #{} :{}'.format(channel, msg).encode("utf-8"))
+ irc_sock.send(u'PRIVMSG #{} :{}\r\n'.format(channel, msg).encode("utf-8"))
+ time.sleep(5)
+ return
+
+
+if __name__ == '__main__':
+ try:
+ notify()
+ except:
+ import traceback
+ print('ERROR: Failed to send notification: \n' + traceback.format_exc())
diff --git a/scripts/test/cov-diff b/scripts/test/cov-diff
index ed8874d2d3..6179dff63e 100755
--- a/scripts/test/cov-diff
+++ b/scripts/test/cov-diff
@@ -10,12 +10,12 @@ DIRB="$2"
for B in $DIRB/*; do
A=$DIRA/`basename $B`
if [ -f $A ]; then
- perl -pe 's/^\s*\!*\d+:/ 1:/; s/^([^:]+:)[\d\s]+:/$1/; s/^ *-:(Runs|Programs):.*//;' "$A" > "$A.tmp"
+ perl -pe 's/^\s*\!*\d+(\*?):/ 1$1:/; s/^([^:]+:)[\d\s]+:/$1/; s/^ *-:(Runs|Programs):.*//;' "$A" > "$A.tmp"
else
cat /dev/null > "$A.tmp"
fi
- perl -pe 's/^\s*\!*\d+:/ 1:/; s/^([^:]+:)[\d\s]+:/$1/; s/^ *-:(Runs|Programs):.*//;' "$B" > "$B.tmp"
- diff -u "$A.tmp" "$B.tmp"
+ perl -pe 's/^\s*\!*\d+(\*?):/ 1$1:/; s/^([^:]+:)[\d\s]+:/$1/; s/^ *-:(Runs|Programs):.*//;' "$B" > "$B.tmp"
+ diff -u "$A.tmp" "$B.tmp" |perl -pe 's/^((?:\+\+\+|---)(?:.*tmp))\s+.*/$1/;'
rm "$A.tmp" "$B.tmp"
done
diff --git a/src/common/.may_include b/src/common/.may_include
new file mode 100644
index 0000000000..fab9ad0da8
--- /dev/null
+++ b/src/common/.may_include
@@ -0,0 +1,11 @@
+orconfig.h
+common/*.h
+lib/*/*.h
+
+# XXXX These all belong somewhere else
+ht.h
+linux_syscalls.inc
+siphash.h
+src/ext/timeouts/timeout.c
+tor_queue.h
+tor_readpassphrase.h
diff --git a/src/common/address.c b/src/common/address.c
index a32df99107..42052f85ec 100644
--- a/src/common/address.c
+++ b/src/common/address.c
@@ -1,6 +1,6 @@
/* Copyright (c) 2003-2004, Roger Dingledine
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -35,13 +35,14 @@
#include <iphlpapi.h>
#endif /* defined(_WIN32) */
-#include "compat.h"
-#include "util.h"
-#include "util_format.h"
-#include "address.h"
-#include "torlog.h"
-#include "container.h"
-#include "sandbox.h"
+#include "common/compat.h"
+#include "common/util.h"
+#include "common/util_format.h"
+#include "common/address.h"
+#include "lib/log/torlog.h"
+#include "lib/container/smartlist.h"
+#include "common/sandbox.h"
+#include "siphash.h"
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
@@ -83,7 +84,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
/* tor_addr_is_null() and maybe other functions rely on AF_UNSPEC being 0 to
* work correctly. Bail out here if we've found a platform where AF_UNSPEC
@@ -2170,4 +2170,3 @@ tor_addr_port_eq(const tor_addr_port_t *a,
{
return tor_addr_eq(&a->addr, &b->addr) && a->port == b->port;
}
-
diff --git a/src/common/address.h b/src/common/address.h
index c9d9543dee..b95ee364ab 100644
--- a/src/common/address.h
+++ b/src/common/address.h
@@ -1,6 +1,6 @@
/* Copyright (c) 2003-2004, Roger Dingledine
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -13,9 +13,9 @@
//#include <sys/sockio.h>
#include "orconfig.h"
-#include "torint.h"
-#include "compat.h"
-#include "container.h"
+#include "lib/cc/torint.h"
+#include "common/compat.h"
+#include "lib/log/util_bug.h"
#ifdef ADDRESS_PRIVATE
@@ -206,10 +206,11 @@ const char * fmt_addr32(uint32_t addr);
MOCK_DECL(int,get_interface_address6,(int severity, sa_family_t family,
tor_addr_t *addr));
-void interface_address6_list_free_(smartlist_t * addrs);// XXXX
+struct smartlist_t;
+void interface_address6_list_free_(struct smartlist_t * addrs);// XXXX
#define interface_address6_list_free(addrs) \
- FREE_AND_NULL(smartlist_t, interface_address6_list_free_, (addrs))
-MOCK_DECL(smartlist_t *,get_interface_address6_list,(int severity,
+ FREE_AND_NULL(struct smartlist_t, interface_address6_list_free_, (addrs))
+MOCK_DECL(struct smartlist_t *,get_interface_address6_list,(int severity,
sa_family_t family,
int include_internal));
@@ -335,7 +336,7 @@ MOCK_DECL(int,get_interface_address,(int severity, uint32_t *addr));
* Returns NULL on failure.
* Use free_interface_address_list to free the returned list.
*/
-static inline smartlist_t *
+static inline struct smartlist_t *
get_interface_address_list(int severity, int include_internal)
{
return get_interface_address6_list(severity, AF_INET, include_internal);
@@ -346,34 +347,33 @@ int tor_addr_port_eq(const tor_addr_port_t *a,
const tor_addr_port_t *b);
#ifdef ADDRESS_PRIVATE
-MOCK_DECL(smartlist_t *,get_interface_addresses_raw,(int severity,
+MOCK_DECL(struct smartlist_t *,get_interface_addresses_raw,(int severity,
sa_family_t family));
MOCK_DECL(int,get_interface_address6_via_udp_socket_hack,(int severity,
sa_family_t family,
tor_addr_t *addr));
#ifdef HAVE_IFADDRS_TO_SMARTLIST
-STATIC smartlist_t *ifaddrs_to_smartlist(const struct ifaddrs *ifa,
+STATIC struct smartlist_t *ifaddrs_to_smartlist(const struct ifaddrs *ifa,
sa_family_t family);
-STATIC smartlist_t *get_interface_addresses_ifaddrs(int severity,
+STATIC struct smartlist_t *get_interface_addresses_ifaddrs(int severity,
sa_family_t family);
#endif /* defined(HAVE_IFADDRS_TO_SMARTLIST) */
#ifdef HAVE_IP_ADAPTER_TO_SMARTLIST
-STATIC smartlist_t *ip_adapter_addresses_to_smartlist(
+STATIC struct smartlist_t *ip_adapter_addresses_to_smartlist(
const IP_ADAPTER_ADDRESSES *addresses);
-STATIC smartlist_t *get_interface_addresses_win32(int severity,
+STATIC struct smartlist_t *get_interface_addresses_win32(int severity,
sa_family_t family);
#endif /* defined(HAVE_IP_ADAPTER_TO_SMARTLIST) */
#ifdef HAVE_IFCONF_TO_SMARTLIST
-STATIC smartlist_t *ifreq_to_smartlist(char *ifr,
+STATIC struct smartlist_t *ifreq_to_smartlist(char *ifr,
size_t buflen);
-STATIC smartlist_t *get_interface_addresses_ioctl(int severity,
+STATIC struct smartlist_t *get_interface_addresses_ioctl(int severity,
sa_family_t family);
#endif /* defined(HAVE_IFCONF_TO_SMARTLIST) */
#endif /* defined(ADDRESS_PRIVATE) */
#endif /* !defined(TOR_ADDRESS_H) */
-
diff --git a/src/common/address_set.c b/src/common/address_set.c
index b2f4bb4c95..f4c5f581c8 100644
--- a/src/common/address_set.c
+++ b/src/common/address_set.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2018, The Tor Project, Inc. */
+/* Copyright (c) 2018-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -11,12 +11,12 @@
**/
#include "orconfig.h"
-#include "address_set.h"
-#include "address.h"
-#include "compat.h"
-#include "container.h"
-#include "crypto_rand.h"
-#include "util.h"
+#include "common/address_set.h"
+#include "common/address.h"
+#include "common/compat.h"
+#include "lib/container/bitarray.h"
+#include "lib/crypt_ops/crypto_rand.h"
+#include "common/util.h"
#include "siphash.h"
/** How many 64-bit siphash values to extract per address */
@@ -126,4 +126,3 @@ address_set_probably_contains(address_set_t *set,
}
return matches == N_BITS_PER_ITEM;
}
-
diff --git a/src/common/address_set.h b/src/common/address_set.h
index 28d29f3fdf..cfee89cfb8 100644
--- a/src/common/address_set.h
+++ b/src/common/address_set.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2018, The Tor Project, Inc. */
+/* Copyright (c) 2018-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -14,7 +14,7 @@
#define TOR_ADDRESS_SET_H
#include "orconfig.h"
-#include "torint.h"
+#include "lib/cc/torint.h"
/**
* An address_set_t represents a set of tor_addr_t values. The implementation
diff --git a/src/common/buffers.c b/src/common/buffers.c
index a01add9bef..4e5f56c733 100644
--- a/src/common/buffers.c
+++ b/src/common/buffers.c
@@ -1,7 +1,7 @@
/* Copyright (c) 2001 Matej Pfajfar.
* Copyright (c) 2001-2004, Roger Dingledine.
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -21,12 +21,12 @@
#define BUFFERS_PRIVATE
#include "orconfig.h"
#include <stddef.h>
-#include "buffers.h"
-#include "compat.h"
-#include "compress.h"
-#include "util.h"
-#include "torint.h"
-#include "torlog.h"
+#include "common/buffers.h"
+#include "common/compat.h"
+#include "lib/compress/compress.h"
+#include "common/util.h"
+#include "lib/cc/torint.h"
+#include "lib/log/torlog.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
diff --git a/src/common/buffers.h b/src/common/buffers.h
index 4275152de2..80103af776 100644
--- a/src/common/buffers.h
+++ b/src/common/buffers.h
@@ -1,7 +1,7 @@
/* Copyright (c) 2001 Matej Pfajfar.
* Copyright (c) 2001-2004, Roger Dingledine.
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -12,9 +12,9 @@
#ifndef TOR_BUFFERS_H
#define TOR_BUFFERS_H
-#include "compat.h"
-#include "torint.h"
-#include "testsupport.h"
+#include "common/compat.h"
+#include "lib/cc/torint.h"
+#include "lib/testsupport/testsupport.h"
typedef struct buf_t buf_t;
diff --git a/src/common/compat.c b/src/common/compat.c
index 6fdd6ecf00..8e418f4c1d 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -1,6 +1,6 @@
/* Copyright (c) 2003-2004, Roger Dingledine
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -13,7 +13,7 @@
**/
#define COMPAT_PRIVATE
-#include "compat.h"
+#include "common/compat.h"
#ifdef _WIN32
#include <winsock2.h>
@@ -111,7 +111,6 @@ SecureZeroMemory(PVOID ptr, SIZE_T cnt)
#endif
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
@@ -125,19 +124,12 @@ SecureZeroMemory(PVOID ptr, SIZE_T cnt)
#include <sys/file.h>
#endif
-#include "torlog.h"
-#include "util.h"
-#include "container.h"
-#include "address.h"
-#include "sandbox.h"
-
-/* Inline the strl functions if the platform doesn't have them. */
-#ifndef HAVE_STRLCPY
-#include "strlcpy.c"
-#endif
-#ifndef HAVE_STRLCAT
-#include "strlcat.c"
-#endif
+#include "lib/log/torlog.h"
+#include "common/util.h"
+#include "lib/container/smartlist.h"
+#include "lib/wallclock/tm_cvt.h"
+#include "common/address.h"
+#include "common/sandbox.h"
/* When set_max_file_descriptors() is called, update this with the max file
* descriptor value so we can use it to check the limit when opening a new
@@ -405,147 +397,6 @@ tor_munmap_file(tor_mmap_t *handle)
#error "cannot implement tor_mmap_file"
#endif /* defined(HAVE_MMAP) || ... || ... */
-/** Replacement for snprintf. Differs from platform snprintf in two
- * ways: First, always NUL-terminates its output. Second, always
- * returns -1 if the result is truncated. (Note that this return
- * behavior does <i>not</i> conform to C99; it just happens to be
- * easier to emulate "return -1" with conformant implementations than
- * it is to emulate "return number that would be written" with
- * non-conformant implementations.) */
-int
-tor_snprintf(char *str, size_t size, const char *format, ...)
-{
- va_list ap;
- int r;
- va_start(ap,format);
- r = tor_vsnprintf(str,size,format,ap);
- va_end(ap);
- return r;
-}
-
-/** Replacement for vsnprintf; behavior differs as tor_snprintf differs from
- * snprintf.
- */
-int
-tor_vsnprintf(char *str, size_t size, const char *format, va_list args)
-{
- int r;
- if (size == 0)
- return -1; /* no place for the NUL */
- if (size > SIZE_T_CEILING)
- return -1;
-#ifdef _WIN32
- r = _vsnprintf(str, size, format, args);
-#else
- r = vsnprintf(str, size, format, args);
-#endif
- str[size-1] = '\0';
- if (r < 0 || r >= (ssize_t)size)
- return -1;
- return r;
-}
-
-/**
- * Portable asprintf implementation. Does a printf() into a newly malloc'd
- * string. Sets *<b>strp</b> to this string, and returns its length (not
- * including the terminating NUL character).
- *
- * You can treat this function as if its implementation were something like
- <pre>
- char buf[_INFINITY_];
- tor_snprintf(buf, sizeof(buf), fmt, args);
- *strp = tor_strdup(buf);
- return strlen(*strp):
- </pre>
- * Where _INFINITY_ is an imaginary constant so big that any string can fit
- * into it.
- */
-int
-tor_asprintf(char **strp, const char *fmt, ...)
-{
- int r;
- va_list args;
- va_start(args, fmt);
- r = tor_vasprintf(strp, fmt, args);
- va_end(args);
- if (!*strp || r < 0) {
- /* LCOV_EXCL_START */
- log_err(LD_BUG, "Internal error in asprintf");
- tor_assert(0);
- /* LCOV_EXCL_STOP */
- }
- return r;
-}
-
-/**
- * Portable vasprintf implementation. Does a printf() into a newly malloc'd
- * string. Differs from regular vasprintf in the same ways that
- * tor_asprintf() differs from regular asprintf.
- */
-int
-tor_vasprintf(char **strp, const char *fmt, va_list args)
-{
- /* use a temporary variable in case *strp is in args. */
- char *strp_tmp=NULL;
-#ifdef HAVE_VASPRINTF
- /* If the platform gives us one, use it. */
- int r = vasprintf(&strp_tmp, fmt, args);
- if (r < 0)
- *strp = NULL;
- else
- *strp = strp_tmp;
- return r;
-#elif defined(HAVE__VSCPRINTF)
- /* On Windows, _vsnprintf won't tell us the length of the string if it
- * overflows, so we need to use _vcsprintf to tell how much to allocate */
- int len, r;
- va_list tmp_args;
- va_copy(tmp_args, args);
- len = _vscprintf(fmt, tmp_args);
- va_end(tmp_args);
- if (len < 0) {
- *strp = NULL;
- return -1;
- }
- strp_tmp = tor_malloc(len + 1);
- r = _vsnprintf(strp_tmp, len+1, fmt, args);
- if (r != len) {
- tor_free(strp_tmp);
- *strp = NULL;
- return -1;
- }
- *strp = strp_tmp;
- return len;
-#else
- /* Everywhere else, we have a decent vsnprintf that tells us how many
- * characters we need. We give it a try on a short buffer first, since
- * it might be nice to avoid the second vsnprintf call.
- */
- char buf[128];
- int len, r;
- va_list tmp_args;
- va_copy(tmp_args, args);
- /* vsnprintf() was properly checked but tor_vsnprintf() available so
- * why not use it? */
- len = tor_vsnprintf(buf, sizeof(buf), fmt, tmp_args);
- va_end(tmp_args);
- if (len < (int)sizeof(buf)) {
- *strp = tor_strdup(buf);
- return len;
- }
- strp_tmp = tor_malloc(len+1);
- /* use of tor_vsnprintf() will ensure string is null terminated */
- r = tor_vsnprintf(strp_tmp, len+1, fmt, args);
- if (r != len) {
- tor_free(strp_tmp);
- *strp = NULL;
- return -1;
- }
- *strp = strp_tmp;
- return len;
-#endif /* defined(HAVE_VASPRINTF) || ... */
-}
-
/** Given <b>hlen</b> bytes at <b>haystack</b> and <b>nlen</b> bytes at
* <b>needle</b>, return a pointer to the first occurrence of the needle
* within the haystack, or NULL if there is no such occurrence.
@@ -592,67 +443,6 @@ tor_memmem(const void *_haystack, size_t hlen,
#endif /* defined(HAVE_MEMMEM) && (!defined(__GNUC__) || __GNUC__ >= 2) */
}
-/**
- * Tables to implement ctypes-replacement TOR_IS*() functions. Each table
- * has 256 bits to look up whether a character is in some set or not. This
- * fails on non-ASCII platforms, but it is hard to find a platform whose
- * character set is not a superset of ASCII nowadays. */
-
-/**@{*/
-const uint32_t TOR_ISALPHA_TABLE[8] =
- { 0, 0, 0x7fffffe, 0x7fffffe, 0, 0, 0, 0 };
-const uint32_t TOR_ISALNUM_TABLE[8] =
- { 0, 0x3ff0000, 0x7fffffe, 0x7fffffe, 0, 0, 0, 0 };
-const uint32_t TOR_ISSPACE_TABLE[8] = { 0x3e00, 0x1, 0, 0, 0, 0, 0, 0 };
-const uint32_t TOR_ISXDIGIT_TABLE[8] =
- { 0, 0x3ff0000, 0x7e, 0x7e, 0, 0, 0, 0 };
-const uint32_t TOR_ISDIGIT_TABLE[8] = { 0, 0x3ff0000, 0, 0, 0, 0, 0, 0 };
-const uint32_t TOR_ISPRINT_TABLE[8] =
- { 0, 0xffffffff, 0xffffffff, 0x7fffffff, 0, 0, 0, 0x0 };
-const uint32_t TOR_ISUPPER_TABLE[8] = { 0, 0, 0x7fffffe, 0, 0, 0, 0, 0 };
-const uint32_t TOR_ISLOWER_TABLE[8] = { 0, 0, 0, 0x7fffffe, 0, 0, 0, 0 };
-
-/** Upper-casing and lowercasing tables to map characters to upper/lowercase
- * equivalents. Used by tor_toupper() and tor_tolower(). */
-/**@{*/
-const uint8_t TOR_TOUPPER_TABLE[256] = {
- 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
- 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
- 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
- 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
- 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
- 80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
- 96,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
- 80,81,82,83,84,85,86,87,88,89,90,123,124,125,126,127,
- 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
- 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
- 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
- 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
- 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
- 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
- 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
- 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,
-};
-const uint8_t TOR_TOLOWER_TABLE[256] = {
- 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
- 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
- 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
- 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
- 64,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
- 112,113,114,115,116,117,118,119,120,121,122,91,92,93,94,95,
- 96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
- 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
- 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
- 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
- 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
- 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
- 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
- 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
- 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
- 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,
-};
-/**@}*/
-
/** Helper for tor_strtok_r_impl: Advances cp past all characters in
* <b>sep</b>, and returns its new value. */
static char *
@@ -703,32 +493,6 @@ tor_strtok_r_impl(char *str, const char *sep, char **lasts)
return start;
}
-#ifdef _WIN32
-/** Take a filename and return a pointer to its final element. This
- * function is called on __FILE__ to fix a MSVC nit where __FILE__
- * contains the full path to the file. This is bad, because it
- * confuses users to find the home directory of the person who
- * compiled the binary in their warning messages.
- */
-const char *
-tor_fix_source_file(const char *fname)
-{
- const char *cp1, *cp2, *r;
- cp1 = strrchr(fname, '/');
- cp2 = strrchr(fname, '\\');
- if (cp1 && cp2) {
- r = (cp1<cp2)?(cp2+1):(cp1+1);
- } else if (cp1) {
- r = cp1+1;
- } else if (cp2) {
- r = cp2+1;
- } else {
- r = fname;
- }
- return r;
-}
-#endif /* defined(_WIN32) */
-
/**
* Read a 16-bit value beginning at <b>cp</b>. Equivalent to
* *(uint16_t*)(cp), but will not cause segfaults on platforms that forbid
@@ -943,80 +707,6 @@ tor_lockfile_unlock(tor_lockfile_t *lockfile)
tor_free(lockfile);
}
-/** @{ */
-/** Some old versions of Unix didn't define constants for these values,
- * and instead expect you to say 0, 1, or 2. */
-#ifndef SEEK_SET
-#define SEEK_SET 0
-#endif
-#ifndef SEEK_CUR
-#define SEEK_CUR 1
-#endif
-#ifndef SEEK_END
-#define SEEK_END 2
-#endif
-/** @} */
-
-/** Return the position of <b>fd</b> with respect to the start of the file. */
-off_t
-tor_fd_getpos(int fd)
-{
-#ifdef _WIN32
- return (off_t) _lseek(fd, 0, SEEK_CUR);
-#else
- return (off_t) lseek(fd, 0, SEEK_CUR);
-#endif
-}
-
-/** Move <b>fd</b> to the end of the file. Return -1 on error, 0 on success.
- * If the file is a pipe, do nothing and succeed.
- **/
-int
-tor_fd_seekend(int fd)
-{
-#ifdef _WIN32
- return _lseek(fd, 0, SEEK_END) < 0 ? -1 : 0;
-#else
- off_t rc = lseek(fd, 0, SEEK_END) < 0 ? -1 : 0;
-#ifdef ESPIPE
- /* If we get an error and ESPIPE, then it's a pipe or a socket of a fifo:
- * no need to worry. */
- if (rc < 0 && errno == ESPIPE)
- rc = 0;
-#endif /* defined(ESPIPE) */
- return (rc < 0) ? -1 : 0;
-#endif /* defined(_WIN32) */
-}
-
-/** Move <b>fd</b> to position <b>pos</b> in the file. Return -1 on error, 0
- * on success. */
-int
-tor_fd_setpos(int fd, off_t pos)
-{
-#ifdef _WIN32
- return _lseek(fd, pos, SEEK_SET) < 0 ? -1 : 0;
-#else
- return lseek(fd, pos, SEEK_SET) < 0 ? -1 : 0;
-#endif
-}
-
-/** Replacement for ftruncate(fd, 0): move to the front of the file and remove
- * all the rest of the file. Return -1 on error, 0 on success. */
-int
-tor_ftruncate(int fd)
-{
- /* Rumor has it that some versions of ftruncate do not move the file pointer.
- */
- if (tor_fd_setpos(fd, 0) < 0)
- return -1;
-
-#ifdef _WIN32
- return _chsize(fd, 0);
-#else
- return ftruncate(fd, 0);
-#endif
-}
-
#undef DEBUG_SOCKET_COUNTING
#ifdef DEBUG_SOCKET_COUNTING
/** A bitarray of all fds that should be passed to tor_socket_close(). Only
@@ -2851,183 +2541,39 @@ compute_num_cpus(void)
return num_cpus;
}
-#if !defined(_WIN32)
-/** Defined iff we need to add locks when defining fake versions of reentrant
- * versions of time-related functions. */
-#define TIME_FNS_NEED_LOCKS
-#endif
-
-/** Helper: Deal with confused or out-of-bounds values from localtime_r and
- * friends. (On some platforms, they can give out-of-bounds values or can
- * return NULL.) If <b>islocal</b>, this is a localtime result; otherwise
- * it's from gmtime. The function returns <b>r</b>, when given <b>timep</b>
- * as its input. If we need to store new results, store them in
- * <b>resultbuf</b>. */
-static struct tm *
-correct_tm(int islocal, const time_t *timep, struct tm *resultbuf,
- struct tm *r)
-{
- const char *outcome;
-
- if (PREDICT_LIKELY(r)) {
- /* We can't strftime dates after 9999 CE, and we want to avoid dates
- * before 1 CE (avoiding the year 0 issue and negative years). */
- if (r->tm_year > 8099) {
- r->tm_year = 8099;
- r->tm_mon = 11;
- r->tm_mday = 31;
- r->tm_yday = 364;
- r->tm_wday = 6;
- r->tm_hour = 23;
- r->tm_min = 59;
- r->tm_sec = 59;
- } else if (r->tm_year < (1-1900)) {
- r->tm_year = (1-1900);
- r->tm_mon = 0;
- r->tm_mday = 1;
- r->tm_yday = 0;
- r->tm_wday = 0;
- r->tm_hour = 0;
- r->tm_min = 0;
- r->tm_sec = 0;
- }
- return r;
- }
-
- /* If we get here, gmtime or localtime returned NULL. It might have done
- * this because of overrun or underrun, or it might have done it because of
- * some other weird issue. */
- if (timep) {
- if (*timep < 0) {
- r = resultbuf;
- r->tm_year = 70; /* 1970 CE */
- r->tm_mon = 0;
- r->tm_mday = 1;
- r->tm_yday = 0;
- r->tm_wday = 0;
- r->tm_hour = 0;
- r->tm_min = 0 ;
- r->tm_sec = 0;
- outcome = "Rounding up to 1970";
- goto done;
- } else if (*timep >= INT32_MAX) {
- /* Rounding down to INT32_MAX isn't so great, but keep in mind that we
- * only do it if gmtime/localtime tells us NULL. */
- r = resultbuf;
- r->tm_year = 137; /* 2037 CE */
- r->tm_mon = 11;
- r->tm_mday = 31;
- r->tm_yday = 364;
- r->tm_wday = 6;
- r->tm_hour = 23;
- r->tm_min = 59;
- r->tm_sec = 59;
- outcome = "Rounding down to 2037";
- goto done;
- }
- }
-
- /* If we get here, then gmtime/localtime failed without getting an extreme
- * value for *timep */
- /* LCOV_EXCL_START */
- tor_fragile_assert();
- r = resultbuf;
- memset(resultbuf, 0, sizeof(struct tm));
- outcome="can't recover";
- /* LCOV_EXCL_STOP */
- done:
- log_warn(LD_BUG, "%s("I64_FORMAT") failed with error %s: %s",
- islocal?"localtime":"gmtime",
- timep?I64_PRINTF_ARG(*timep):0,
- strerror(errno),
- outcome);
- return r;
-}
-
-/** @{ */
/** As localtime_r, but defined for platforms that don't have it:
*
* Convert *<b>timep</b> to a struct tm in local time, and store the value in
* *<b>result</b>. Return the result on success, or NULL on failure.
*/
-#ifdef HAVE_LOCALTIME_R
-struct tm *
-tor_localtime_r(const time_t *timep, struct tm *result)
-{
- struct tm *r;
- r = localtime_r(timep, result);
- return correct_tm(1, timep, result, r);
-}
-#elif defined(TIME_FNS_NEED_LOCKS)
-struct tm *
-tor_localtime_r(const time_t *timep, struct tm *result)
-{
- struct tm *r;
- static tor_mutex_t *m=NULL;
- if (!m) { m=tor_mutex_new(); }
- tor_assert(result);
- tor_mutex_acquire(m);
- r = localtime(timep);
- if (r)
- memcpy(result, r, sizeof(struct tm));
- tor_mutex_release(m);
- return correct_tm(1, timep, result, r);
-}
-#else
struct tm *
tor_localtime_r(const time_t *timep, struct tm *result)
{
- struct tm *r;
- tor_assert(result);
- r = localtime(timep);
- if (r)
- memcpy(result, r, sizeof(struct tm));
- return correct_tm(1, timep, result, r);
+ char *err = NULL;
+ struct tm *r = tor_localtime_r_msg(timep, result, &err);
+ if (err) {
+ log_warn(LD_BUG, "%s", err);
+ tor_free(err);
+ }
+ return r;
}
-#endif /* defined(HAVE_LOCALTIME_R) || ... */
-/** @} */
-/** @{ */
/** As gmtime_r, but defined for platforms that don't have it:
*
* Convert *<b>timep</b> to a struct tm in UTC, and store the value in
* *<b>result</b>. Return the result on success, or NULL on failure.
*/
-#ifdef HAVE_GMTIME_R
-struct tm *
-tor_gmtime_r(const time_t *timep, struct tm *result)
-{
- struct tm *r;
- r = gmtime_r(timep, result);
- return correct_tm(0, timep, result, r);
-}
-#elif defined(TIME_FNS_NEED_LOCKS)
struct tm *
tor_gmtime_r(const time_t *timep, struct tm *result)
{
- struct tm *r;
- static tor_mutex_t *m=NULL;
- if (!m) { m=tor_mutex_new(); }
- tor_assert(result);
- tor_mutex_acquire(m);
- r = gmtime(timep);
- if (r)
- memcpy(result, r, sizeof(struct tm));
- tor_mutex_release(m);
- return correct_tm(0, timep, result, r);
-}
-#else
-struct tm *
-tor_gmtime_r(const time_t *timep, struct tm *result)
-{
- struct tm *r;
- tor_assert(result);
- r = gmtime(timep);
- if (r)
- memcpy(result, r, sizeof(struct tm));
- return correct_tm(0, timep, result, r);
+ char *err = NULL;
+ struct tm *r = tor_gmtime_r_msg(timep, result, &err);
+ if (err) {
+ log_warn(LD_BUG, "%s", err);
+ tor_free(err);
+ }
+ return r;
}
-#endif /* defined(HAVE_GMTIME_R) || ... */
#if defined(HAVE_MLOCKALL) && HAVE_DECL_MLOCKALL && defined(RLIMIT_MEMLOCK)
#define HAVE_UNIX_MLOCKALL
@@ -3528,4 +3074,3 @@ tor_get_avail_disk_space(const char *path)
return -1;
#endif /* defined(HAVE_STATVFS) || ... */
}
-
diff --git a/src/common/compat.h b/src/common/compat.h
index c7e7f8d9ef..691824a2e7 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -1,6 +1,6 @@
/* Copyright (c) 2003-2004, Roger Dingledine
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
#ifndef TOR_COMPAT_H
@@ -14,8 +14,8 @@
#define SIO_IDEAL_SEND_BACKLOG_QUERY 0x4004747b
#endif
#endif
-#include "torint.h"
-#include "testsupport.h"
+#include "lib/cc/torint.h"
+#include "lib/testsupport/testsupport.h"
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
@@ -45,272 +45,17 @@
#include <netinet6/in6.h>
#endif
-#include "compat_time.h"
-
-#if defined(__has_feature)
-# if __has_feature(address_sanitizer)
-/* Some of the fancy glibc strcmp() macros include references to memory that
- * clang rejects because it is off the end of a less-than-3. Clang hates this,
- * even though those references never actually happen. */
-# undef strcmp
-#endif /* __has_feature(address_sanitizer) */
-#endif /* defined(__has_feature) */
+#include "lib/cc/compat_compiler.h"
+#include "common/compat_time.h"
+#include "lib/string/compat_ctype.h"
+#include "lib/string/compat_string.h"
+#include "lib/string/printf.h"
#include <stdio.h>
#include <errno.h>
-#ifndef NULL_REP_IS_ZERO_BYTES
-#error "It seems your platform does not represent NULL as zero. We can't cope."
-#endif
-
-#ifndef DOUBLE_0_REP_IS_ZERO_BYTES
-#error "It seems your platform does not represent 0.0 as zeros. We can't cope."
-#endif
-
-#if 'a'!=97 || 'z'!=122 || 'A'!=65 || ' '!=32
-#error "It seems that you encode characters in something other than ASCII."
-#endif
-
/* ===== Compiler compatibility */
-/* GCC can check printf and scanf types on arbitrary functions. */
-#ifdef __GNUC__
-#define CHECK_PRINTF(formatIdx, firstArg) \
- __attribute__ ((format(printf, formatIdx, firstArg)))
-#else
-#define CHECK_PRINTF(formatIdx, firstArg)
-#endif /* defined(__GNUC__) */
-#ifdef __GNUC__
-#define CHECK_SCANF(formatIdx, firstArg) \
- __attribute__ ((format(scanf, formatIdx, firstArg)))
-#else
-#define CHECK_SCANF(formatIdx, firstArg)
-#endif /* defined(__GNUC__) */
-
-/* What GCC do we have? */
-#ifdef __GNUC__
-#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
-#else
-#define GCC_VERSION 0
-#endif
-
-/* Temporarily enable and disable warnings. */
-#ifdef __GNUC__
-# define PRAGMA_STRINGIFY_(s) #s
-# define PRAGMA_JOIN_STRINGIFY_(a,b) PRAGMA_STRINGIFY_(a ## b)
-/* Support for macro-generated pragmas (c99) */
-# define PRAGMA_(x) _Pragma (#x)
-# ifdef __clang__
-# define PRAGMA_DIAGNOSTIC_(x) PRAGMA_(clang diagnostic x)
-# else
-# define PRAGMA_DIAGNOSTIC_(x) PRAGMA_(GCC diagnostic x)
-# endif
-# if defined(__clang__) || GCC_VERSION >= 406
-/* we have push/pop support */
-# define DISABLE_GCC_WARNING(warningopt) \
- PRAGMA_DIAGNOSTIC_(push) \
- PRAGMA_DIAGNOSTIC_(ignored PRAGMA_JOIN_STRINGIFY_(-W,warningopt))
-# define ENABLE_GCC_WARNING(warningopt) \
- PRAGMA_DIAGNOSTIC_(pop)
-#else /* !(defined(__clang__) || GCC_VERSION >= 406) */
-/* older version of gcc: no push/pop support. */
-# define DISABLE_GCC_WARNING(warningopt) \
- PRAGMA_DIAGNOSTIC_(ignored PRAGMA_JOIN_STRINGIFY_(-W,warningopt))
-# define ENABLE_GCC_WARNING(warningopt) \
- PRAGMA_DIAGNOSTIC_(warning PRAGMA_JOIN_STRINGIFY_(-W,warningopt))
-#endif /* defined(__clang__) || GCC_VERSION >= 406 */
-#else /* !(defined(__GNUC__)) */
-/* not gcc at all */
-# define DISABLE_GCC_WARNING(warning)
-# define ENABLE_GCC_WARNING(warning)
-#endif /* defined(__GNUC__) */
-
-/* inline is __inline on windows. */
-#ifdef _WIN32
-#define inline __inline
-#endif
-
-/* Try to get a reasonable __func__ substitute in place. */
-#if defined(_MSC_VER)
-
-#define __func__ __FUNCTION__
-
-#else
-/* For platforms where autoconf works, make sure __func__ is defined
- * sanely. */
-#ifndef HAVE_MACRO__func__
-#ifdef HAVE_MACRO__FUNCTION__
-#define __func__ __FUNCTION__
-#elif HAVE_MACRO__FUNC__
-#define __func__ __FUNC__
-#else
-#define __func__ "???"
-#endif /* defined(HAVE_MACRO__FUNCTION__) || ... */
-#endif /* !defined(HAVE_MACRO__func__) */
-#endif /* defined(_MSC_VER) */
-
-#define U64_TO_DBL(x) ((double) (x))
-#define DBL_TO_U64(x) ((uint64_t) (x))
-
-#ifdef ENUM_VALS_ARE_SIGNED
-#define ENUM_BF(t) unsigned
-#else
-/** Wrapper for having a bitfield of an enumerated type. Where possible, we
- * just use the enumerated type (so the compiler can help us and notice
- * problems), but if enumerated types are unsigned, we must use unsigned,
- * so that the loss of precision doesn't make large values negative. */
-#define ENUM_BF(t) t
-#endif /* defined(ENUM_VALS_ARE_SIGNED) */
-
-/* GCC has several useful attributes. */
-#if defined(__GNUC__) && __GNUC__ >= 3
-#define ATTR_NORETURN __attribute__((noreturn))
-#define ATTR_CONST __attribute__((const))
-#define ATTR_MALLOC __attribute__((malloc))
-#define ATTR_NORETURN __attribute__((noreturn))
-#define ATTR_WUR __attribute__((warn_unused_result))
-/* Alas, nonnull is not at present a good idea for us. We'd like to get
- * warnings when we pass NULL where we shouldn't (which nonnull does, albeit
- * spottily), but we don't want to tell the compiler to make optimizations
- * with the assumption that the argument can't be NULL (since this would make
- * many of our checks go away, and make our code less robust against
- * programming errors). Unfortunately, nonnull currently does both of these
- * things, and there's no good way to split them up.
- *
- * #define ATTR_NONNULL(x) __attribute__((nonnull x)) */
-#define ATTR_NONNULL(x)
-#define ATTR_UNUSED __attribute__ ((unused))
-
-/** Macro: Evaluates to <b>exp</b> and hints the compiler that the value
- * of <b>exp</b> will probably be true.
- *
- * In other words, "if (PREDICT_LIKELY(foo))" is the same as "if (foo)",
- * except that it tells the compiler that the branch will be taken most of the
- * time. This can generate slightly better code with some CPUs.
- */
-#define PREDICT_LIKELY(exp) __builtin_expect(!!(exp), 1)
-/** Macro: Evaluates to <b>exp</b> and hints the compiler that the value
- * of <b>exp</b> will probably be false.
- *
- * In other words, "if (PREDICT_UNLIKELY(foo))" is the same as "if (foo)",
- * except that it tells the compiler that the branch will usually not be
- * taken. This can generate slightly better code with some CPUs.
- */
-#define PREDICT_UNLIKELY(exp) __builtin_expect(!!(exp), 0)
-#else /* !(defined(__GNUC__) && __GNUC__ >= 3) */
-#define ATTR_NORETURN
-#define ATTR_CONST
-#define ATTR_MALLOC
-#define ATTR_NORETURN
-#define ATTR_NONNULL(x)
-#define ATTR_UNUSED
-#define ATTR_WUR
-#define PREDICT_LIKELY(exp) (exp)
-#define PREDICT_UNLIKELY(exp) (exp)
-#endif /* defined(__GNUC__) && __GNUC__ >= 3 */
-
-/** Expands to a syntactically valid empty statement. */
-#define STMT_NIL (void)0
-
-/** Expands to a syntactically valid empty statement, explicitly (void)ing its
- * argument. */
-#define STMT_VOID(a) while (0) { (void)(a); }
-
-#ifdef __GNUC__
-/** STMT_BEGIN and STMT_END are used to wrap blocks inside macros so that
- * the macro can be used as if it were a single C statement. */
-#define STMT_BEGIN (void) ({
-#define STMT_END })
-#elif defined(sun) || defined(__sun__)
-#define STMT_BEGIN if (1) {
-#define STMT_END } else STMT_NIL
-#else
-#define STMT_BEGIN do {
-#define STMT_END } while (0)
-#endif /* defined(__GNUC__) || ... */
-
-/* Some tools (like coccinelle) don't like to see operators as macro
- * arguments. */
-#define OP_LT <
-#define OP_GT >
-#define OP_GE >=
-#define OP_LE <=
-#define OP_EQ ==
-#define OP_NE !=
-
-/* ===== String compatibility */
-#ifdef _WIN32
-/* Windows names string functions differently from most other platforms. */
-#define strncasecmp _strnicmp
-#define strcasecmp _stricmp
-#endif
-
-#if defined __APPLE__
-/* On OSX 10.9 and later, the overlap-checking code for strlcat would
- * appear to have a severe bug that can sometimes cause aborts in Tor.
- * Instead, use the non-checking variants. This is sad.
- *
- * See https://trac.torproject.org/projects/tor/ticket/15205
- */
-#undef strlcat
-#undef strlcpy
-#endif /* defined __APPLE__ */
-
-#ifndef HAVE_STRLCAT
-size_t strlcat(char *dst, const char *src, size_t siz) ATTR_NONNULL((1,2));
-#endif
-#ifndef HAVE_STRLCPY
-size_t strlcpy(char *dst, const char *src, size_t siz) ATTR_NONNULL((1,2));
-#endif
-
-#ifdef _MSC_VER
-/** Casts the uint64_t value in <b>a</b> to the right type for an argument
- * to printf. */
-#define U64_PRINTF_ARG(a) (a)
-/** Casts the uint64_t* value in <b>a</b> to the right type for an argument
- * to scanf. */
-#define U64_SCANF_ARG(a) (a)
-/** Expands to a literal uint64_t-typed constant for the value <b>n</b>. */
-#define U64_LITERAL(n) (n ## ui64)
-#define I64_PRINTF_ARG(a) (a)
-#define I64_SCANF_ARG(a) (a)
-#define I64_LITERAL(n) (n ## i64)
-#else /* !(defined(_MSC_VER)) */
-#define U64_PRINTF_ARG(a) ((long long unsigned int)(a))
-#define U64_SCANF_ARG(a) ((long long unsigned int*)(a))
-#define U64_LITERAL(n) (n ## llu)
-#define I64_PRINTF_ARG(a) ((long long signed int)(a))
-#define I64_SCANF_ARG(a) ((long long signed int*)(a))
-#define I64_LITERAL(n) (n ## ll)
-#endif /* defined(_MSC_VER) */
-
-#if defined(__MINGW32__) || defined(__MINGW64__)
-#define MINGW_ANY
-#endif
-
-#if defined(_MSC_VER) || defined(MINGW_ANY)
-/** The formatting string used to put a uint64_t value in a printf() or
- * scanf() function. See also U64_PRINTF_ARG and U64_SCANF_ARG. */
-#define U64_FORMAT "%I64u"
-#define I64_FORMAT "%I64d"
-#else /* !(defined(_MSC_VER) || defined(MINGW_ANY)) */
-#define U64_FORMAT "%llu"
-#define I64_FORMAT "%lld"
-#endif /* defined(_MSC_VER) || defined(MINGW_ANY) */
-
-#if (SIZEOF_INTPTR_T == SIZEOF_INT)
-#define INTPTR_T_FORMAT "%d"
-#define INTPTR_PRINTF_ARG(x) ((int)(x))
-#elif (SIZEOF_INTPTR_T == SIZEOF_LONG)
-#define INTPTR_T_FORMAT "%ld"
-#define INTPTR_PRINTF_ARG(x) ((long)(x))
-#elif (SIZEOF_INTPTR_T == 8)
-#define INTPTR_T_FORMAT I64_FORMAT
-#define INTPTR_PRINTF_ARG(x) I64_PRINTF_ARG(x)
-#else
-#error Unknown: SIZEOF_INTPTR_T
-#endif /* (SIZEOF_INTPTR_T == SIZEOF_INT) || ... */
-
/** Represents an mmaped file. Allocated via tor_mmap_file; freed with
* tor_munmap_file. */
typedef struct tor_mmap_t {
@@ -330,16 +75,6 @@ typedef struct tor_mmap_t {
tor_mmap_t *tor_mmap_file(const char *filename) ATTR_NONNULL((1));
int tor_munmap_file(tor_mmap_t *handle) ATTR_NONNULL((1));
-int tor_snprintf(char *str, size_t size, const char *format, ...)
- CHECK_PRINTF(3,4) ATTR_NONNULL((1,3));
-int tor_vsnprintf(char *str, size_t size, const char *format, va_list args)
- CHECK_PRINTF(3,0) ATTR_NONNULL((1,3));
-
-int tor_asprintf(char **strp, const char *fmt, ...)
- CHECK_PRINTF(2,3);
-int tor_vasprintf(char **strp, const char *fmt, va_list args)
- CHECK_PRINTF(2,0);
-
const void *tor_memmem(const void *haystack, size_t hlen, const void *needle,
size_t nlen) ATTR_NONNULL((1,3));
static const void *tor_memstr(const void *haystack, size_t hlen,
@@ -350,28 +85,6 @@ tor_memstr(const void *haystack, size_t hlen, const char *needle)
return tor_memmem(haystack, hlen, needle, strlen(needle));
}
-/* Much of the time when we're checking ctypes, we're doing spec compliance,
- * which all assumes we're doing ASCII. */
-#define DECLARE_CTYPE_FN(name) \
- static int TOR_##name(char c); \
- extern const uint32_t TOR_##name##_TABLE[]; \
- static inline int TOR_##name(char c) { \
- uint8_t u = c; \
- return !!(TOR_##name##_TABLE[(u >> 5) & 7] & (1u << (u & 31))); \
- }
-DECLARE_CTYPE_FN(ISALPHA)
-DECLARE_CTYPE_FN(ISALNUM)
-DECLARE_CTYPE_FN(ISSPACE)
-DECLARE_CTYPE_FN(ISDIGIT)
-DECLARE_CTYPE_FN(ISXDIGIT)
-DECLARE_CTYPE_FN(ISPRINT)
-DECLARE_CTYPE_FN(ISLOWER)
-DECLARE_CTYPE_FN(ISUPPER)
-extern const uint8_t TOR_TOUPPER_TABLE[];
-extern const uint8_t TOR_TOLOWER_TABLE[];
-#define TOR_TOLOWER(c) (TOR_TOLOWER_TABLE[(uint8_t)c])
-#define TOR_TOUPPER(c) (TOR_TOUPPER_TABLE[(uint8_t)c])
-
char *tor_strtok_r_impl(char *str, const char *sep, char **lasts);
#ifdef HAVE_STRTOK_R
#define tor_strtok_r(str, sep, lasts) strtok_r(str, sep, lasts)
@@ -379,14 +92,6 @@ char *tor_strtok_r_impl(char *str, const char *sep, char **lasts);
#define tor_strtok_r(str, sep, lasts) tor_strtok_r_impl(str, sep, lasts)
#endif
-#ifdef _WIN32
-#define SHORT_FILE__ (tor_fix_source_file(__FILE__))
-const char *tor_fix_source_file(const char *fname);
-#else
-#define SHORT_FILE__ (__FILE__)
-#define tor_fix_source_file(s) (s)
-#endif /* defined(_WIN32) */
-
/* ===== Time compatibility */
struct tm *tor_localtime_r(const time_t *timep, struct tm *result);
@@ -447,11 +152,6 @@ tor_lockfile_t *tor_lockfile_lock(const char *filename, int blocking,
int *locked_out);
void tor_lockfile_unlock(tor_lockfile_t *lockfile);
-off_t tor_fd_getpos(int fd);
-int tor_fd_setpos(int fd, off_t pos);
-int tor_fd_seekend(int fd);
-int tor_ftruncate(int fd);
-
int64_t tor_get_avail_disk_space(const char *path);
#ifdef _WIN32
@@ -751,7 +451,6 @@ STATIC int tor_ersatz_socketpair(int family, int type, int protocol,
ssize_t tor_getpass(const char *prompt, char *output, size_t buflen);
/* This needs some of the declarations above so we include it here. */
-#include "compat_threads.h"
+#include "common/compat_threads.h"
#endif /* !defined(TOR_COMPAT_H) */
-
diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c
index e60eb148d8..a0b9bc535f 100644
--- a/src/common/compat_libevent.c
+++ b/src/common/compat_libevent.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2017, The Tor Project, Inc. */
+/* Copyright (c) 2009-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -7,14 +7,14 @@
*/
#include "orconfig.h"
-#include "compat.h"
+#include "common/compat.h"
#define COMPAT_LIBEVENT_PRIVATE
-#include "compat_libevent.h"
+#include "common/compat_libevent.h"
-#include "crypto_rand.h"
+#include "lib/crypt_ops/crypto_rand.h"
-#include "util.h"
-#include "torlog.h"
+#include "common/util.h"
+#include "lib/log/torlog.h"
#include <event2/event.h>
#include <event2/thread.h>
diff --git a/src/common/compat_libevent.h b/src/common/compat_libevent.h
index 286a268122..4b2672b7b5 100644
--- a/src/common/compat_libevent.h
+++ b/src/common/compat_libevent.h
@@ -1,11 +1,11 @@
-/* Copyright (c) 2009-2017, The Tor Project, Inc. */
+/* Copyright (c) 2009-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
#ifndef TOR_COMPAT_LIBEVENT_H
#define TOR_COMPAT_LIBEVENT_H
#include "orconfig.h"
-#include "testsupport.h"
+#include "lib/testsupport/testsupport.h"
void configure_libevent_logging(void);
void suppress_libevent_log_msg(const char *msg);
diff --git a/src/common/compat_pthreads.c b/src/common/compat_pthreads.c
index 002274c469..e345cfef0f 100644
--- a/src/common/compat_pthreads.c
+++ b/src/common/compat_pthreads.c
@@ -1,6 +1,6 @@
/* Copyright (c) 2003-2004, Roger Dingledine
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -15,9 +15,9 @@
#include <signal.h>
#include <time.h>
-#include "compat.h"
-#include "torlog.h"
-#include "util.h"
+#include "common/compat.h"
+#include "lib/log/torlog.h"
+#include "common/util.h"
/** Wraps a void (*)(void*) function and its argument so we can
* invoke them in a way pthreads would expect.
@@ -91,88 +91,6 @@ spawn_exit(void)
pthread_exit(NULL);
}
-/** A mutex attribute that we're going to use to tell pthreads that we want
- * "recursive" mutexes (i.e., once we can re-lock if we're already holding
- * them.) */
-static pthread_mutexattr_t attr_recursive;
-
-/** Initialize <b>mutex</b> so it can be locked. Every mutex must be set
- * up with tor_mutex_init() or tor_mutex_new(); not both. */
-void
-tor_mutex_init(tor_mutex_t *mutex)
-{
- if (PREDICT_UNLIKELY(!threads_initialized))
- tor_threads_init(); // LCOV_EXCL_LINE
- const int err = pthread_mutex_init(&mutex->mutex, &attr_recursive);
- if (PREDICT_UNLIKELY(err)) {
- // LCOV_EXCL_START
- log_err(LD_GENERAL, "Error %d creating a mutex.", err);
- tor_assert_unreached();
- // LCOV_EXCL_STOP
- }
-}
-
-/** As tor_mutex_init, but initialize a mutex suitable that may be
- * non-recursive, if the OS supports that. */
-void
-tor_mutex_init_nonrecursive(tor_mutex_t *mutex)
-{
- int err;
- if (!threads_initialized)
- tor_threads_init(); // LCOV_EXCL_LINE
- err = pthread_mutex_init(&mutex->mutex, NULL);
- if (PREDICT_UNLIKELY(err)) {
- // LCOV_EXCL_START
- log_err(LD_GENERAL, "Error %d creating a mutex.", err);
- tor_assert_unreached();
- // LCOV_EXCL_STOP
- }
-}
-
-/** Wait until <b>m</b> is free, then acquire it. */
-void
-tor_mutex_acquire(tor_mutex_t *m)
-{
- int err;
- tor_assert(m);
- err = pthread_mutex_lock(&m->mutex);
- if (PREDICT_UNLIKELY(err)) {
- // LCOV_EXCL_START
- log_err(LD_GENERAL, "Error %d locking a mutex.", err);
- tor_assert_unreached();
- // LCOV_EXCL_STOP
- }
-}
-/** Release the lock <b>m</b> so another thread can have it. */
-void
-tor_mutex_release(tor_mutex_t *m)
-{
- int err;
- tor_assert(m);
- err = pthread_mutex_unlock(&m->mutex);
- if (PREDICT_UNLIKELY(err)) {
- // LCOV_EXCL_START
- log_err(LD_GENERAL, "Error %d unlocking a mutex.", err);
- tor_assert_unreached();
- // LCOV_EXCL_STOP
- }
-}
-/** Clean up the mutex <b>m</b> so that it no longer uses any system
- * resources. Does not free <b>m</b>. This function must only be called on
- * mutexes from tor_mutex_init(). */
-void
-tor_mutex_uninit(tor_mutex_t *m)
-{
- int err;
- tor_assert(m);
- err = pthread_mutex_destroy(&m->mutex);
- if (PREDICT_UNLIKELY(err)) {
- // LCOV_EXCL_START
- log_err(LD_GENERAL, "Error %d destroying a mutex.", err);
- tor_assert_unreached();
- // LCOV_EXCL_STOP
- }
-}
/** Return an integer representing this thread. */
unsigned long
tor_get_thread_id(void)
@@ -333,8 +251,7 @@ void
tor_threads_init(void)
{
if (!threads_initialized) {
- pthread_mutexattr_init(&attr_recursive);
- pthread_mutexattr_settype(&attr_recursive, PTHREAD_MUTEX_RECURSIVE);
+ tor_locking_init();
const int ret1 = pthread_attr_init(&attr_detached);
tor_assert(ret1 == 0);
#ifndef PTHREAD_CREATE_DETACHED
@@ -347,4 +264,3 @@ tor_threads_init(void)
set_main_thread();
}
}
-
diff --git a/src/common/compat_threads.c b/src/common/compat_threads.c
index 3171c4b2f2..e66143b35c 100644
--- a/src/common/compat_threads.c
+++ b/src/common/compat_threads.c
@@ -1,6 +1,6 @@
/* Copyright (c) 2003-2004, Roger Dingledine
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -13,11 +13,11 @@
#include "orconfig.h"
#include <stdlib.h>
-#include "compat.h"
-#include "compat_threads.h"
+#include "common/compat.h"
+#include "common/compat_threads.h"
-#include "util.h"
-#include "torlog.h"
+#include "common/util.h"
+#include "lib/log/torlog.h"
#ifdef HAVE_SYS_EVENTFD_H
#include <sys/eventfd.h>
@@ -29,33 +29,6 @@
#include <unistd.h>
#endif
-/** Return a newly allocated, ready-for-use mutex. */
-tor_mutex_t *
-tor_mutex_new(void)
-{
- tor_mutex_t *m = tor_malloc_zero(sizeof(tor_mutex_t));
- tor_mutex_init(m);
- return m;
-}
-/** Return a newly allocated, ready-for-use mutex. This one might be
- * non-recursive, if that's faster. */
-tor_mutex_t *
-tor_mutex_new_nonrecursive(void)
-{
- tor_mutex_t *m = tor_malloc_zero(sizeof(tor_mutex_t));
- tor_mutex_init_nonrecursive(m);
- return m;
-}
-/** Release all storage and system resources held by <b>m</b>. */
-void
-tor_mutex_free_(tor_mutex_t *m)
-{
- if (!m)
- return;
- tor_mutex_uninit(m);
- tor_free(m);
-}
-
/** Allocate and return a new condition variable. */
tor_cond_t *
tor_cond_new(void)
@@ -404,4 +377,3 @@ atomic_counter_exchange(atomic_counter_t *counter, size_t newval)
return oldval;
}
#endif /* !defined(HAVE_STDATOMIC_H) */
-
diff --git a/src/common/compat_threads.h b/src/common/compat_threads.h
index c93e601ec5..d1fdfc96cc 100644
--- a/src/common/compat_threads.h
+++ b/src/common/compat_threads.h
@@ -1,62 +1,23 @@
/* Copyright (c) 2003-2004, Roger Dingledine
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
#ifndef TOR_COMPAT_THREADS_H
#define TOR_COMPAT_THREADS_H
#include "orconfig.h"
-#include "torint.h"
-#include "testsupport.h"
-
-#if defined(HAVE_PTHREAD_H) && !defined(_WIN32)
-#include <pthread.h>
-#endif
+#include "lib/cc/torint.h"
+#include "lib/testsupport/testsupport.h"
+#include "lib/lock/compat_mutex.h"
#ifdef HAVE_STDATOMIC_H
#include <stdatomic.h>
#endif
-#if defined(_WIN32)
-#define USE_WIN32_THREADS
-#elif defined(HAVE_PTHREAD_H) && defined(HAVE_PTHREAD_CREATE)
-#define USE_PTHREADS
-#else
-#error "No threading system was found"
-#endif /* defined(_WIN32) || ... */
-
int spawn_func(void (*func)(void *), void *data);
void spawn_exit(void) ATTR_NORETURN;
-/* Because we use threads instead of processes on most platforms (Windows,
- * Linux, etc), we need locking for them. On platforms with poor thread
- * support or broken gethostbyname_r, these functions are no-ops. */
-
-/** A generic lock structure for multithreaded builds. */
-typedef struct tor_mutex_t {
-#if defined(USE_WIN32_THREADS)
- /** Windows-only: on windows, we implement locks with CRITICAL_SECTIONS. */
- CRITICAL_SECTION mutex;
-#elif defined(USE_PTHREADS)
- /** Pthreads-only: with pthreads, we implement locks with
- * pthread_mutex_t. */
- pthread_mutex_t mutex;
-#else
- /** No-threads only: Dummy variable so that tor_mutex_t takes up space. */
- int _unused;
-#endif /* defined(USE_WIN32_THREADS) || ... */
-} tor_mutex_t;
-
-tor_mutex_t *tor_mutex_new(void);
-tor_mutex_t *tor_mutex_new_nonrecursive(void);
-void tor_mutex_init(tor_mutex_t *m);
-void tor_mutex_init_nonrecursive(tor_mutex_t *m);
-void tor_mutex_acquire(tor_mutex_t *m);
-void tor_mutex_release(tor_mutex_t *m);
-void tor_mutex_free_(tor_mutex_t *m);
-#define tor_mutex_free(m) FREE_AND_NULL(tor_mutex_t, tor_mutex_free_, (m))
-void tor_mutex_uninit(tor_mutex_t *m);
unsigned long tor_get_thread_id(void);
void tor_threads_init(void);
@@ -220,4 +181,3 @@ atomic_counter_exchange(atomic_counter_t *counter, size_t newval)
#endif /* defined(HAVE_STDATOMIC_H) */
#endif /* !defined(TOR_COMPAT_THREADS_H) */
-
diff --git a/src/common/compat_time.c b/src/common/compat_time.c
index 40847a8442..148f2f8957 100644
--- a/src/common/compat_time.c
+++ b/src/common/compat_time.c
@@ -1,6 +1,6 @@
/* Copyright (c) 2003-2004, Roger Dingledine
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -10,7 +10,7 @@
**/
#define COMPAT_TIME_PRIVATE
-#include "compat.h"
+#include "common/compat.h"
#ifdef _WIN32
#include <winsock2.h>
@@ -34,15 +34,9 @@
#include <mach/mach_time.h>
#endif
-#include "torlog.h"
-#include "util.h"
-#include "container.h"
-
-#ifndef HAVE_GETTIMEOFDAY
-#ifdef HAVE_FTIME
-#include <sys/timeb.h>
-#endif
-#endif
+#include "lib/err/torerr.h"
+#include "lib/log/torlog.h"
+#include "common/util.h"
#ifdef _WIN32
#undef HAVE_CLOCK_GETTIME
@@ -68,54 +62,6 @@ tor_sleep_msec(int msec)
}
#endif /* defined(TOR_UNIT_TESTS) */
-/** Set *timeval to the current time of day. On error, log and terminate.
- * (Same as gettimeofday(timeval,NULL), but never returns -1.)
- */
-MOCK_IMPL(void,
-tor_gettimeofday, (struct timeval *timeval))
-{
-#ifdef _WIN32
- /* Epoch bias copied from perl: number of units between windows epoch and
- * Unix epoch. */
-#define EPOCH_BIAS U64_LITERAL(116444736000000000)
-#define UNITS_PER_SEC U64_LITERAL(10000000)
-#define USEC_PER_SEC U64_LITERAL(1000000)
-#define UNITS_PER_USEC U64_LITERAL(10)
- union {
- uint64_t ft_64;
- FILETIME ft_ft;
- } ft;
- /* number of 100-nsec units since Jan 1, 1601 */
- GetSystemTimeAsFileTime(&ft.ft_ft);
- if (ft.ft_64 < EPOCH_BIAS) {
- /* LCOV_EXCL_START */
- log_err(LD_GENERAL,"System time is before 1970; failing.");
- exit(1); // exit ok: system clock is broken.
- /* LCOV_EXCL_STOP */
- }
- ft.ft_64 -= EPOCH_BIAS;
- timeval->tv_sec = (unsigned) (ft.ft_64 / UNITS_PER_SEC);
- timeval->tv_usec = (unsigned) ((ft.ft_64 / UNITS_PER_USEC) % USEC_PER_SEC);
-#elif defined(HAVE_GETTIMEOFDAY)
- if (gettimeofday(timeval, NULL)) {
- /* LCOV_EXCL_START */
- log_err(LD_GENERAL,"gettimeofday failed.");
- /* If gettimeofday dies, we have either given a bad timezone (we didn't),
- or segfaulted.*/
- exit(1); // exit ok: gettimeofday failed.
- /* LCOV_EXCL_STOP */
- }
-#elif defined(HAVE_FTIME)
- struct timeb tb;
- ftime(&tb);
- timeval->tv_sec = tb.time;
- timeval->tv_usec = tb.millitm * 1000;
-#else
-#error "No way to get time."
-#endif /* defined(_WIN32) || ... */
- return;
-}
-
#define ONE_MILLION ((int64_t) (1000 * 1000))
#define ONE_BILLION ((int64_t) (1000 * 1000 * 1000))
@@ -900,4 +846,3 @@ monotime_msec_to_approx_coarse_stamp_units(uint64_t msec)
return (msec * STAMP_TICKS_PER_SECOND) / 1000;
}
#endif
-
diff --git a/src/common/compat_time.h b/src/common/compat_time.h
index 57ab20ab11..2f7e87a633 100644
--- a/src/common/compat_time.h
+++ b/src/common/compat_time.h
@@ -1,6 +1,6 @@
/* Copyright (c) 2003-2004, Roger Dingledine
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -19,6 +19,8 @@
#define TOR_COMPAT_TIME_H
#include "orconfig.h"
+#include "lib/wallclock/tor_gettimeofday.h"
+
#ifdef _WIN32
#undef HAVE_CLOCK_GETTIME
#endif
@@ -200,8 +202,6 @@ monotime_coarse_diff_msec32(const monotime_coarse_t *start,
#endif
}
-MOCK_DECL(void, tor_gettimeofday, (struct timeval *timeval));
-
#ifdef TOR_UNIT_TESTS
void tor_sleep_msec(int msec);
@@ -230,4 +230,3 @@ void monotime_reset_ratchets_for_testing(void);
#endif /* defined(COMPAT_TIME_PRIVATE) */
#endif /* !defined(TOR_COMPAT_TIME_H) */
-
diff --git a/src/common/compat_winthreads.c b/src/common/compat_winthreads.c
index 7021344f6e..d082af31c9 100644
--- a/src/common/compat_winthreads.c
+++ b/src/common/compat_winthreads.c
@@ -1,6 +1,6 @@
/* Copyright (c) 2003-2004, Roger Dingledine
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -12,12 +12,11 @@
#ifdef _WIN32
-#include "compat.h"
+#include "common/compat.h"
#include <windows.h>
#include <process.h>
-#include "util.h"
-#include "container.h"
-#include "torlog.h"
+#include "common/util.h"
+#include "lib/log/torlog.h"
/* This value is more or less total cargo-cult */
#define SPIN_COUNT 2000
@@ -55,33 +54,6 @@ spawn_exit(void)
// LCOV_EXCL_STOP
}
-void
-tor_mutex_init(tor_mutex_t *m)
-{
- InitializeCriticalSection(&m->mutex);
-}
-void
-tor_mutex_init_nonrecursive(tor_mutex_t *m)
-{
- InitializeCriticalSection(&m->mutex);
-}
-
-void
-tor_mutex_uninit(tor_mutex_t *m)
-{
- DeleteCriticalSection(&m->mutex);
-}
-void
-tor_mutex_acquire(tor_mutex_t *m)
-{
- tor_assert(m);
- EnterCriticalSection(&m->mutex);
-}
-void
-tor_mutex_release(tor_mutex_t *m)
-{
- LeaveCriticalSection(&m->mutex);
-}
unsigned long
tor_get_thread_id(void)
{
@@ -248,4 +220,3 @@ tor_threads_init(void)
}
#endif /* defined(_WIN32) */
-
diff --git a/src/common/confline.c b/src/common/confline.c
index bf613ab742..9e37bfbdb7 100644
--- a/src/common/confline.c
+++ b/src/common/confline.c
@@ -1,14 +1,14 @@
/* Copyright (c) 2001 Matej Pfajfar.
* Copyright (c) 2001-2004, Roger Dingledine.
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
-#include "compat.h"
-#include "confline.h"
-#include "torlog.h"
-#include "util.h"
-#include "container.h"
+#include "common/compat.h"
+#include "common/confline.h"
+#include "lib/log/torlog.h"
+#include "common/util.h"
+#include "lib/container/smartlist.h"
static int config_get_lines_aux(const char *string, config_line_t **result,
int extended, int allow_include,
@@ -535,4 +535,3 @@ parse_config_line_from_str_verbose(const char *line, char **key_out,
return line;
}
-
diff --git a/src/common/confline.h b/src/common/confline.h
index 772a9bbbdc..d1f6fdb7e5 100644
--- a/src/common/confline.h
+++ b/src/common/confline.h
@@ -1,13 +1,13 @@
/* Copyright (c) 2001 Matej Pfajfar.
* Copyright (c) 2001-2004, Roger Dingledine.
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
#ifndef TOR_CONFLINE_H
#define TOR_CONFLINE_H
-#include "container.h"
+struct smartlist_t;
/** Ordinary configuration line. */
#define CONFIG_LINE_NORMAL 0
@@ -47,7 +47,7 @@ int config_count_key(const config_line_t *a, const char *key);
int config_get_lines(const char *string, config_line_t **result, int extended);
int config_get_lines_include(const char *string, config_line_t **result,
int extended, int *has_include,
- smartlist_t *opened_lst);
+ struct smartlist_t *opened_lst);
void config_free_lines_(config_line_t *front);
#define config_free_lines(front) \
do { \
@@ -58,4 +58,3 @@ const char *parse_config_line_from_str_verbose(const char *line,
char **key_out, char **value_out,
const char **err_out);
#endif /* !defined(TOR_CONFLINE_H) */
-
diff --git a/src/common/container.h b/src/common/container.h
deleted file mode 100644
index 5d2dce5416..0000000000
--- a/src/common/container.h
+++ /dev/null
@@ -1,742 +0,0 @@
-/* Copyright (c) 2003-2004, Roger Dingledine
- * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
-/* See LICENSE for licensing information */
-
-#ifndef TOR_CONTAINER_H
-#define TOR_CONTAINER_H
-
-#include "util.h"
-#include "siphash.h"
-
-/** A resizeable list of pointers, with associated helpful functionality.
- *
- * The members of this struct are exposed only so that macros and inlines can
- * use them; all access to smartlist internals should go through the functions
- * and macros defined here.
- **/
-typedef struct smartlist_t {
- /** @{ */
- /** <b>list</b> has enough capacity to store exactly <b>capacity</b> elements
- * before it needs to be resized. Only the first <b>num_used</b> (\<=
- * capacity) elements point to valid data.
- */
- void **list;
- int num_used;
- int capacity;
- /** @} */
-} smartlist_t;
-
-MOCK_DECL(smartlist_t *, smartlist_new, (void));
-MOCK_DECL(void, smartlist_free_, (smartlist_t *sl));
-#define smartlist_free(sl) FREE_AND_NULL(smartlist_t, smartlist_free_, (sl))
-
-void smartlist_clear(smartlist_t *sl);
-void smartlist_add(smartlist_t *sl, void *element);
-void smartlist_add_all(smartlist_t *sl, const smartlist_t *s2);
-void smartlist_remove(smartlist_t *sl, const void *element);
-void smartlist_remove_keeporder(smartlist_t *sl, const void *element);
-void *smartlist_pop_last(smartlist_t *sl);
-void smartlist_reverse(smartlist_t *sl);
-void smartlist_string_remove(smartlist_t *sl, const char *element);
-int smartlist_contains(const smartlist_t *sl, const void *element);
-int smartlist_contains_string(const smartlist_t *sl, const char *element);
-int smartlist_pos(const smartlist_t *sl, const void *element);
-int smartlist_string_pos(const smartlist_t *, const char *elt);
-int smartlist_contains_string_case(const smartlist_t *sl, const char *element);
-int smartlist_contains_int_as_string(const smartlist_t *sl, int num);
-int smartlist_strings_eq(const smartlist_t *sl1, const smartlist_t *sl2);
-int smartlist_contains_digest(const smartlist_t *sl, const char *element);
-int smartlist_ints_eq(const smartlist_t *sl1, const smartlist_t *sl2);
-int smartlist_overlap(const smartlist_t *sl1, const smartlist_t *sl2);
-void smartlist_intersect(smartlist_t *sl1, const smartlist_t *sl2);
-void smartlist_subtract(smartlist_t *sl1, const smartlist_t *sl2);
-
-/* smartlist_choose() is defined in crypto.[ch] */
-#ifdef DEBUG_SMARTLIST
-/** Return the number of items in sl.
- */
-static inline int smartlist_len(const smartlist_t *sl);
-static inline int smartlist_len(const smartlist_t *sl) {
- tor_assert(sl);
- return (sl)->num_used;
-}
-/** Return the <b>idx</b>th element of sl.
- */
-static inline void *smartlist_get(const smartlist_t *sl, int idx);
-static inline void *smartlist_get(const smartlist_t *sl, int idx) {
- tor_assert(sl);
- tor_assert(idx>=0);
- tor_assert(sl->num_used > idx);
- return sl->list[idx];
-}
-static inline void smartlist_set(smartlist_t *sl, int idx, void *val) {
- tor_assert(sl);
- tor_assert(idx>=0);
- tor_assert(sl->num_used > idx);
- sl->list[idx] = val;
-}
-#else /* !(defined(DEBUG_SMARTLIST)) */
-#define smartlist_len(sl) ((sl)->num_used)
-#define smartlist_get(sl, idx) ((sl)->list[idx])
-#define smartlist_set(sl, idx, val) ((sl)->list[idx] = (val))
-#endif /* defined(DEBUG_SMARTLIST) */
-
-/** Exchange the elements at indices <b>idx1</b> and <b>idx2</b> of the
- * smartlist <b>sl</b>. */
-static inline void smartlist_swap(smartlist_t *sl, int idx1, int idx2)
-{
- if (idx1 != idx2) {
- void *elt = smartlist_get(sl, idx1);
- smartlist_set(sl, idx1, smartlist_get(sl, idx2));
- smartlist_set(sl, idx2, elt);
- }
-}
-
-void smartlist_del(smartlist_t *sl, int idx);
-void smartlist_del_keeporder(smartlist_t *sl, int idx);
-void smartlist_insert(smartlist_t *sl, int idx, void *val);
-void smartlist_sort(smartlist_t *sl,
- int (*compare)(const void **a, const void **b));
-void *smartlist_get_most_frequent_(const smartlist_t *sl,
- int (*compare)(const void **a, const void **b),
- int *count_out);
-#define smartlist_get_most_frequent(sl, compare) \
- smartlist_get_most_frequent_((sl), (compare), NULL)
-void smartlist_uniq(smartlist_t *sl,
- int (*compare)(const void **a, const void **b),
- void (*free_fn)(void *elt));
-
-void smartlist_sort_strings(smartlist_t *sl);
-void smartlist_sort_digests(smartlist_t *sl);
-void smartlist_sort_digests256(smartlist_t *sl);
-void smartlist_sort_pointers(smartlist_t *sl);
-
-const char *smartlist_get_most_frequent_string(smartlist_t *sl);
-const char *smartlist_get_most_frequent_string_(smartlist_t *sl,
- int *count_out);
-const uint8_t *smartlist_get_most_frequent_digest256(smartlist_t *sl);
-
-void smartlist_uniq_strings(smartlist_t *sl);
-void smartlist_uniq_digests(smartlist_t *sl);
-void smartlist_uniq_digests256(smartlist_t *sl);
-void *smartlist_bsearch(smartlist_t *sl, const void *key,
- int (*compare)(const void *key, const void **member));
-int smartlist_bsearch_idx(const smartlist_t *sl, const void *key,
- int (*compare)(const void *key, const void **member),
- int *found_out);
-
-void smartlist_pqueue_add(smartlist_t *sl,
- int (*compare)(const void *a, const void *b),
- int idx_field_offset,
- void *item);
-void *smartlist_pqueue_pop(smartlist_t *sl,
- int (*compare)(const void *a, const void *b),
- int idx_field_offset);
-void smartlist_pqueue_remove(smartlist_t *sl,
- int (*compare)(const void *a, const void *b),
- int idx_field_offset,
- void *item);
-void smartlist_pqueue_assert_ok(smartlist_t *sl,
- int (*compare)(const void *a, const void *b),
- int idx_field_offset);
-
-#define SPLIT_SKIP_SPACE 0x01
-#define SPLIT_IGNORE_BLANK 0x02
-#define SPLIT_STRIP_SPACE 0x04
-int smartlist_split_string(smartlist_t *sl, const char *str, const char *sep,
- int flags, int max);
-char *smartlist_join_strings(smartlist_t *sl, const char *join, int terminate,
- size_t *len_out) ATTR_MALLOC;
-char *smartlist_join_strings2(smartlist_t *sl, const char *join,
- size_t join_len, int terminate, size_t *len_out)
- ATTR_MALLOC;
-
-/** Iterate over the items in a smartlist <b>sl</b>, in order. For each item,
- * assign it to a new local variable of type <b>type</b> named <b>var</b>, and
- * execute the statements inside the loop body. Inside the loop, the loop
- * index can be accessed as <b>var</b>_sl_idx and the length of the list can
- * be accessed as <b>var</b>_sl_len.
- *
- * NOTE: Do not change the length of the list while the loop is in progress,
- * unless you adjust the _sl_len variable correspondingly. See second example
- * below.
- *
- * Example use:
- * <pre>
- * smartlist_t *list = smartlist_split("A:B:C", ":", 0, 0);
- * SMARTLIST_FOREACH_BEGIN(list, char *, cp) {
- * printf("%d: %s\n", cp_sl_idx, cp);
- * tor_free(cp);
- * } SMARTLIST_FOREACH_END(cp);
- * smartlist_free(list);
- * </pre>
- *
- * Example use (advanced):
- * <pre>
- * SMARTLIST_FOREACH_BEGIN(list, char *, cp) {
- * if (!strcmp(cp, "junk")) {
- * tor_free(cp);
- * SMARTLIST_DEL_CURRENT(list, cp);
- * }
- * } SMARTLIST_FOREACH_END(cp);
- * </pre>
- */
-/* Note: these macros use token pasting, and reach into smartlist internals.
- * This can make them a little daunting. Here's the approximate unpacking of
- * the above examples, for entertainment value:
- *
- * <pre>
- * smartlist_t *list = smartlist_split("A:B:C", ":", 0, 0);
- * {
- * int cp_sl_idx, cp_sl_len = smartlist_len(list);
- * char *cp;
- * for (cp_sl_idx = 0; cp_sl_idx < cp_sl_len; ++cp_sl_idx) {
- * cp = smartlist_get(list, cp_sl_idx);
- * printf("%d: %s\n", cp_sl_idx, cp);
- * tor_free(cp);
- * }
- * }
- * smartlist_free(list);
- * </pre>
- *
- * <pre>
- * {
- * int cp_sl_idx, cp_sl_len = smartlist_len(list);
- * char *cp;
- * for (cp_sl_idx = 0; cp_sl_idx < cp_sl_len; ++cp_sl_idx) {
- * cp = smartlist_get(list, cp_sl_idx);
- * if (!strcmp(cp, "junk")) {
- * tor_free(cp);
- * smartlist_del(list, cp_sl_idx);
- * --cp_sl_idx;
- * --cp_sl_len;
- * }
- * }
- * }
- * </pre>
- */
-#define SMARTLIST_FOREACH_BEGIN(sl, type, var) \
- STMT_BEGIN \
- int var ## _sl_idx, var ## _sl_len=(sl)->num_used; \
- type var; \
- for (var ## _sl_idx = 0; var ## _sl_idx < var ## _sl_len; \
- ++var ## _sl_idx) { \
- var = (sl)->list[var ## _sl_idx];
-
-#define SMARTLIST_FOREACH_END(var) \
- var = NULL; \
- (void) var ## _sl_idx; \
- } STMT_END
-
-/**
- * An alias for SMARTLIST_FOREACH_BEGIN and SMARTLIST_FOREACH_END, using
- * <b>cmd</b> as the loop body. This wrapper is here for convenience with
- * very short loops.
- *
- * By convention, we do not use this for loops which nest, or for loops over
- * 10 lines or so. Use SMARTLIST_FOREACH_{BEGIN,END} for those.
- */
-#define SMARTLIST_FOREACH(sl, type, var, cmd) \
- SMARTLIST_FOREACH_BEGIN(sl,type,var) { \
- cmd; \
- } SMARTLIST_FOREACH_END(var)
-
-/** Helper: While in a SMARTLIST_FOREACH loop over the list <b>sl</b> indexed
- * with the variable <b>var</b>, remove the current element in a way that
- * won't confuse the loop. */
-#define SMARTLIST_DEL_CURRENT(sl, var) \
- STMT_BEGIN \
- smartlist_del(sl, var ## _sl_idx); \
- --var ## _sl_idx; \
- --var ## _sl_len; \
- STMT_END
-
-/** Helper: While in a SMARTLIST_FOREACH loop over the list <b>sl</b> indexed
- * with the variable <b>var</b>, remove the current element in a way that
- * won't confuse the loop. */
-#define SMARTLIST_DEL_CURRENT_KEEPORDER(sl, var) \
- STMT_BEGIN \
- smartlist_del_keeporder(sl, var ## _sl_idx); \
- --var ## _sl_idx; \
- --var ## _sl_len; \
- STMT_END
-
-/** Helper: While in a SMARTLIST_FOREACH loop over the list <b>sl</b> indexed
- * with the variable <b>var</b>, replace the current element with <b>val</b>.
- * Does not deallocate the current value of <b>var</b>.
- */
-#define SMARTLIST_REPLACE_CURRENT(sl, var, val) \
- STMT_BEGIN \
- smartlist_set(sl, var ## _sl_idx, val); \
- STMT_END
-
-/* Helper: Given two lists of items, possibly of different types, such that
- * both lists are sorted on some common field (as determined by a comparison
- * expression <b>cmpexpr</b>), and such that one list (<b>sl1</b>) has no
- * duplicates on the common field, loop through the lists in lockstep, and
- * execute <b>unmatched_var2</b> on items in var2 that do not appear in
- * var1.
- *
- * WARNING: It isn't safe to add remove elements from either list while the
- * loop is in progress.
- *
- * Example use:
- * SMARTLIST_FOREACH_JOIN(routerstatus_list, routerstatus_t *, rs,
- * routerinfo_list, routerinfo_t *, ri,
- * tor_memcmp(rs->identity_digest, ri->identity_digest, 20),
- * log_info(LD_GENERAL,"No match for %s", ri->nickname)) {
- * log_info(LD_GENERAL, "%s matches routerstatus %p", ri->nickname, rs);
- * } SMARTLIST_FOREACH_JOIN_END(rs, ri);
- **/
-/* The example above unpacks (approximately) to:
- * int rs_sl_idx = 0, rs_sl_len = smartlist_len(routerstatus_list);
- * int ri_sl_idx, ri_sl_len = smartlist_len(routerinfo_list);
- * int rs_ri_cmp;
- * routerstatus_t *rs;
- * routerinfo_t *ri;
- * for (; ri_sl_idx < ri_sl_len; ++ri_sl_idx) {
- * ri = smartlist_get(routerinfo_list, ri_sl_idx);
- * while (rs_sl_idx < rs_sl_len) {
- * rs = smartlist_get(routerstatus_list, rs_sl_idx);
- * rs_ri_cmp = tor_memcmp(rs->identity_digest, ri->identity_digest, 20);
- * if (rs_ri_cmp > 0) {
- * break;
- * } else if (rs_ri_cmp == 0) {
- * goto matched_ri;
- * } else {
- * ++rs_sl_idx;
- * }
- * }
- * log_info(LD_GENERAL,"No match for %s", ri->nickname);
- * continue;
- * matched_ri: {
- * log_info(LD_GENERAL,"%s matches with routerstatus %p",ri->nickname,rs);
- * }
- * }
- */
-#define SMARTLIST_FOREACH_JOIN(sl1, type1, var1, sl2, type2, var2, \
- cmpexpr, unmatched_var2) \
- STMT_BEGIN \
- int var1 ## _sl_idx = 0, var1 ## _sl_len=(sl1)->num_used; \
- int var2 ## _sl_idx = 0, var2 ## _sl_len=(sl2)->num_used; \
- int var1 ## _ ## var2 ## _cmp; \
- type1 var1; \
- type2 var2; \
- for (; var2##_sl_idx < var2##_sl_len; ++var2##_sl_idx) { \
- var2 = (sl2)->list[var2##_sl_idx]; \
- while (var1##_sl_idx < var1##_sl_len) { \
- var1 = (sl1)->list[var1##_sl_idx]; \
- var1##_##var2##_cmp = (cmpexpr); \
- if (var1##_##var2##_cmp > 0) { \
- break; \
- } else if (var1##_##var2##_cmp == 0) { \
- goto matched_##var2; \
- } else { \
- ++var1##_sl_idx; \
- } \
- } \
- /* Ran out of v1, or no match for var2. */ \
- unmatched_var2; \
- continue; \
- matched_##var2: ; \
-
-#define SMARTLIST_FOREACH_JOIN_END(var1, var2) \
- } \
- STMT_END
-
-#define DECLARE_MAP_FNS(maptype, keytype, prefix) \
- typedef struct maptype maptype; \
- typedef struct prefix##entry_t *prefix##iter_t; \
- MOCK_DECL(maptype*, prefix##new, (void)); \
- void* prefix##set(maptype *map, keytype key, void *val); \
- void* prefix##get(const maptype *map, keytype key); \
- void* prefix##remove(maptype *map, keytype key); \
- MOCK_DECL(void, prefix##free_, (maptype *map, void (*free_val)(void*))); \
- int prefix##isempty(const maptype *map); \
- int prefix##size(const maptype *map); \
- prefix##iter_t *prefix##iter_init(maptype *map); \
- prefix##iter_t *prefix##iter_next(maptype *map, prefix##iter_t *iter); \
- prefix##iter_t *prefix##iter_next_rmv(maptype *map, prefix##iter_t *iter); \
- void prefix##iter_get(prefix##iter_t *iter, keytype *keyp, void **valp); \
- int prefix##iter_done(prefix##iter_t *iter); \
- void prefix##assert_ok(const maptype *map)
-
-/* Map from const char * to void *. Implemented with a hash table. */
-DECLARE_MAP_FNS(strmap_t, const char *, strmap_);
-/* Map from const char[DIGEST_LEN] to void *. Implemented with a hash table. */
-DECLARE_MAP_FNS(digestmap_t, const char *, digestmap_);
-/* Map from const uint8_t[DIGEST256_LEN] to void *. Implemented with a hash
- * table. */
-DECLARE_MAP_FNS(digest256map_t, const uint8_t *, digest256map_);
-
-#define MAP_FREE_AND_NULL(maptype, map, fn) \
- do { \
- maptype ## _free_((map), (fn)); \
- (map) = NULL; \
- } while (0)
-
-#define strmap_free(map, fn) MAP_FREE_AND_NULL(strmap, (map), (fn))
-#define digestmap_free(map, fn) MAP_FREE_AND_NULL(digestmap, (map), (fn))
-#define digest256map_free(map, fn) MAP_FREE_AND_NULL(digest256map, (map), (fn))
-
-#undef DECLARE_MAP_FNS
-
-/** Iterates over the key-value pairs in a map <b>map</b> in order.
- * <b>prefix</b> is as for DECLARE_MAP_FNS (i.e., strmap_ or digestmap_).
- * The map's keys and values are of type keytype and valtype respectively;
- * each iteration assigns them to keyvar and valvar.
- *
- * Example use:
- * MAP_FOREACH(digestmap_, m, const char *, k, routerinfo_t *, r) {
- * // use k and r
- * } MAP_FOREACH_END.
- */
-/* Unpacks to, approximately:
- * {
- * digestmap_iter_t *k_iter;
- * for (k_iter = digestmap_iter_init(m); !digestmap_iter_done(k_iter);
- * k_iter = digestmap_iter_next(m, k_iter)) {
- * const char *k;
- * void *r_voidp;
- * routerinfo_t *r;
- * digestmap_iter_get(k_iter, &k, &r_voidp);
- * r = r_voidp;
- * // use k and r
- * }
- * }
- */
-#define MAP_FOREACH(prefix, map, keytype, keyvar, valtype, valvar) \
- STMT_BEGIN \
- prefix##iter_t *keyvar##_iter; \
- for (keyvar##_iter = prefix##iter_init(map); \
- !prefix##iter_done(keyvar##_iter); \
- keyvar##_iter = prefix##iter_next(map, keyvar##_iter)) { \
- keytype keyvar; \
- void *valvar##_voidp; \
- valtype valvar; \
- prefix##iter_get(keyvar##_iter, &keyvar, &valvar##_voidp); \
- valvar = valvar##_voidp;
-
-/** As MAP_FOREACH, except allows members to be removed from the map
- * during the iteration via MAP_DEL_CURRENT. Example use:
- *
- * Example use:
- * MAP_FOREACH(digestmap_, m, const char *, k, routerinfo_t *, r) {
- * if (is_very_old(r))
- * MAP_DEL_CURRENT(k);
- * } MAP_FOREACH_END.
- **/
-/* Unpacks to, approximately:
- * {
- * digestmap_iter_t *k_iter;
- * int k_del=0;
- * for (k_iter = digestmap_iter_init(m); !digestmap_iter_done(k_iter);
- * k_iter = k_del ? digestmap_iter_next(m, k_iter)
- * : digestmap_iter_next_rmv(m, k_iter)) {
- * const char *k;
- * void *r_voidp;
- * routerinfo_t *r;
- * k_del=0;
- * digestmap_iter_get(k_iter, &k, &r_voidp);
- * r = r_voidp;
- * if (is_very_old(r)) {
- * k_del = 1;
- * }
- * }
- * }
- */
-#define MAP_FOREACH_MODIFY(prefix, map, keytype, keyvar, valtype, valvar) \
- STMT_BEGIN \
- prefix##iter_t *keyvar##_iter; \
- int keyvar##_del=0; \
- for (keyvar##_iter = prefix##iter_init(map); \
- !prefix##iter_done(keyvar##_iter); \
- keyvar##_iter = keyvar##_del ? \
- prefix##iter_next_rmv(map, keyvar##_iter) : \
- prefix##iter_next(map, keyvar##_iter)) { \
- keytype keyvar; \
- void *valvar##_voidp; \
- valtype valvar; \
- keyvar##_del=0; \
- prefix##iter_get(keyvar##_iter, &keyvar, &valvar##_voidp); \
- valvar = valvar##_voidp;
-
-/** Used with MAP_FOREACH_MODIFY to remove the currently-iterated-upon
- * member of the map. */
-#define MAP_DEL_CURRENT(keyvar) \
- STMT_BEGIN \
- keyvar##_del = 1; \
- STMT_END
-
-/** Used to end a MAP_FOREACH() block. */
-#define MAP_FOREACH_END } STMT_END ;
-
-/** As MAP_FOREACH, but does not require declaration of prefix or keytype.
- * Example use:
- * DIGESTMAP_FOREACH(m, k, routerinfo_t *, r) {
- * // use k and r
- * } DIGESTMAP_FOREACH_END.
- */
-#define DIGESTMAP_FOREACH(map, keyvar, valtype, valvar) \
- MAP_FOREACH(digestmap_, map, const char *, keyvar, valtype, valvar)
-
-/** As MAP_FOREACH_MODIFY, but does not require declaration of prefix or
- * keytype.
- * Example use:
- * DIGESTMAP_FOREACH_MODIFY(m, k, routerinfo_t *, r) {
- * if (is_very_old(r))
- * MAP_DEL_CURRENT(k);
- * } DIGESTMAP_FOREACH_END.
- */
-#define DIGESTMAP_FOREACH_MODIFY(map, keyvar, valtype, valvar) \
- MAP_FOREACH_MODIFY(digestmap_, map, const char *, keyvar, valtype, valvar)
-/** Used to end a DIGESTMAP_FOREACH() block. */
-#define DIGESTMAP_FOREACH_END MAP_FOREACH_END
-
-#define DIGEST256MAP_FOREACH(map, keyvar, valtype, valvar) \
- MAP_FOREACH(digest256map_, map, const uint8_t *, keyvar, valtype, valvar)
-#define DIGEST256MAP_FOREACH_MODIFY(map, keyvar, valtype, valvar) \
- MAP_FOREACH_MODIFY(digest256map_, map, const uint8_t *, \
- keyvar, valtype, valvar)
-#define DIGEST256MAP_FOREACH_END MAP_FOREACH_END
-
-#define STRMAP_FOREACH(map, keyvar, valtype, valvar) \
- MAP_FOREACH(strmap_, map, const char *, keyvar, valtype, valvar)
-#define STRMAP_FOREACH_MODIFY(map, keyvar, valtype, valvar) \
- MAP_FOREACH_MODIFY(strmap_, map, const char *, keyvar, valtype, valvar)
-#define STRMAP_FOREACH_END MAP_FOREACH_END
-
-void* strmap_set_lc(strmap_t *map, const char *key, void *val);
-void* strmap_get_lc(const strmap_t *map, const char *key);
-void* strmap_remove_lc(strmap_t *map, const char *key);
-
-#define DECLARE_TYPED_DIGESTMAP_FNS(prefix, maptype, valtype) \
- typedef struct maptype maptype; \
- typedef struct prefix##iter_t *prefix##iter_t; \
- ATTR_UNUSED static inline maptype* \
- prefix##new(void) \
- { \
- return (maptype*)digestmap_new(); \
- } \
- ATTR_UNUSED static inline digestmap_t* \
- prefix##to_digestmap(maptype *map) \
- { \
- return (digestmap_t*)map; \
- } \
- ATTR_UNUSED static inline valtype* \
- prefix##get(maptype *map, const char *key) \
- { \
- return (valtype*)digestmap_get((digestmap_t*)map, key); \
- } \
- ATTR_UNUSED static inline valtype* \
- prefix##set(maptype *map, const char *key, valtype *val) \
- { \
- return (valtype*)digestmap_set((digestmap_t*)map, key, val); \
- } \
- ATTR_UNUSED static inline valtype* \
- prefix##remove(maptype *map, const char *key) \
- { \
- return (valtype*)digestmap_remove((digestmap_t*)map, key); \
- } \
- ATTR_UNUSED static inline void \
- prefix##f##ree_(maptype *map, void (*free_val)(void*)) \
- { \
- digestmap_free_((digestmap_t*)map, free_val); \
- } \
- ATTR_UNUSED static inline int \
- prefix##isempty(maptype *map) \
- { \
- return digestmap_isempty((digestmap_t*)map); \
- } \
- ATTR_UNUSED static inline int \
- prefix##size(maptype *map) \
- { \
- return digestmap_size((digestmap_t*)map); \
- } \
- ATTR_UNUSED static inline \
- prefix##iter_t *prefix##iter_init(maptype *map) \
- { \
- return (prefix##iter_t*) digestmap_iter_init((digestmap_t*)map); \
- } \
- ATTR_UNUSED static inline \
- prefix##iter_t *prefix##iter_next(maptype *map, prefix##iter_t *iter) \
- { \
- return (prefix##iter_t*) digestmap_iter_next( \
- (digestmap_t*)map, (digestmap_iter_t*)iter); \
- } \
- ATTR_UNUSED static inline prefix##iter_t* \
- prefix##iter_next_rmv(maptype *map, prefix##iter_t *iter) \
- { \
- return (prefix##iter_t*) digestmap_iter_next_rmv( \
- (digestmap_t*)map, (digestmap_iter_t*)iter); \
- } \
- ATTR_UNUSED static inline void \
- prefix##iter_get(prefix##iter_t *iter, \
- const char **keyp, \
- valtype **valp) \
- { \
- void *v; \
- digestmap_iter_get((digestmap_iter_t*) iter, keyp, &v); \
- *valp = v; \
- } \
- ATTR_UNUSED static inline int \
- prefix##iter_done(prefix##iter_t *iter) \
- { \
- return digestmap_iter_done((digestmap_iter_t*)iter); \
- }
-
-#if SIZEOF_INT == 4
-#define BITARRAY_SHIFT 5
-#elif SIZEOF_INT == 8
-#define BITARRAY_SHIFT 6
-#else
-#error "int is neither 4 nor 8 bytes. I can't deal with that."
-#endif /* SIZEOF_INT == 4 || ... */
-#define BITARRAY_MASK ((1u<<BITARRAY_SHIFT)-1)
-
-/** A random-access array of one-bit-wide elements. */
-typedef unsigned int bitarray_t;
-/** Create a new bit array that can hold <b>n_bits</b> bits. */
-static inline bitarray_t *
-bitarray_init_zero(unsigned int n_bits)
-{
- /* round up to the next int. */
- size_t sz = (n_bits+BITARRAY_MASK) >> BITARRAY_SHIFT;
- return tor_calloc(sz, sizeof(unsigned int));
-}
-/** Expand <b>ba</b> from holding <b>n_bits_old</b> to <b>n_bits_new</b>,
- * clearing all new bits. Returns a possibly changed pointer to the
- * bitarray. */
-static inline bitarray_t *
-bitarray_expand(bitarray_t *ba,
- unsigned int n_bits_old, unsigned int n_bits_new)
-{
- size_t sz_old = (n_bits_old+BITARRAY_MASK) >> BITARRAY_SHIFT;
- size_t sz_new = (n_bits_new+BITARRAY_MASK) >> BITARRAY_SHIFT;
- char *ptr;
- if (sz_new <= sz_old)
- return ba;
- ptr = tor_reallocarray(ba, sz_new, sizeof(unsigned int));
- /* This memset does nothing to the older excess bytes. But they were
- * already set to 0 by bitarry_init_zero. */
- memset(ptr+sz_old*sizeof(unsigned int), 0,
- (sz_new-sz_old)*sizeof(unsigned int));
- return (bitarray_t*) ptr;
-}
-/** Free the bit array <b>ba</b>. */
-static inline void
-bitarray_free_(bitarray_t *ba)
-{
- tor_free(ba);
-}
-#define bitarray_free(ba) FREE_AND_NULL(bitarray_t, bitarray_free_, (ba))
-
-/** Set the <b>bit</b>th bit in <b>b</b> to 1. */
-static inline void
-bitarray_set(bitarray_t *b, int bit)
-{
- b[bit >> BITARRAY_SHIFT] |= (1u << (bit & BITARRAY_MASK));
-}
-/** Set the <b>bit</b>th bit in <b>b</b> to 0. */
-static inline void
-bitarray_clear(bitarray_t *b, int bit)
-{
- b[bit >> BITARRAY_SHIFT] &= ~ (1u << (bit & BITARRAY_MASK));
-}
-/** Return true iff <b>bit</b>th bit in <b>b</b> is nonzero. NOTE: does
- * not necessarily return 1 on true. */
-static inline unsigned int
-bitarray_is_set(bitarray_t *b, int bit)
-{
- return b[bit >> BITARRAY_SHIFT] & (1u << (bit & BITARRAY_MASK));
-}
-
-/** A set of digests, implemented as a Bloom filter. */
-typedef struct {
- int mask; /**< One less than the number of bits in <b>ba</b>; always one less
- * than a power of two. */
- bitarray_t *ba; /**< A bit array to implement the Bloom filter. */
-} digestset_t;
-
-#define BIT(n) ((n) & set->mask)
-/** Add the digest <b>digest</b> to <b>set</b>. */
-static inline void
-digestset_add(digestset_t *set, const char *digest)
-{
- const uint64_t x = siphash24g(digest, 20);
- const uint32_t d1 = (uint32_t) x;
- const uint32_t d2 = (uint32_t)( (x>>16) + x);
- const uint32_t d3 = (uint32_t)( (x>>32) + x);
- const uint32_t d4 = (uint32_t)( (x>>48) + x);
- bitarray_set(set->ba, BIT(d1));
- bitarray_set(set->ba, BIT(d2));
- bitarray_set(set->ba, BIT(d3));
- bitarray_set(set->ba, BIT(d4));
-}
-
-/** If <b>digest</b> is in <b>set</b>, return nonzero. Otherwise,
- * <em>probably</em> return zero. */
-static inline int
-digestset_contains(const digestset_t *set, const char *digest)
-{
- const uint64_t x = siphash24g(digest, 20);
- const uint32_t d1 = (uint32_t) x;
- const uint32_t d2 = (uint32_t)( (x>>16) + x);
- const uint32_t d3 = (uint32_t)( (x>>32) + x);
- const uint32_t d4 = (uint32_t)( (x>>48) + x);
- return bitarray_is_set(set->ba, BIT(d1)) &&
- bitarray_is_set(set->ba, BIT(d2)) &&
- bitarray_is_set(set->ba, BIT(d3)) &&
- bitarray_is_set(set->ba, BIT(d4));
-}
-#undef BIT
-
-digestset_t *digestset_new(int max_elements);
-void digestset_free_(digestset_t* set);
-#define digestset_free(set) FREE_AND_NULL(digestset_t, digestset_free_, (set))
-
-/* These functions, given an <b>array</b> of <b>n_elements</b>, return the
- * <b>nth</b> lowest element. <b>nth</b>=0 gives the lowest element;
- * <b>n_elements</b>-1 gives the highest; and (<b>n_elements</b>-1) / 2 gives
- * the median. As a side effect, the elements of <b>array</b> are sorted. */
-int find_nth_int(int *array, int n_elements, int nth);
-time_t find_nth_time(time_t *array, int n_elements, int nth);
-double find_nth_double(double *array, int n_elements, int nth);
-int32_t find_nth_int32(int32_t *array, int n_elements, int nth);
-uint32_t find_nth_uint32(uint32_t *array, int n_elements, int nth);
-long find_nth_long(long *array, int n_elements, int nth);
-static inline int
-median_int(int *array, int n_elements)
-{
- return find_nth_int(array, n_elements, (n_elements-1)/2);
-}
-static inline time_t
-median_time(time_t *array, int n_elements)
-{
- return find_nth_time(array, n_elements, (n_elements-1)/2);
-}
-static inline double
-median_double(double *array, int n_elements)
-{
- return find_nth_double(array, n_elements, (n_elements-1)/2);
-}
-static inline uint32_t
-median_uint32(uint32_t *array, int n_elements)
-{
- return find_nth_uint32(array, n_elements, (n_elements-1)/2);
-}
-static inline int32_t
-median_int32(int32_t *array, int n_elements)
-{
- return find_nth_int32(array, n_elements, (n_elements-1)/2);
-}
-
-static inline uint32_t
-third_quartile_uint32(uint32_t *array, int n_elements)
-{
- return find_nth_uint32(array, n_elements, (n_elements*3)/4);
-}
-
-#endif /* !defined(TOR_CONTAINER_H) */
-
diff --git a/src/common/crypto.c b/src/common/crypto.c
deleted file mode 100644
index d5b7c96916..0000000000
--- a/src/common/crypto.c
+++ /dev/null
@@ -1,1118 +0,0 @@
-/* Copyright (c) 2001, Matej Pfajfar.
- * Copyright (c) 2001-2004, Roger Dingledine.
- * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
-/* See LICENSE for licensing information */
-
-/**
- * \file crypto.c
- * \brief Wrapper functions to present a consistent interface to
- * public-key and symmetric cryptography operations from OpenSSL and
- * other places.
- **/
-
-#include "orconfig.h"
-
-#ifdef _WIN32
-#include <winsock2.h>
-#include <windows.h>
-#include <wincrypt.h>
-/* Windows defines this; so does OpenSSL 0.9.8h and later. We don't actually
- * use either definition. */
-#undef OCSP_RESPONSE
-#endif /* defined(_WIN32) */
-
-#define CRYPTO_PRIVATE
-#include "compat_openssl.h"
-#include "crypto.h"
-#include "crypto_curve25519.h"
-#include "crypto_digest.h"
-#include "crypto_ed25519.h"
-#include "crypto_format.h"
-#include "crypto_rand.h"
-#include "crypto_rsa.h"
-#include "crypto_util.h"
-
-DISABLE_GCC_WARNING(redundant-decls)
-
-#include <openssl/err.h>
-#include <openssl/evp.h>
-#include <openssl/engine.h>
-#include <openssl/bn.h>
-#include <openssl/dh.h>
-#include <openssl/conf.h>
-#include <openssl/hmac.h>
-#include <openssl/ssl.h>
-
-ENABLE_GCC_WARNING(redundant-decls)
-
-#if __GNUC__ && GCC_VERSION >= 402
-#if GCC_VERSION >= 406
-#pragma GCC diagnostic pop
-#else
-#pragma GCC diagnostic warning "-Wredundant-decls"
-#endif
-#endif /* __GNUC__ && GCC_VERSION >= 402 */
-
-#ifdef HAVE_CTYPE_H
-#include <ctype.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include "torlog.h"
-#include "torint.h"
-#include "aes.h"
-#include "util.h"
-#include "container.h"
-#include "compat.h"
-#include "sandbox.h"
-#include "util_format.h"
-
-#include "keccak-tiny/keccak-tiny.h"
-
-/** A structure to hold the first half (x, g^x) of a Diffie-Hellman handshake
- * while we're waiting for the second.*/
-struct crypto_dh_t {
- DH *dh; /**< The openssl DH object */
-};
-
-static int tor_check_dh_key(int severity, const BIGNUM *bn);
-
-/** Boolean: has OpenSSL's crypto been initialized? */
-static int crypto_early_initialized_ = 0;
-
-/** Boolean: has OpenSSL's crypto been initialized? */
-static int crypto_global_initialized_ = 0;
-
-/** Log all pending crypto errors at level <b>severity</b>. Use
- * <b>doing</b> to describe our current activities.
- */
-static void
-crypto_log_errors(int severity, const char *doing)
-{
- unsigned long err;
- const char *msg, *lib, *func;
- while ((err = ERR_get_error()) != 0) {
- msg = (const char*)ERR_reason_error_string(err);
- lib = (const char*)ERR_lib_error_string(err);
- func = (const char*)ERR_func_error_string(err);
- if (!msg) msg = "(null)";
- if (!lib) lib = "(null)";
- if (!func) func = "(null)";
- if (BUG(!doing)) doing = "(null)";
- tor_log(severity, LD_CRYPTO, "crypto error while %s: %s (in %s:%s)",
- doing, msg, lib, func);
- }
-}
-
-#ifndef DISABLE_ENGINES
-/** Log any OpenSSL engines we're using at NOTICE. */
-static void
-log_engine(const char *fn, ENGINE *e)
-{
- if (e) {
- const char *name, *id;
- name = ENGINE_get_name(e);
- id = ENGINE_get_id(e);
- log_notice(LD_CRYPTO, "Default OpenSSL engine for %s is %s [%s]",
- fn, name?name:"?", id?id:"?");
- } else {
- log_info(LD_CRYPTO, "Using default implementation for %s", fn);
- }
-}
-#endif /* !defined(DISABLE_ENGINES) */
-
-#ifndef DISABLE_ENGINES
-/** Try to load an engine in a shared library via fully qualified path.
- */
-static ENGINE *
-try_load_engine(const char *path, const char *engine)
-{
- ENGINE *e = ENGINE_by_id("dynamic");
- if (e) {
- if (!ENGINE_ctrl_cmd_string(e, "ID", engine, 0) ||
- !ENGINE_ctrl_cmd_string(e, "DIR_LOAD", "2", 0) ||
- !ENGINE_ctrl_cmd_string(e, "DIR_ADD", path, 0) ||
- !ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0)) {
- ENGINE_free(e);
- e = NULL;
- }
- }
- return e;
-}
-#endif /* !defined(DISABLE_ENGINES) */
-
-static int have_seeded_siphash = 0;
-
-/** Set up the siphash key if we haven't already done so. */
-int
-crypto_init_siphash_key(void)
-{
- struct sipkey key;
- if (have_seeded_siphash)
- return 0;
-
- crypto_rand((char*) &key, sizeof(key));
- siphash_set_global_key(&key);
- have_seeded_siphash = 1;
- return 0;
-}
-
-/** Initialize the crypto library. Return 0 on success, -1 on failure.
- */
-int
-crypto_early_init(void)
-{
- if (!crypto_early_initialized_) {
-
- crypto_early_initialized_ = 1;
-
-#ifdef OPENSSL_1_1_API
- OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS |
- OPENSSL_INIT_LOAD_CRYPTO_STRINGS |
- OPENSSL_INIT_ADD_ALL_CIPHERS |
- OPENSSL_INIT_ADD_ALL_DIGESTS, NULL);
-#else
- ERR_load_crypto_strings();
- OpenSSL_add_all_algorithms();
-#endif
-
- setup_openssl_threading();
-
- unsigned long version_num = OpenSSL_version_num();
- const char *version_str = OpenSSL_version(OPENSSL_VERSION);
- if (version_num == OPENSSL_VERSION_NUMBER &&
- !strcmp(version_str, OPENSSL_VERSION_TEXT)) {
- log_info(LD_CRYPTO, "OpenSSL version matches version from headers "
- "(%lx: %s).", version_num, version_str);
- } else {
- log_warn(LD_CRYPTO, "OpenSSL version from headers does not match the "
- "version we're running with. If you get weird crashes, that "
- "might be why. (Compiled with %lx: %s; running with %lx: %s).",
- (unsigned long)OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT,
- version_num, version_str);
- }
-
- crypto_force_rand_ssleay();
-
- if (crypto_seed_rng() < 0)
- return -1;
- if (crypto_init_siphash_key() < 0)
- return -1;
-
- curve25519_init();
- ed25519_init();
- }
- return 0;
-}
-
-/** Initialize the crypto library. Return 0 on success, -1 on failure.
- */
-int
-crypto_global_init(int useAccel, const char *accelName, const char *accelDir)
-{
- if (!crypto_global_initialized_) {
- if (crypto_early_init() < 0)
- return -1;
-
- crypto_global_initialized_ = 1;
-
- if (useAccel > 0) {
-#ifdef DISABLE_ENGINES
- (void)accelName;
- (void)accelDir;
- log_warn(LD_CRYPTO, "No OpenSSL hardware acceleration support enabled.");
-#else
- ENGINE *e = NULL;
-
- log_info(LD_CRYPTO, "Initializing OpenSSL engine support.");
- ENGINE_load_builtin_engines();
- ENGINE_register_all_complete();
-
- if (accelName) {
- if (accelDir) {
- log_info(LD_CRYPTO, "Trying to load dynamic OpenSSL engine \"%s\""
- " via path \"%s\".", accelName, accelDir);
- e = try_load_engine(accelName, accelDir);
- } else {
- log_info(LD_CRYPTO, "Initializing dynamic OpenSSL engine \"%s\""
- " acceleration support.", accelName);
- e = ENGINE_by_id(accelName);
- }
- if (!e) {
- log_warn(LD_CRYPTO, "Unable to load dynamic OpenSSL engine \"%s\".",
- accelName);
- } else {
- log_info(LD_CRYPTO, "Loaded dynamic OpenSSL engine \"%s\".",
- accelName);
- }
- }
- if (e) {
- log_info(LD_CRYPTO, "Loaded OpenSSL hardware acceleration engine,"
- " setting default ciphers.");
- ENGINE_set_default(e, ENGINE_METHOD_ALL);
- }
- /* Log, if available, the intersection of the set of algorithms
- used by Tor and the set of algorithms available in the engine */
- log_engine("RSA", ENGINE_get_default_RSA());
- log_engine("DH", ENGINE_get_default_DH());
-#ifdef OPENSSL_1_1_API
- log_engine("EC", ENGINE_get_default_EC());
-#else
- log_engine("ECDH", ENGINE_get_default_ECDH());
- log_engine("ECDSA", ENGINE_get_default_ECDSA());
-#endif /* defined(OPENSSL_1_1_API) */
- log_engine("RAND", ENGINE_get_default_RAND());
- log_engine("RAND (which we will not use)", ENGINE_get_default_RAND());
- log_engine("SHA1", ENGINE_get_digest_engine(NID_sha1));
- log_engine("3DES-CBC", ENGINE_get_cipher_engine(NID_des_ede3_cbc));
- log_engine("AES-128-ECB", ENGINE_get_cipher_engine(NID_aes_128_ecb));
- log_engine("AES-128-CBC", ENGINE_get_cipher_engine(NID_aes_128_cbc));
-#ifdef NID_aes_128_ctr
- log_engine("AES-128-CTR", ENGINE_get_cipher_engine(NID_aes_128_ctr));
-#endif
-#ifdef NID_aes_128_gcm
- log_engine("AES-128-GCM", ENGINE_get_cipher_engine(NID_aes_128_gcm));
-#endif
- log_engine("AES-256-CBC", ENGINE_get_cipher_engine(NID_aes_256_cbc));
-#ifdef NID_aes_256_gcm
- log_engine("AES-256-GCM", ENGINE_get_cipher_engine(NID_aes_256_gcm));
-#endif
-
-#endif /* defined(DISABLE_ENGINES) */
- } else {
- log_info(LD_CRYPTO, "NOT using OpenSSL engine support.");
- }
-
- if (crypto_force_rand_ssleay()) {
- if (crypto_seed_rng() < 0)
- return -1;
- }
-
- evaluate_evp_for_aes(-1);
- evaluate_ctr_for_aes();
- }
- return 0;
-}
-
-/** Free crypto resources held by this thread. */
-void
-crypto_thread_cleanup(void)
-{
-#ifndef NEW_THREAD_API
- ERR_remove_thread_state(NULL);
-#endif
-}
-
-/** Used by tortls.c: Get the DH* from a crypto_dh_t.
- */
-DH *
-crypto_dh_get_dh_(crypto_dh_t *dh)
-{
- return dh->dh;
-}
-
-/** Allocate and return a new symmetric cipher using the provided key and iv.
- * The key is <b>bits</b> bits long; the IV is CIPHER_IV_LEN bytes. Both
- * must be provided. Key length must be 128, 192, or 256 */
-crypto_cipher_t *
-crypto_cipher_new_with_iv_and_bits(const uint8_t *key,
- const uint8_t *iv,
- int bits)
-{
- tor_assert(key);
- tor_assert(iv);
-
- return aes_new_cipher((const uint8_t*)key, (const uint8_t*)iv, bits);
-}
-
-/** Allocate and return a new symmetric cipher using the provided key and iv.
- * The key is CIPHER_KEY_LEN bytes; the IV is CIPHER_IV_LEN bytes. Both
- * must be provided.
- */
-crypto_cipher_t *
-crypto_cipher_new_with_iv(const char *key, const char *iv)
-{
- return crypto_cipher_new_with_iv_and_bits((uint8_t*)key, (uint8_t*)iv,
- 128);
-}
-
-/** Return a new crypto_cipher_t with the provided <b>key</b> and an IV of all
- * zero bytes and key length <b>bits</b>. Key length must be 128, 192, or
- * 256. */
-crypto_cipher_t *
-crypto_cipher_new_with_bits(const char *key, int bits)
-{
- char zeroiv[CIPHER_IV_LEN];
- memset(zeroiv, 0, sizeof(zeroiv));
- return crypto_cipher_new_with_iv_and_bits((uint8_t*)key, (uint8_t*)zeroiv,
- bits);
-}
-
-/** Return a new crypto_cipher_t with the provided <b>key</b> (of
- * CIPHER_KEY_LEN bytes) and an IV of all zero bytes. */
-crypto_cipher_t *
-crypto_cipher_new(const char *key)
-{
- return crypto_cipher_new_with_bits(key, 128);
-}
-
-/** Free a symmetric cipher.
- */
-void
-crypto_cipher_free_(crypto_cipher_t *env)
-{
- if (!env)
- return;
-
- aes_cipher_free(env);
-}
-
-/** Copy <b>in</b> to the <b>outlen</b>-byte buffer <b>out</b>, adding spaces
- * every four characters. */
-void
-crypto_add_spaces_to_fp(char *out, size_t outlen, const char *in)
-{
- int n = 0;
- char *end = out+outlen;
- tor_assert(outlen < SIZE_T_CEILING);
-
- while (*in && out<end) {
- *out++ = *in++;
- if (++n == 4 && *in && out<end) {
- n = 0;
- *out++ = ' ';
- }
- }
- tor_assert(out<end);
- *out = '\0';
-}
-
-/* symmetric crypto */
-
-/** Encrypt <b>fromlen</b> bytes from <b>from</b> using the cipher
- * <b>env</b>; on success, store the result to <b>to</b> and return 0.
- * Does not check for failure.
- */
-int
-crypto_cipher_encrypt(crypto_cipher_t *env, char *to,
- const char *from, size_t fromlen)
-{
- tor_assert(env);
- tor_assert(env);
- tor_assert(from);
- tor_assert(fromlen);
- tor_assert(to);
- tor_assert(fromlen < SIZE_T_CEILING);
-
- memcpy(to, from, fromlen);
- aes_crypt_inplace(env, to, fromlen);
- return 0;
-}
-
-/** Decrypt <b>fromlen</b> bytes from <b>from</b> using the cipher
- * <b>env</b>; on success, store the result to <b>to</b> and return 0.
- * Does not check for failure.
- */
-int
-crypto_cipher_decrypt(crypto_cipher_t *env, char *to,
- const char *from, size_t fromlen)
-{
- tor_assert(env);
- tor_assert(from);
- tor_assert(to);
- tor_assert(fromlen < SIZE_T_CEILING);
-
- memcpy(to, from, fromlen);
- aes_crypt_inplace(env, to, fromlen);
- return 0;
-}
-
-/** Encrypt <b>len</b> bytes on <b>from</b> using the cipher in <b>env</b>;
- * on success. Does not check for failure.
- */
-void
-crypto_cipher_crypt_inplace(crypto_cipher_t *env, char *buf, size_t len)
-{
- tor_assert(len < SIZE_T_CEILING);
- aes_crypt_inplace(env, buf, len);
-}
-
-/** Encrypt <b>fromlen</b> bytes (at least 1) from <b>from</b> with the key in
- * <b>key</b> to the buffer in <b>to</b> of length
- * <b>tolen</b>. <b>tolen</b> must be at least <b>fromlen</b> plus
- * CIPHER_IV_LEN bytes for the initialization vector. On success, return the
- * number of bytes written, on failure, return -1.
- */
-int
-crypto_cipher_encrypt_with_iv(const char *key,
- char *to, size_t tolen,
- const char *from, size_t fromlen)
-{
- crypto_cipher_t *cipher;
- tor_assert(from);
- tor_assert(to);
- tor_assert(fromlen < INT_MAX);
-
- if (fromlen < 1)
- return -1;
- if (tolen < fromlen + CIPHER_IV_LEN)
- return -1;
-
- char iv[CIPHER_IV_LEN];
- crypto_rand(iv, sizeof(iv));
- cipher = crypto_cipher_new_with_iv(key, iv);
-
- memcpy(to, iv, CIPHER_IV_LEN);
- crypto_cipher_encrypt(cipher, to+CIPHER_IV_LEN, from, fromlen);
- crypto_cipher_free(cipher);
- memwipe(iv, 0, sizeof(iv));
- return (int)(fromlen + CIPHER_IV_LEN);
-}
-
-/** Decrypt <b>fromlen</b> bytes (at least 1+CIPHER_IV_LEN) from <b>from</b>
- * with the key in <b>key</b> to the buffer in <b>to</b> of length
- * <b>tolen</b>. <b>tolen</b> must be at least <b>fromlen</b> minus
- * CIPHER_IV_LEN bytes for the initialization vector. On success, return the
- * number of bytes written, on failure, return -1.
- */
-int
-crypto_cipher_decrypt_with_iv(const char *key,
- char *to, size_t tolen,
- const char *from, size_t fromlen)
-{
- crypto_cipher_t *cipher;
- tor_assert(key);
- tor_assert(from);
- tor_assert(to);
- tor_assert(fromlen < INT_MAX);
-
- if (fromlen <= CIPHER_IV_LEN)
- return -1;
- if (tolen < fromlen - CIPHER_IV_LEN)
- return -1;
-
- cipher = crypto_cipher_new_with_iv(key, from);
-
- crypto_cipher_encrypt(cipher, to, from+CIPHER_IV_LEN, fromlen-CIPHER_IV_LEN);
- crypto_cipher_free(cipher);
- return (int)(fromlen - CIPHER_IV_LEN);
-}
-
-/* DH */
-
-/** Our DH 'g' parameter */
-#define DH_GENERATOR 2
-
-/** Shared P parameter for our circuit-crypto DH key exchanges. */
-static BIGNUM *dh_param_p = NULL;
-/** Shared P parameter for our TLS DH key exchanges. */
-static BIGNUM *dh_param_p_tls = NULL;
-/** Shared G parameter for our DH key exchanges. */
-static BIGNUM *dh_param_g = NULL;
-
-/** Validate a given set of Diffie-Hellman parameters. This is moderately
- * computationally expensive (milliseconds), so should only be called when
- * the DH parameters change. Returns 0 on success, * -1 on failure.
- */
-static int
-crypto_validate_dh_params(const BIGNUM *p, const BIGNUM *g)
-{
- DH *dh = NULL;
- int ret = -1;
-
- /* Copy into a temporary DH object, just so that DH_check() can be called. */
- if (!(dh = DH_new()))
- goto out;
-#ifdef OPENSSL_1_1_API
- BIGNUM *dh_p, *dh_g;
- if (!(dh_p = BN_dup(p)))
- goto out;
- if (!(dh_g = BN_dup(g)))
- goto out;
- if (!DH_set0_pqg(dh, dh_p, NULL, dh_g))
- goto out;
-#else /* !(defined(OPENSSL_1_1_API)) */
- if (!(dh->p = BN_dup(p)))
- goto out;
- if (!(dh->g = BN_dup(g)))
- goto out;
-#endif /* defined(OPENSSL_1_1_API) */
-
- /* Perform the validation. */
- int codes = 0;
- if (!DH_check(dh, &codes))
- goto out;
- if (BN_is_word(g, DH_GENERATOR_2)) {
- /* Per https://wiki.openssl.org/index.php/Diffie-Hellman_parameters
- *
- * OpenSSL checks the prime is congruent to 11 when g = 2; while the
- * IETF's primes are congruent to 23 when g = 2.
- */
- BN_ULONG residue = BN_mod_word(p, 24);
- if (residue == 11 || residue == 23)
- codes &= ~DH_NOT_SUITABLE_GENERATOR;
- }
- if (codes != 0) /* Specifics on why the params suck is irrelevant. */
- goto out;
-
- /* Things are probably not evil. */
- ret = 0;
-
- out:
- if (dh)
- DH_free(dh);
- return ret;
-}
-
-/** Set the global Diffie-Hellman generator, used for both TLS and internal
- * DH stuff.
- */
-static void
-crypto_set_dh_generator(void)
-{
- BIGNUM *generator;
- int r;
-
- if (dh_param_g)
- return;
-
- generator = BN_new();
- tor_assert(generator);
-
- r = BN_set_word(generator, DH_GENERATOR);
- tor_assert(r);
-
- dh_param_g = generator;
-}
-
-/** Set the global TLS Diffie-Hellman modulus. Use the Apache mod_ssl DH
- * modulus. */
-void
-crypto_set_tls_dh_prime(void)
-{
- BIGNUM *tls_prime = NULL;
- int r;
-
- /* If the space is occupied, free the previous TLS DH prime */
- if (BUG(dh_param_p_tls)) {
- /* LCOV_EXCL_START
- *
- * We shouldn't be calling this twice.
- */
- BN_clear_free(dh_param_p_tls);
- dh_param_p_tls = NULL;
- /* LCOV_EXCL_STOP */
- }
-
- tls_prime = BN_new();
- tor_assert(tls_prime);
-
- /* This is the 1024-bit safe prime that Apache uses for its DH stuff; see
- * modules/ssl/ssl_engine_dh.c; Apache also uses a generator of 2 with this
- * prime.
- */
- r = BN_hex2bn(&tls_prime,
- "D67DE440CBBBDC1936D693D34AFD0AD50C84D239A45F520BB88174CB98"
- "BCE951849F912E639C72FB13B4B4D7177E16D55AC179BA420B2A29FE324A"
- "467A635E81FF5901377BEDDCFD33168A461AAD3B72DAE8860078045B07A7"
- "DBCA7874087D1510EA9FCC9DDD330507DD62DB88AEAA747DE0F4D6E2BD68"
- "B0E7393E0F24218EB3");
- tor_assert(r);
-
- tor_assert(tls_prime);
-
- dh_param_p_tls = tls_prime;
- crypto_set_dh_generator();
- tor_assert(0 == crypto_validate_dh_params(dh_param_p_tls, dh_param_g));
-}
-
-/** Initialize dh_param_p and dh_param_g if they are not already
- * set. */
-static void
-init_dh_param(void)
-{
- BIGNUM *circuit_dh_prime;
- int r;
- if (BUG(dh_param_p && dh_param_g))
- return; // LCOV_EXCL_LINE This function isn't supposed to be called twice.
-
- circuit_dh_prime = BN_new();
- tor_assert(circuit_dh_prime);
-
- /* This is from rfc2409, section 6.2. It's a safe prime, and
- supposedly it equals:
- 2^1024 - 2^960 - 1 + 2^64 * { [2^894 pi] + 129093 }.
- */
- r = BN_hex2bn(&circuit_dh_prime,
- "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E08"
- "8A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B"
- "302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9"
- "A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE6"
- "49286651ECE65381FFFFFFFFFFFFFFFF");
- tor_assert(r);
-
- /* Set the new values as the global DH parameters. */
- dh_param_p = circuit_dh_prime;
- crypto_set_dh_generator();
- tor_assert(0 == crypto_validate_dh_params(dh_param_p, dh_param_g));
-
- if (!dh_param_p_tls) {
- crypto_set_tls_dh_prime();
- }
-}
-
-/** Number of bits to use when choosing the x or y value in a Diffie-Hellman
- * handshake. Since we exponentiate by this value, choosing a smaller one
- * lets our handhake go faster.
- */
-#define DH_PRIVATE_KEY_BITS 320
-
-/** Allocate and return a new DH object for a key exchange. Returns NULL on
- * failure.
- */
-crypto_dh_t *
-crypto_dh_new(int dh_type)
-{
- crypto_dh_t *res = tor_malloc_zero(sizeof(crypto_dh_t));
-
- tor_assert(dh_type == DH_TYPE_CIRCUIT || dh_type == DH_TYPE_TLS ||
- dh_type == DH_TYPE_REND);
-
- if (!dh_param_p)
- init_dh_param();
-
- if (!(res->dh = DH_new()))
- goto err;
-
-#ifdef OPENSSL_1_1_API
- BIGNUM *dh_p = NULL, *dh_g = NULL;
-
- if (dh_type == DH_TYPE_TLS) {
- dh_p = BN_dup(dh_param_p_tls);
- } else {
- dh_p = BN_dup(dh_param_p);
- }
- if (!dh_p)
- goto err;
-
- dh_g = BN_dup(dh_param_g);
- if (!dh_g) {
- BN_free(dh_p);
- goto err;
- }
-
- if (!DH_set0_pqg(res->dh, dh_p, NULL, dh_g)) {
- goto err;
- }
-
- if (!DH_set_length(res->dh, DH_PRIVATE_KEY_BITS))
- goto err;
-#else /* !(defined(OPENSSL_1_1_API)) */
- if (dh_type == DH_TYPE_TLS) {
- if (!(res->dh->p = BN_dup(dh_param_p_tls)))
- goto err;
- } else {
- if (!(res->dh->p = BN_dup(dh_param_p)))
- goto err;
- }
-
- if (!(res->dh->g = BN_dup(dh_param_g)))
- goto err;
-
- res->dh->length = DH_PRIVATE_KEY_BITS;
-#endif /* defined(OPENSSL_1_1_API) */
-
- return res;
-
- /* LCOV_EXCL_START
- * This error condition is only reached when an allocation fails */
- err:
- crypto_log_errors(LOG_WARN, "creating DH object");
- if (res->dh) DH_free(res->dh); /* frees p and g too */
- tor_free(res);
- return NULL;
- /* LCOV_EXCL_STOP */
-}
-
-/** Return a copy of <b>dh</b>, sharing its internal state. */
-crypto_dh_t *
-crypto_dh_dup(const crypto_dh_t *dh)
-{
- crypto_dh_t *dh_new = tor_malloc_zero(sizeof(crypto_dh_t));
- tor_assert(dh);
- tor_assert(dh->dh);
- dh_new->dh = dh->dh;
- DH_up_ref(dh->dh);
- return dh_new;
-}
-
-/** Return the length of the DH key in <b>dh</b>, in bytes.
- */
-int
-crypto_dh_get_bytes(crypto_dh_t *dh)
-{
- tor_assert(dh);
- return DH_size(dh->dh);
-}
-
-/** Generate \<x,g^x\> for our part of the key exchange. Return 0 on
- * success, -1 on failure.
- */
-int
-crypto_dh_generate_public(crypto_dh_t *dh)
-{
-#ifndef OPENSSL_1_1_API
- again:
-#endif
- if (!DH_generate_key(dh->dh)) {
- /* LCOV_EXCL_START
- * To test this we would need some way to tell openssl to break DH. */
- crypto_log_errors(LOG_WARN, "generating DH key");
- return -1;
- /* LCOV_EXCL_STOP */
- }
-#ifdef OPENSSL_1_1_API
- /* OpenSSL 1.1.x doesn't appear to let you regenerate a DH key, without
- * recreating the DH object. I have no idea what sort of aliasing madness
- * can occur here, so do the check, and just bail on failure.
- */
- const BIGNUM *pub_key, *priv_key;
- DH_get0_key(dh->dh, &pub_key, &priv_key);
- if (tor_check_dh_key(LOG_WARN, pub_key)<0) {
- log_warn(LD_CRYPTO, "Weird! Our own DH key was invalid. I guess once-in-"
- "the-universe chances really do happen. Treating as a failure.");
- return -1;
- }
-#else /* !(defined(OPENSSL_1_1_API)) */
- if (tor_check_dh_key(LOG_WARN, dh->dh->pub_key)<0) {
- /* LCOV_EXCL_START
- * If this happens, then openssl's DH implementation is busted. */
- log_warn(LD_CRYPTO, "Weird! Our own DH key was invalid. I guess once-in-"
- "the-universe chances really do happen. Trying again.");
- /* Free and clear the keys, so OpenSSL will actually try again. */
- BN_clear_free(dh->dh->pub_key);
- BN_clear_free(dh->dh->priv_key);
- dh->dh->pub_key = dh->dh->priv_key = NULL;
- goto again;
- /* LCOV_EXCL_STOP */
- }
-#endif /* defined(OPENSSL_1_1_API) */
- return 0;
-}
-
-/** Generate g^x as necessary, and write the g^x for the key exchange
- * as a <b>pubkey_len</b>-byte value into <b>pubkey</b>. Return 0 on
- * success, -1 on failure. <b>pubkey_len</b> must be \>= DH_BYTES.
- */
-int
-crypto_dh_get_public(crypto_dh_t *dh, char *pubkey, size_t pubkey_len)
-{
- int bytes;
- tor_assert(dh);
-
- const BIGNUM *dh_pub;
-
-#ifdef OPENSSL_1_1_API
- const BIGNUM *dh_priv;
- DH_get0_key(dh->dh, &dh_pub, &dh_priv);
-#else
- dh_pub = dh->dh->pub_key;
-#endif /* defined(OPENSSL_1_1_API) */
-
- if (!dh_pub) {
- if (crypto_dh_generate_public(dh)<0)
- return -1;
- else {
-#ifdef OPENSSL_1_1_API
- DH_get0_key(dh->dh, &dh_pub, &dh_priv);
-#else
- dh_pub = dh->dh->pub_key;
-#endif
- }
- }
-
- tor_assert(dh_pub);
- bytes = BN_num_bytes(dh_pub);
- tor_assert(bytes >= 0);
- if (pubkey_len < (size_t)bytes) {
- log_warn(LD_CRYPTO,
- "Weird! pubkey_len (%d) was smaller than DH_BYTES (%d)",
- (int) pubkey_len, bytes);
- return -1;
- }
-
- memset(pubkey, 0, pubkey_len);
- BN_bn2bin(dh_pub, (unsigned char*)(pubkey+(pubkey_len-bytes)));
-
- return 0;
-}
-
-/** Check for bad Diffie-Hellman public keys (g^x). Return 0 if the key is
- * okay (in the subgroup [2,p-2]), or -1 if it's bad.
- * See http://www.cl.cam.ac.uk/ftp/users/rja14/psandqs.ps.gz for some tips.
- */
-static int
-tor_check_dh_key(int severity, const BIGNUM *bn)
-{
- BIGNUM *x;
- char *s;
- tor_assert(bn);
- x = BN_new();
- tor_assert(x);
- if (BUG(!dh_param_p))
- init_dh_param(); //LCOV_EXCL_LINE we already checked whether we did this.
- BN_set_word(x, 1);
- if (BN_cmp(bn,x)<=0) {
- log_fn(severity, LD_CRYPTO, "DH key must be at least 2.");
- goto err;
- }
- BN_copy(x,dh_param_p);
- BN_sub_word(x, 1);
- if (BN_cmp(bn,x)>=0) {
- log_fn(severity, LD_CRYPTO, "DH key must be at most p-2.");
- goto err;
- }
- BN_clear_free(x);
- return 0;
- err:
- BN_clear_free(x);
- s = BN_bn2hex(bn);
- log_fn(severity, LD_CRYPTO, "Rejecting insecure DH key [%s]", s);
- OPENSSL_free(s);
- return -1;
-}
-
-/** Given a DH key exchange object, and our peer's value of g^y (as a
- * <b>pubkey_len</b>-byte value in <b>pubkey</b>) generate
- * <b>secret_bytes_out</b> bytes of shared key material and write them
- * to <b>secret_out</b>. Return the number of bytes generated on success,
- * or -1 on failure.
- *
- * (We generate key material by computing
- * SHA1( g^xy || "\x00" ) || SHA1( g^xy || "\x01" ) || ...
- * where || is concatenation.)
- */
-ssize_t
-crypto_dh_compute_secret(int severity, crypto_dh_t *dh,
- const char *pubkey, size_t pubkey_len,
- char *secret_out, size_t secret_bytes_out)
-{
- char *secret_tmp = NULL;
- BIGNUM *pubkey_bn = NULL;
- size_t secret_len=0, secret_tmp_len=0;
- int result=0;
- tor_assert(dh);
- tor_assert(secret_bytes_out/DIGEST_LEN <= 255);
- tor_assert(pubkey_len < INT_MAX);
-
- if (!(pubkey_bn = BN_bin2bn((const unsigned char*)pubkey,
- (int)pubkey_len, NULL)))
- goto error;
- if (tor_check_dh_key(severity, pubkey_bn)<0) {
- /* Check for invalid public keys. */
- log_fn(severity, LD_CRYPTO,"Rejected invalid g^x");
- goto error;
- }
- secret_tmp_len = crypto_dh_get_bytes(dh);
- secret_tmp = tor_malloc(secret_tmp_len);
- result = DH_compute_key((unsigned char*)secret_tmp, pubkey_bn, dh->dh);
- if (result < 0) {
- log_warn(LD_CRYPTO,"DH_compute_key() failed.");
- goto error;
- }
- secret_len = result;
- if (crypto_expand_key_material_TAP((uint8_t*)secret_tmp, secret_len,
- (uint8_t*)secret_out, secret_bytes_out)<0)
- goto error;
- secret_len = secret_bytes_out;
-
- goto done;
- error:
- result = -1;
- done:
- crypto_log_errors(LOG_WARN, "completing DH handshake");
- if (pubkey_bn)
- BN_clear_free(pubkey_bn);
- if (secret_tmp) {
- memwipe(secret_tmp, 0, secret_tmp_len);
- tor_free(secret_tmp);
- }
- if (result < 0)
- return result;
- else
- return secret_len;
-}
-
-/** Given <b>key_in_len</b> bytes of negotiated randomness in <b>key_in</b>
- * ("K"), expand it into <b>key_out_len</b> bytes of negotiated key material in
- * <b>key_out</b> by taking the first <b>key_out_len</b> bytes of
- * H(K | [00]) | H(K | [01]) | ....
- *
- * This is the key expansion algorithm used in the "TAP" circuit extension
- * mechanism; it shouldn't be used for new protocols.
- *
- * Return 0 on success, -1 on failure.
- */
-int
-crypto_expand_key_material_TAP(const uint8_t *key_in, size_t key_in_len,
- uint8_t *key_out, size_t key_out_len)
-{
- int i, r = -1;
- uint8_t *cp, *tmp = tor_malloc(key_in_len+1);
- uint8_t digest[DIGEST_LEN];
-
- /* If we try to get more than this amount of key data, we'll repeat blocks.*/
- tor_assert(key_out_len <= DIGEST_LEN*256);
-
- memcpy(tmp, key_in, key_in_len);
- for (cp = key_out, i=0; cp < key_out+key_out_len;
- ++i, cp += DIGEST_LEN) {
- tmp[key_in_len] = i;
- if (crypto_digest((char*)digest, (const char *)tmp, key_in_len+1) < 0)
- goto exit;
- memcpy(cp, digest, MIN(DIGEST_LEN, key_out_len-(cp-key_out)));
- }
-
- r = 0;
- exit:
- memwipe(tmp, 0, key_in_len+1);
- tor_free(tmp);
- memwipe(digest, 0, sizeof(digest));
- return r;
-}
-
-/** Expand some secret key material according to RFC5869, using SHA256 as the
- * underlying hash. The <b>key_in_len</b> bytes at <b>key_in</b> are the
- * secret key material; the <b>salt_in_len</b> bytes at <b>salt_in</b> and the
- * <b>info_in_len</b> bytes in <b>info_in_len</b> are the algorithm's "salt"
- * and "info" parameters respectively. On success, write <b>key_out_len</b>
- * bytes to <b>key_out</b> and return 0. Assert on failure.
- */
-int
-crypto_expand_key_material_rfc5869_sha256(
- const uint8_t *key_in, size_t key_in_len,
- const uint8_t *salt_in, size_t salt_in_len,
- const uint8_t *info_in, size_t info_in_len,
- uint8_t *key_out, size_t key_out_len)
-{
- uint8_t prk[DIGEST256_LEN];
- uint8_t tmp[DIGEST256_LEN + 128 + 1];
- uint8_t mac[DIGEST256_LEN];
- int i;
- uint8_t *outp;
- size_t tmp_len;
-
- crypto_hmac_sha256((char*)prk,
- (const char*)salt_in, salt_in_len,
- (const char*)key_in, key_in_len);
-
- /* If we try to get more than this amount of key data, we'll repeat blocks.*/
- tor_assert(key_out_len <= DIGEST256_LEN * 256);
- tor_assert(info_in_len <= 128);
- memset(tmp, 0, sizeof(tmp));
- outp = key_out;
- i = 1;
-
- while (key_out_len) {
- size_t n;
- if (i > 1) {
- memcpy(tmp, mac, DIGEST256_LEN);
- memcpy(tmp+DIGEST256_LEN, info_in, info_in_len);
- tmp[DIGEST256_LEN+info_in_len] = i;
- tmp_len = DIGEST256_LEN + info_in_len + 1;
- } else {
- memcpy(tmp, info_in, info_in_len);
- tmp[info_in_len] = i;
- tmp_len = info_in_len + 1;
- }
- crypto_hmac_sha256((char*)mac,
- (const char*)prk, DIGEST256_LEN,
- (const char*)tmp, tmp_len);
- n = key_out_len < DIGEST256_LEN ? key_out_len : DIGEST256_LEN;
- memcpy(outp, mac, n);
- key_out_len -= n;
- outp += n;
- ++i;
- }
-
- memwipe(tmp, 0, sizeof(tmp));
- memwipe(mac, 0, sizeof(mac));
- return 0;
-}
-
-/** Free a DH key exchange object.
- */
-void
-crypto_dh_free_(crypto_dh_t *dh)
-{
- if (!dh)
- return;
- tor_assert(dh->dh);
- DH_free(dh->dh);
- tor_free(dh);
-}
-
-/** @{ */
-/** Uninitialize the crypto library. Return 0 on success. Does not detect
- * failure.
- */
-int
-crypto_global_cleanup(void)
-{
-#ifndef OPENSSL_1_1_API
- EVP_cleanup();
-#endif
-#ifndef NEW_THREAD_API
- ERR_remove_thread_state(NULL);
-#endif
-#ifndef OPENSSL_1_1_API
- ERR_free_strings();
-#endif
-
- if (dh_param_p)
- BN_clear_free(dh_param_p);
- if (dh_param_p_tls)
- BN_clear_free(dh_param_p_tls);
- if (dh_param_g)
- BN_clear_free(dh_param_g);
-
- dh_param_p = dh_param_p_tls = dh_param_g = NULL;
-
-#ifndef DISABLE_ENGINES
-#ifndef OPENSSL_1_1_API
- ENGINE_cleanup();
-#endif
-#endif
-
- CONF_modules_unload(1);
-#ifndef OPENSSL_1_1_API
- CRYPTO_cleanup_all_ex_data();
-#endif
-
- crypto_openssl_free_all();
-
- crypto_early_initialized_ = 0;
- crypto_global_initialized_ = 0;
- have_seeded_siphash = 0;
- siphash_unset_global_key();
-
- return 0;
-}
-
-/** @} */
-
-#ifdef USE_DMALLOC
-/** Tell the crypto library to use Tor's allocation functions rather than
- * calling libc's allocation functions directly. Return 0 on success, -1
- * on failure. */
-int
-crypto_use_tor_alloc_functions(void)
-{
- int r = CRYPTO_set_mem_ex_functions(tor_malloc_, tor_realloc_, tor_free_);
- return r ? 0 : -1;
-}
-#endif /* defined(USE_DMALLOC) */
-
diff --git a/src/common/handles.h b/src/common/handles.h
index aef8cd89ef..ca345b0bcb 100644
--- a/src/common/handles.h
+++ b/src/common/handles.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016-2017, The Tor Project, Inc. */
+/* Copyright (c) 2016-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -51,7 +51,7 @@
#include "orconfig.h"
#include "tor_queue.h"
-#include "util.h"
+#include "common/util.h"
#define HANDLE_ENTRY(name, structname) \
struct name ## _handle_head_t *handle_head
diff --git a/src/common/include.am b/src/common/include.am
index bce3fa20f6..4927f57425 100644
--- a/src/common/include.am
+++ b/src/common/include.am
@@ -1,54 +1,22 @@
noinst_LIBRARIES += \
src/common/libor.a \
- src/common/libor-ctime.a \
- src/common/libor-crypto.a \
src/common/libor-event.a
if UNITTESTS_ENABLED
noinst_LIBRARIES += \
src/common/libor-testing.a \
- src/common/libor-ctime-testing.a \
- src/common/libor-crypto-testing.a \
src/common/libor-event-testing.a
endif
EXTRA_DIST += src/common/Makefile.nmake
-#CFLAGS = -Wall -Wpointer-arith -O2
-AM_CPPFLAGS += -I$(srcdir)/src/common -Isrc/common -I$(srcdir)/src/ext/trunnel -I$(srcdir)/src/trunnel
-
if USE_OPENBSD_MALLOC
libor_extra_source=src/ext/OpenBSD_malloc_Linux.c
else
libor_extra_source=
endif
-src_common_libcurve25519_donna_a_CFLAGS=
-
-if BUILD_CURVE25519_DONNA
-src_common_libcurve25519_donna_a_SOURCES=\
- src/ext/curve25519_donna/curve25519-donna.c
-# See bug 13538 -- this code is known to have signed overflow issues.
-src_common_libcurve25519_donna_a_CFLAGS+=\
- @F_OMIT_FRAME_POINTER@ @CFLAGS_CONSTTIME@
-noinst_LIBRARIES+=src/common/libcurve25519_donna.a
-LIBDONNA=src/common/libcurve25519_donna.a
-else
-if BUILD_CURVE25519_DONNA_C64
-src_common_libcurve25519_donna_a_CFLAGS+=@CFLAGS_CONSTTIME@
-src_common_libcurve25519_donna_a_SOURCES=\
- src/ext/curve25519_donna/curve25519-donna-c64.c
-noinst_LIBRARIES+=src/common/libcurve25519_donna.a
-LIBDONNA=src/common/libcurve25519_donna.a
-else
-LIBDONNA=
-endif
-endif
-
-LIBDONNA += $(LIBED25519_REF10)
-LIBDONNA += $(LIBED25519_DONNA)
-
if THREADS_PTHREADS
threads_impl_source=src/common/compat_pthreads.c
endif
@@ -62,37 +30,16 @@ else
readpassphrase_source=
endif
-if ADD_MULODI4
-mulodi4_source=src/ext/mulodi/mulodi4.c
-else
-mulodi4_source=
-endif
-
-LIBOR_CTIME_A_SRC = \
- $(mulodi4_source) \
- src/ext/csiphash.c \
- src/common/di_ops.c
-
-src_common_libor_ctime_a_SOURCES = $(LIBOR_CTIME_A_SRC)
-src_common_libor_ctime_testing_a_SOURCES = $(LIBOR_CTIME_A_SRC)
-src_common_libor_ctime_a_CFLAGS = @CFLAGS_CONSTTIME@
-src_common_libor_ctime_testing_a_CFLAGS = @CFLAGS_CONSTTIME@ $(TEST_CFLAGS)
-
LIBOR_A_SRC = \
src/common/address.c \
src/common/address_set.c \
- src/common/backtrace.c \
src/common/buffers.c \
src/common/compat.c \
src/common/compat_threads.c \
src/common/compat_time.c \
src/common/confline.c \
- src/common/container.c \
- src/common/log.c \
src/common/memarea.c \
- src/common/pubsub.c \
src/common/util.c \
- src/common/util_bug.c \
src/common/util_format.c \
src/common/util_process.c \
src/common/sandbox.c \
@@ -106,27 +53,6 @@ LIBOR_A_SRC = \
src/common/src_common_libor_testing_a-log.$(OBJEXT) \
src/common/log.$(OBJEXT): micro-revision.i
-LIBOR_CRYPTO_A_SRC = \
- src/common/aes.c \
- src/common/buffers_tls.c \
- src/common/compress.c \
- src/common/compress_lzma.c \
- src/common/compress_none.c \
- src/common/compress_zlib.c \
- src/common/compress_zstd.c \
- src/common/crypto.c \
- src/common/crypto_digest.c \
- src/common/crypto_format.c \
- src/common/crypto_openssl_mgt.c \
- src/common/crypto_pwbox.c \
- src/common/crypto_rand.c \
- src/common/crypto_rsa.c \
- src/common/crypto_s2k.c \
- src/common/crypto_util.c \
- src/common/tortls.c \
- src/common/crypto_curve25519.c \
- src/common/crypto_ed25519.c
-
LIBOR_EVENT_A_SRC = \
src/common/compat_libevent.c \
src/common/procmon.c \
@@ -134,70 +60,41 @@ LIBOR_EVENT_A_SRC = \
src/ext/timeouts/timeout.c
src_common_libor_a_SOURCES = $(LIBOR_A_SRC)
-src_common_libor_crypto_a_SOURCES = $(LIBOR_CRYPTO_A_SRC)
src_common_libor_event_a_SOURCES = $(LIBOR_EVENT_A_SRC)
+if UNITTESTS_ENABLED
src_common_libor_testing_a_SOURCES = $(LIBOR_A_SRC)
-src_common_libor_crypto_testing_a_SOURCES = $(LIBOR_CRYPTO_A_SRC)
src_common_libor_event_testing_a_SOURCES = $(LIBOR_EVENT_A_SRC)
+else
+src_common_libor_testing_a_SOURCES =
+src_common_libor_event_testing_a_SOURCES =
+endif
src_common_libor_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
-src_common_libor_crypto_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
src_common_libor_event_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
src_common_libor_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
-src_common_libor_crypto_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
src_common_libor_event_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
COMMONHEADERS = \
src/common/address.h \
src/common/address_set.h \
- src/common/backtrace.h \
src/common/buffers.h \
- src/common/buffers_tls.h \
- src/common/aes.h \
- src/common/ciphers.inc \
src/common/compat.h \
src/common/compat_libevent.h \
- src/common/compat_openssl.h \
src/common/compat_threads.h \
src/common/compat_time.h \
- src/common/compress.h \
- src/common/compress_lzma.h \
- src/common/compress_none.h \
- src/common/compress_zlib.h \
- src/common/compress_zstd.h \
src/common/confline.h \
- src/common/container.h \
- src/common/crypto.h \
- src/common/crypto_digest.h \
- src/common/crypto_curve25519.h \
- src/common/crypto_ed25519.h \
- src/common/crypto_format.h \
- src/common/crypto_openssl_mgt.h \
- src/common/crypto_pwbox.h \
- src/common/crypto_rand.h \
- src/common/crypto_rsa.h \
- src/common/crypto_s2k.h \
- src/common/crypto_util.h \
- src/common/di_ops.h \
src/common/handles.h \
src/common/memarea.h \
src/common/linux_syscalls.inc \
src/common/procmon.h \
- src/common/pubsub.h \
src/common/sandbox.h \
src/common/storagedir.h \
- src/common/testsupport.h \
src/common/timers.h \
src/common/token_bucket.h \
- src/common/torint.h \
- src/common/torlog.h \
- src/common/tortls.h \
src/common/util.h \
- src/common/util_bug.h \
src/common/util_format.h \
src/common/util_process.h \
src/common/workqueue.h
noinst_HEADERS+= $(COMMONHEADERS)
-
diff --git a/src/common/memarea.c b/src/common/memarea.c
index 68c1625fe4..589277ba3d 100644
--- a/src/common/memarea.c
+++ b/src/common/memarea.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2017, The Tor Project, Inc. */
+/* Copyright (c) 2008-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/** \file memarea.c
@@ -9,11 +9,10 @@
#include "orconfig.h"
#include <stddef.h>
#include <stdlib.h>
-#include "memarea.h"
-#include "util.h"
-#include "compat.h"
-#include "torlog.h"
-#include "container.h"
+#include "common/memarea.h"
+#include "common/util.h"
+#include "common/compat.h"
+#include "lib/log/torlog.h"
#ifndef DISABLE_MEMORY_SENTINELS
diff --git a/src/common/memarea.h b/src/common/memarea.h
index 5207e8a5bd..7dc7ec1fed 100644
--- a/src/common/memarea.h
+++ b/src/common/memarea.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2017, The Tor Project, Inc. */
+/* Copyright (c) 2008-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/* Tor dependencies */
diff --git a/src/common/procmon.c b/src/common/procmon.c
index 73c14cd584..7703b88afd 100644
--- a/src/common/procmon.c
+++ b/src/common/procmon.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2017, The Tor Project, Inc. */
+/* Copyright (c) 2011-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -6,9 +6,9 @@
* \brief Process-termination monitor functions
**/
-#include "procmon.h"
+#include "common/procmon.h"
-#include "util.h"
+#include "common/util.h"
#ifdef HAVE_SIGNAL_H
#include <signal.h>
diff --git a/src/common/procmon.h b/src/common/procmon.h
index 63777e4111..246ddd71d0 100644
--- a/src/common/procmon.h
+++ b/src/common/procmon.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2017, The Tor Project, Inc. */
+/* Copyright (c) 2011-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -9,10 +9,10 @@
#ifndef TOR_PROCMON_H
#define TOR_PROCMON_H
-#include "compat.h"
-#include "compat_libevent.h"
+#include "common/compat.h"
+#include "common/compat_libevent.h"
-#include "torlog.h"
+#include "lib/log/torlog.h"
typedef struct tor_process_monitor_t tor_process_monitor_t;
diff --git a/src/common/pubsub.c b/src/common/pubsub.c
deleted file mode 100644
index 336e8a6e7f..0000000000
--- a/src/common/pubsub.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Copyright (c) 2016-2017, The Tor Project, Inc. */
-/* See LICENSE for licensing information */
-
-/**
- * \file pubsub.c
- *
- * \brief DOCDOC
- */
-
-#include "orconfig.h"
-#include "pubsub.h"
-#include "container.h"
-
-/** Helper: insert <b>s</b> into <b>topic's</b> list of subscribers, keeping
- * them sorted in priority order. */
-static void
-subscriber_insert(pubsub_topic_t *topic, pubsub_subscriber_t *s)
-{
- int i;
- smartlist_t *sl = topic->subscribers;
- for (i = 0; i < smartlist_len(sl); ++i) {
- pubsub_subscriber_t *other = smartlist_get(sl, i);
- if (s->priority < other->priority) {
- break;
- }
- }
- smartlist_insert(sl, i, s);
-}
-
-/**
- * Add a new subscriber to <b>topic</b>, where (when an event is triggered),
- * we'll notify the function <b>fn</b> by passing it <b>subscriber_data</b>.
- * Return a handle to the subscribe which can later be passed to
- * pubsub_unsubscribe_().
- *
- * Functions are called in priority order, from lowest to highest.
- *
- * See pubsub.h for <b>subscribe_flags</b>.
- */
-const pubsub_subscriber_t *
-pubsub_subscribe_(pubsub_topic_t *topic,
- pubsub_subscriber_fn_t fn,
- void *subscriber_data,
- unsigned subscribe_flags,
- unsigned priority)
-{
- tor_assert(! topic->locked);
- if (subscribe_flags & SUBSCRIBE_ATSTART) {
- tor_assert(topic->n_events_fired == 0);
- }
- pubsub_subscriber_t *r = tor_malloc_zero(sizeof(*r));
- r->priority = priority;
- r->subscriber_flags = subscribe_flags;
- r->fn = fn;
- r->subscriber_data = subscriber_data;
- if (topic->subscribers == NULL) {
- topic->subscribers = smartlist_new();
- }
- subscriber_insert(topic, r);
- return r;
-}
-
-/**
- * Remove the subscriber <b>s</b> from <b>topic</b>. After calling this
- * function, <b>s</b> may no longer be used.
- */
-int
-pubsub_unsubscribe_(pubsub_topic_t *topic,
- const pubsub_subscriber_t *s)
-{
- tor_assert(! topic->locked);
- smartlist_t *sl = topic->subscribers;
- if (sl == NULL)
- return -1;
- int i = smartlist_pos(sl, s);
- if (i == -1)
- return -1;
- pubsub_subscriber_t *tmp = smartlist_get(sl, i);
- tor_assert(tmp == s);
- smartlist_del_keeporder(sl, i);
- tor_free(tmp);
- return 0;
-}
-
-/**
- * For every subscriber s in <b>topic</b>, invoke notify_fn on s and
- * event_data. Return 0 if there were no nonzero return values, and -1 if
- * there were any.
- */
-int
-pubsub_notify_(pubsub_topic_t *topic, pubsub_notify_fn_t notify_fn,
- void *event_data, unsigned notify_flags)
-{
- tor_assert(! topic->locked);
- (void) notify_flags;
- smartlist_t *sl = topic->subscribers;
- int n_bad = 0;
- ++topic->n_events_fired;
- if (sl == NULL)
- return -1;
- topic->locked = 1;
- SMARTLIST_FOREACH_BEGIN(sl, pubsub_subscriber_t *, s) {
- int r = notify_fn(s, event_data);
- if (r != 0)
- ++n_bad;
- } SMARTLIST_FOREACH_END(s);
- topic->locked = 0;
- return (n_bad == 0) ? 0 : -1;
-}
-
-/**
- * Release all storage held by <b>topic</b>.
- */
-void
-pubsub_clear_(pubsub_topic_t *topic)
-{
- tor_assert(! topic->locked);
-
- smartlist_t *sl = topic->subscribers;
- if (sl == NULL)
- return;
- SMARTLIST_FOREACH_BEGIN(sl, pubsub_subscriber_t *, s) {
- tor_free(s);
- } SMARTLIST_FOREACH_END(s);
- smartlist_free(sl);
- topic->subscribers = NULL;
- topic->n_events_fired = 0;
-}
-
diff --git a/src/common/pubsub.h b/src/common/pubsub.h
deleted file mode 100644
index 2bee3af085..0000000000
--- a/src/common/pubsub.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/* Copyright (c) 2016-2017, The Tor Project, Inc. */
-/* See LICENSE for licensing information */
-
-/**
- * \file pubsub.h
- * \brief Macros to implement publish/subscribe abstractions.
- *
- * To use these macros, call DECLARE_PUBSUB_TOPIC() with an identifier to use
- * as your topic. Below, I'm going to assume you say DECLARE_PUBSUB_TOPIC(T).
- *
- * Doing this will declare the following types:
- * typedef struct T_event_data_t T_event_data_t; // you define this struct
- * typedef struct T_subscriber_data_t T_subscriber_data_t; // this one too.
- * typedef struct T_subscriber_t T_subscriber_t; // opaque
- * typedef int (*T_subscriber_fn_t)(T_event_data_t*, T_subscriber_data_t*);
- *
- * and it will declare the following functions:
- * const T_subscriber_t *T_subscribe(T_subscriber_fn_t,
- * T_subscriber_data_t *,
- * unsigned flags,
- * unsigned priority);
- * int T_unsubscribe(const T_subscriber_t *)
- *
- * Elsewhere you can say DECLARE_NOTIFY_PUBSUB_TOPIC(static, T), which
- * declares:
- *
- * static int T_notify(T_event_data_t *, unsigned notify_flags);
- * static void T_clear(void);
- *
- * And in some C file, you would define these functions with:
- * IMPLEMENT_PUBSUB_TOPIC(static, T).
- *
- * The implementations will be small typesafe wrappers over generic versions
- * of the above functions.
- *
- * To use the typesafe functions, you add any number of subscribers with
- * T_subscribe(). Each has an associated function pointer, data pointer,
- * and priority. Later, you can invoke T_notify() to declare that the
- * event has occurred. Each of the subscribers will be invoked once.
- **/
-
-#ifndef TOR_PUBSUB_H
-#define TOR_PUBSUB_H
-
-#include "torint.h"
-
-/**
- * Flag for T_subscribe: die with an assertion failure if the event
- * have ever been published before. Used when a subscriber must absolutely
- * never have missed an event.
- */
-#define SUBSCRIBE_ATSTART (1u<<0)
-
-#define DECLARE_PUBSUB_STRUCT_TYPES(name) \
- /* You define this type. */ \
- typedef struct name ## _event_data_t name ## _event_data_t; \
- /* You define this type. */ \
- typedef struct name ## _subscriber_data_t name ## _subscriber_data_t;
-
-#define DECLARE_PUBSUB_TOPIC(name) \
- /* This type is opaque. */ \
- typedef struct name ## _subscriber_t name ## _subscriber_t; \
- /* You declare functions matching this type. */ \
- typedef int (*name ## _subscriber_fn_t)( \
- name ## _event_data_t *data, \
- name ## _subscriber_data_t *extra); \
- /* Call this function to subscribe to a topic. */ \
- const name ## _subscriber_t *name ## _subscribe( \
- name##_subscriber_fn_t subscriber, \
- name##_subscriber_data_t *extra_data, \
- unsigned flags, \
- unsigned priority); \
- /* Call this function to unsubscribe from a topic. */ \
- int name ## _unsubscribe(const name##_subscriber_t *s);
-
-#define DECLARE_NOTIFY_PUBSUB_TOPIC(linkage, name) \
- /* Call this function to notify all subscribers. Flags not yet used. */ \
- linkage int name ## _notify(name ## _event_data_t *data, unsigned flags); \
- /* Call this function to release storage held by the topic. */ \
- linkage void name ## _clear(void);
-
-/**
- * Type used to hold a generic function for a subscriber.
- *
- * [Yes, it is safe to cast to this, so long as we cast back to the original
- * type before calling. From C99: "A pointer to a function of one type may be
- * converted to a pointer to a function of another type and back again; the
- * result shall compare equal to the original pointer."]
-*/
-typedef int (*pubsub_subscriber_fn_t)(void *, void *);
-
-/**
- * Helper type to implement pubsub abstraction. Don't use this directly.
- * It represents a subscriber.
- */
-typedef struct pubsub_subscriber_t {
- /** Function to invoke when the event triggers. */
- pubsub_subscriber_fn_t fn;
- /** Data associated with this subscriber. */
- void *subscriber_data;
- /** Priority for this subscriber. Low priorities happen first. */
- unsigned priority;
- /** Flags set on this subscriber. Not yet used.*/
- unsigned subscriber_flags;
-} pubsub_subscriber_t;
-
-/**
- * Helper type to implement pubsub abstraction. Don't use this directly.
- * It represents a topic, and keeps a record of subscribers.
- */
-typedef struct pubsub_topic_t {
- /** List of subscribers to this topic. May be NULL. */
- struct smartlist_t *subscribers;
- /** Total number of times that pubsub_notify_() has ever been called on this
- * topic. */
- uint64_t n_events_fired;
- /** True iff we're running 'notify' on this topic, and shouldn't allow
- * any concurrent modifications or events. */
- unsigned locked;
-} pubsub_topic_t;
-
-const pubsub_subscriber_t *pubsub_subscribe_(pubsub_topic_t *topic,
- pubsub_subscriber_fn_t fn,
- void *subscriber_data,
- unsigned subscribe_flags,
- unsigned priority);
-int pubsub_unsubscribe_(pubsub_topic_t *topic, const pubsub_subscriber_t *sub);
-void pubsub_clear_(pubsub_topic_t *topic);
-typedef int (*pubsub_notify_fn_t)(pubsub_subscriber_t *subscriber,
- void *notify_data);
-int pubsub_notify_(pubsub_topic_t *topic, pubsub_notify_fn_t notify_fn,
- void *notify_data, unsigned notify_flags);
-
-#define IMPLEMENT_PUBSUB_TOPIC(notify_linkage, name) \
- static pubsub_topic_t name ## _topic_ = { NULL, 0, 0 }; \
- const name ## _subscriber_t * \
- name ## _subscribe(name##_subscriber_fn_t subscriber, \
- name##_subscriber_data_t *extra_data, \
- unsigned flags, \
- unsigned priority) \
- { \
- const pubsub_subscriber_t *s; \
- s = pubsub_subscribe_(&name##_topic_, \
- (pubsub_subscriber_fn_t)subscriber, \
- extra_data, \
- flags, \
- priority); \
- return (const name##_subscriber_t *)s; \
- } \
- int \
- name ## _unsubscribe(const name##_subscriber_t *subscriber) \
- { \
- return pubsub_unsubscribe_(&name##_topic_, \
- (const pubsub_subscriber_t *)subscriber); \
- } \
- static int \
- name##_call_the_notify_fn_(pubsub_subscriber_t *subscriber, \
- void *notify_data) \
- { \
- name ## _subscriber_fn_t fn; \
- fn = (name ## _subscriber_fn_t) subscriber->fn; \
- return fn(notify_data, subscriber->subscriber_data); \
- } \
- notify_linkage int \
- name ## _notify(name ## _event_data_t *event_data, unsigned flags) \
- { \
- return pubsub_notify_(&name##_topic_, \
- name##_call_the_notify_fn_, \
- event_data, \
- flags); \
- } \
- notify_linkage void \
- name ## _clear(void) \
- { \
- pubsub_clear_(&name##_topic_); \
- }
-
-#endif /* !defined(TOR_PUBSUB_H) */
-
diff --git a/src/common/sandbox.c b/src/common/sandbox.c
index 440f8722f2..b41b8f4ba5 100644
--- a/src/common/sandbox.c
+++ b/src/common/sandbox.c
@@ -1,7 +1,7 @@
- /* Copyright (c) 2001 Matej Pfajfar.
+/* Copyright (c) 2001 Matej Pfajfar.
* Copyright (c) 2001-2004, Roger Dingledine.
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -32,15 +32,18 @@
#include <string.h>
#include <stdlib.h>
-#include "sandbox.h"
-#include "container.h"
-#include "torlog.h"
-#include "torint.h"
-#include "util.h"
+#include "common/sandbox.h"
+#include "lib/container/map.h"
+#include "lib/err/torerr.h"
+#include "lib/log/torlog.h"
+#include "lib/cc/torint.h"
+#include "common/util.h"
#include "tor_queue.h"
#include "ht.h"
+#include "siphash.h"
+
#define DEBUGGING_CLOSE
#if defined(USE_LIBSECCOMP)
@@ -79,7 +82,7 @@
defined(HAVE_BACKTRACE_SYMBOLS_FD) && defined(HAVE_SIGACTION)
#define USE_BACKTRACE
#define EXPOSE_CLEAN_BACKTRACE
-#include "backtrace.h"
+#include "lib/err/backtrace.h"
#endif /* defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && ... */
#ifdef USE_BACKTRACE
@@ -1974,4 +1977,3 @@ sandbox_disable_getaddrinfo_cache(void)
{
}
#endif /* !defined(USE_LIBSECCOMP) */
-
diff --git a/src/common/sandbox.h b/src/common/sandbox.h
index d0f85570f4..f7c990e013 100644
--- a/src/common/sandbox.h
+++ b/src/common/sandbox.h
@@ -1,7 +1,7 @@
/* Copyright (c) 2001 Matej Pfajfar.
* Copyright (c) 2001-2004, Roger Dingledine.
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -13,7 +13,7 @@
#define SANDBOX_H_
#include "orconfig.h"
-#include "torint.h"
+#include "lib/cc/torint.h"
#ifndef SYS_SECCOMP
diff --git a/src/common/storagedir.c b/src/common/storagedir.c
index e2c7b4bb87..10b2301274 100644
--- a/src/common/storagedir.c
+++ b/src/common/storagedir.c
@@ -1,14 +1,14 @@
-/* Copyright (c) 2017, The Tor Project, Inc. */
+/* Copyright (c) 2017-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
-#include "container.h"
-#include "compat.h"
-#include "confline.h"
-#include "memarea.h"
-#include "sandbox.h"
-#include "storagedir.h"
-#include "torlog.h"
-#include "util.h"
+#include "lib/container/smartlist.h"
+#include "common/compat.h"
+#include "common/confline.h"
+#include "common/memarea.h"
+#include "common/sandbox.h"
+#include "common/storagedir.h"
+#include "lib/log/torlog.h"
+#include "common/util.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -583,4 +583,3 @@ storage_dir_get_max_files(storage_dir_t *d)
{
return d->max_files;
}
-
diff --git a/src/common/storagedir.h b/src/common/storagedir.h
index d99bd7ec52..3b46c20b5d 100644
--- a/src/common/storagedir.h
+++ b/src/common/storagedir.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017, The Tor Project, Inc. */
+/* Copyright (c) 2017-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
#ifndef TOR_STORAGEDIR_H
diff --git a/src/common/timers.c b/src/common/timers.c
index 6f6236ed3b..72562f4cf5 100644
--- a/src/common/timers.c
+++ b/src/common/timers.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016-2017, The Tor Project, Inc. */
+/* Copyright (c) 2016-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -31,11 +31,11 @@
#define TOR_TIMERS_PRIVATE
-#include "compat.h"
-#include "compat_libevent.h"
-#include "timers.h"
-#include "torlog.h"
-#include "util.h"
+#include "common/compat.h"
+#include "common/compat_libevent.h"
+#include "common/timers.h"
+#include "lib/log/torlog.h"
+#include "common/util.h"
struct timeout_cb {
timer_cb_fn_t cb;
diff --git a/src/common/timers.h b/src/common/timers.h
index 6d27f3e01e..2348c7b7c1 100644
--- a/src/common/timers.h
+++ b/src/common/timers.h
@@ -1,11 +1,11 @@
-/* Copyright (c) 2016-2017, The Tor Project, Inc. */
+/* Copyright (c) 2016-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
#ifndef TOR_TIMERS_H
#define TOR_TIMERS_H
#include "orconfig.h"
-#include "testsupport.h"
+#include "lib/testsupport/testsupport.h"
struct monotime_t;
typedef struct timeout tor_timer_t;
diff --git a/src/common/token_bucket.c b/src/common/token_bucket.c
index f2396ec58a..3a16720d7f 100644
--- a/src/common/token_bucket.c
+++ b/src/common/token_bucket.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2018, The Tor Project, Inc. */
+/* Copyright (c) 2018-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -18,8 +18,9 @@
#define TOKEN_BUCKET_PRIVATE
-#include "token_bucket.h"
-#include "util_bug.h"
+#include "common/token_bucket.h"
+#include "common/compat.h"
+#include "lib/log/util_bug.h"
/**
* Set the <b>rate</b> and <b>burst</b> value in a token_bucket_cfg.
@@ -252,4 +253,3 @@ token_bucket_rw_dec(token_bucket_rw_t *bucket,
flags |= TB_WRITE;
return flags;
}
-
diff --git a/src/common/token_bucket.h b/src/common/token_bucket.h
index 0e7832e838..787317fa1f 100644
--- a/src/common/token_bucket.h
+++ b/src/common/token_bucket.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2018, The Tor Project, Inc. */
+/* Copyright (c) 2018-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -9,8 +9,8 @@
#ifndef TOR_TOKEN_BUCKET_H
#define TOR_TOKEN_BUCKET_H
-#include "torint.h"
-#include "testsupport.h"
+#include "lib/cc/torint.h"
+#include "lib/testsupport/testsupport.h"
/** Largest allowable burst value for a token buffer. */
#define TOKEN_BUCKET_MAX_BURST INT32_MAX
diff --git a/src/common/util.c b/src/common/util.c
index 53e4507f1f..fa95f933cb 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1,6 +1,6 @@
/* Copyright (c) 2003, Roger Dingledine
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -14,16 +14,17 @@
#include <fcntl.h>
#endif
#define UTIL_PRIVATE
-#include "util.h"
-#include "torlog.h"
-#include "crypto_digest.h"
-#include "torint.h"
-#include "container.h"
-#include "address.h"
-#include "sandbox.h"
-#include "backtrace.h"
-#include "util_process.h"
-#include "util_format.h"
+#include "common/util.h"
+#include "lib/log/torlog.h"
+#include "lib/crypt_ops/crypto_digest.h"
+#include "lib/cc/torint.h"
+#include "lib/container/smartlist.h"
+#include "lib/fdio/fdio.h"
+#include "common/address.h"
+#include "common/sandbox.h"
+#include "lib/err/backtrace.h"
+#include "common/util_process.h"
+#include "common/util_format.h"
#ifdef _WIN32
#include <io.h>
@@ -45,7 +46,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <signal.h>
#ifdef HAVE_NETINET_IN_H
@@ -96,254 +96,9 @@
#include <sys/prctl.h>
#endif
-#ifdef __clang_analyzer__
-#undef MALLOC_ZERO_WORKS
-#endif
-
/* =====
* Memory management
* ===== */
-#ifdef USE_DMALLOC
- #undef strndup
- #include <dmalloc.h>
- /* Macro to pass the extra dmalloc args to another function. */
- #define DMALLOC_FN_ARGS , file, line
-
- #if defined(HAVE_DMALLOC_STRDUP)
- /* the dmalloc_strdup should be fine as defined */
- #elif defined(HAVE_DMALLOC_STRNDUP)
- #define dmalloc_strdup(file, line, string, xalloc_b) \
- dmalloc_strndup(file, line, (string), -1, xalloc_b)
- #else
- #error "No dmalloc_strdup or equivalent"
-#endif /* defined(HAVE_DMALLOC_STRDUP) || ... */
-
-#else /* !(defined(USE_DMALLOC)) */
-
- #define DMALLOC_FN_ARGS
-#endif /* defined(USE_DMALLOC) */
-
-/** Allocate a chunk of <b>size</b> bytes of memory, and return a pointer to
- * result. On error, log and terminate the process. (Same as malloc(size),
- * but never returns NULL.)
- *
- * <b>file</b> and <b>line</b> are used if dmalloc is enabled, and
- * ignored otherwise.
- */
-void *
-tor_malloc_(size_t size DMALLOC_PARAMS)
-{
- void *result;
-
- tor_assert(size < SIZE_T_CEILING);
-
-#ifndef MALLOC_ZERO_WORKS
- /* Some libc mallocs don't work when size==0. Override them. */
- if (size==0) {
- size=1;
- }
-#endif /* !defined(MALLOC_ZERO_WORKS) */
-
-#ifdef USE_DMALLOC
- result = dmalloc_malloc(file, line, size, DMALLOC_FUNC_MALLOC, 0, 0);
-#else
- result = raw_malloc(size);
-#endif
-
- if (PREDICT_UNLIKELY(result == NULL)) {
- /* LCOV_EXCL_START */
- log_err(LD_MM,"Out of memory on malloc(). Dying.");
- /* If these functions die within a worker process, they won't call
- * spawn_exit, but that's ok, since the parent will run out of memory soon
- * anyway. */
- exit(1); // exit ok: alloc failed.
- /* LCOV_EXCL_STOP */
- }
- return result;
-}
-
-/** Allocate a chunk of <b>size</b> bytes of memory, fill the memory with
- * zero bytes, and return a pointer to the result. Log and terminate
- * the process on error. (Same as calloc(size,1), but never returns NULL.)
- */
-void *
-tor_malloc_zero_(size_t size DMALLOC_PARAMS)
-{
- /* You may ask yourself, "wouldn't it be smart to use calloc instead of
- * malloc+memset? Perhaps libc's calloc knows some nifty optimization trick
- * we don't!" Indeed it does, but its optimizations are only a big win when
- * we're allocating something very big (it knows if it just got the memory
- * from the OS in a pre-zeroed state). We don't want to use tor_malloc_zero
- * for big stuff, so we don't bother with calloc. */
- void *result = tor_malloc_(size DMALLOC_FN_ARGS);
- memset(result, 0, size);
- return result;
-}
-
-/* The square root of SIZE_MAX + 1. If a is less than this, and b is less
- * than this, then a*b is less than SIZE_MAX. (For example, if size_t is
- * 32 bits, then SIZE_MAX is 0xffffffff and this value is 0x10000. If a and
- * b are less than this, then their product is at most (65535*65535) ==
- * 0xfffe0001. */
-#define SQRT_SIZE_MAX_P1 (((size_t)1) << (sizeof(size_t)*4))
-
-/** Return non-zero if and only if the product of the arguments is exact,
- * and cannot overflow. */
-int
-size_mul_check(const size_t x, const size_t y)
-{
- /* This first check is equivalent to
- (x < SQRT_SIZE_MAX_P1 && y < SQRT_SIZE_MAX_P1)
-
- Rationale: if either one of x or y is >= SQRT_SIZE_MAX_P1, then it
- will have some bit set in its most significant half.
- */
- return ((x|y) < SQRT_SIZE_MAX_P1 ||
- y == 0 ||
- x <= SIZE_MAX / y);
-}
-
-/** Allocate a chunk of <b>nmemb</b>*<b>size</b> bytes of memory, fill
- * the memory with zero bytes, and return a pointer to the result.
- * Log and terminate the process on error. (Same as
- * calloc(<b>nmemb</b>,<b>size</b>), but never returns NULL.)
- * The second argument (<b>size</b>) should preferably be non-zero
- * and a compile-time constant.
- */
-void *
-tor_calloc_(size_t nmemb, size_t size DMALLOC_PARAMS)
-{
- tor_assert(size_mul_check(nmemb, size));
- return tor_malloc_zero_((nmemb * size) DMALLOC_FN_ARGS);
-}
-
-/** Change the size of the memory block pointed to by <b>ptr</b> to <b>size</b>
- * bytes long; return the new memory block. On error, log and
- * terminate. (Like realloc(ptr,size), but never returns NULL.)
- */
-void *
-tor_realloc_(void *ptr, size_t size DMALLOC_PARAMS)
-{
- void *result;
-
- tor_assert(size < SIZE_T_CEILING);
-
-#ifndef MALLOC_ZERO_WORKS
- /* Some libc mallocs don't work when size==0. Override them. */
- if (size==0) {
- size=1;
- }
-#endif /* !defined(MALLOC_ZERO_WORKS) */
-
-#ifdef USE_DMALLOC
- result = dmalloc_realloc(file, line, ptr, size, DMALLOC_FUNC_REALLOC, 0);
-#else
- result = raw_realloc(ptr, size);
-#endif
-
- if (PREDICT_UNLIKELY(result == NULL)) {
- /* LCOV_EXCL_START */
- log_err(LD_MM,"Out of memory on realloc(). Dying.");
- exit(1); // exit ok: alloc failed.
- /* LCOV_EXCL_STOP */
- }
- return result;
-}
-
-/**
- * Try to realloc <b>ptr</b> so that it takes up sz1 * sz2 bytes. Check for
- * overflow. Unlike other allocation functions, return NULL on overflow.
- */
-void *
-tor_reallocarray_(void *ptr, size_t sz1, size_t sz2 DMALLOC_PARAMS)
-{
- /* XXXX we can make this return 0, but we would need to check all the
- * reallocarray users. */
- tor_assert(size_mul_check(sz1, sz2));
-
- return tor_realloc(ptr, (sz1 * sz2) DMALLOC_FN_ARGS);
-}
-
-/** Return a newly allocated copy of the NUL-terminated string s. On
- * error, log and terminate. (Like strdup(s), but never returns
- * NULL.)
- */
-char *
-tor_strdup_(const char *s DMALLOC_PARAMS)
-{
- char *duplicate;
- tor_assert(s);
-
-#ifdef USE_DMALLOC
- duplicate = dmalloc_strdup(file, line, s, 0);
-#else
- duplicate = raw_strdup(s);
-#endif
- if (PREDICT_UNLIKELY(duplicate == NULL)) {
- /* LCOV_EXCL_START */
- log_err(LD_MM,"Out of memory on strdup(). Dying.");
- exit(1); // exit ok: alloc failed.
- /* LCOV_EXCL_STOP */
- }
- return duplicate;
-}
-
-/** Allocate and return a new string containing the first <b>n</b>
- * characters of <b>s</b>. If <b>s</b> is longer than <b>n</b>
- * characters, only the first <b>n</b> are copied. The result is
- * always NUL-terminated. (Like strndup(s,n), but never returns
- * NULL.)
- */
-char *
-tor_strndup_(const char *s, size_t n DMALLOC_PARAMS)
-{
- char *duplicate;
- tor_assert(s);
- tor_assert(n < SIZE_T_CEILING);
- duplicate = tor_malloc_((n+1) DMALLOC_FN_ARGS);
- /* Performance note: Ordinarily we prefer strlcpy to strncpy. But
- * this function gets called a whole lot, and platform strncpy is
- * much faster than strlcpy when strlen(s) is much longer than n.
- */
- strncpy(duplicate, s, n);
- duplicate[n]='\0';
- return duplicate;
-}
-
-/** Allocate a chunk of <b>len</b> bytes, with the same contents as the
- * <b>len</b> bytes starting at <b>mem</b>. */
-void *
-tor_memdup_(const void *mem, size_t len DMALLOC_PARAMS)
-{
- char *duplicate;
- tor_assert(len < SIZE_T_CEILING);
- tor_assert(mem);
- duplicate = tor_malloc_(len DMALLOC_FN_ARGS);
- memcpy(duplicate, mem, len);
- return duplicate;
-}
-
-/** As tor_memdup(), but add an extra 0 byte at the end of the resulting
- * memory. */
-void *
-tor_memdup_nulterm_(const void *mem, size_t len DMALLOC_PARAMS)
-{
- char *duplicate;
- tor_assert(len < SIZE_T_CEILING+1);
- tor_assert(mem);
- duplicate = tor_malloc_(len+1 DMALLOC_FN_ARGS);
- memcpy(duplicate, mem, len);
- duplicate[len] = '\0';
- return duplicate;
-}
-
-/** Helper for places that need to take a function pointer to the right
- * spelling of "free()". */
-void
-tor_free_(void *mem)
-{
- tor_free(mem);
-}
DISABLE_GCC_WARNING(aggregate-return)
/** Call the platform malloc info function, and dump the results to the log at
@@ -365,13 +120,6 @@ tor_log_mallinfo(int severity)
#else /* !(defined(HAVE_MALLINFO)) */
(void)severity;
#endif /* defined(HAVE_MALLINFO) */
-#ifdef USE_DMALLOC
- dmalloc_log_changed(0, /* Since the program started. */
- 1, /* Log info about non-freed pointers. */
- 0, /* Do not log info about freed pointers. */
- 0 /* Do not log individual pointers. */
- );
-#endif /* defined(USE_DMALLOC) */
}
ENABLE_GCC_WARNING(aggregate-return)
@@ -419,105 +167,6 @@ tor_llround(double d)
#endif /* defined(HAVE_LLROUND) || ... */
}
-/** Returns floor(log2(u64)). If u64 is 0, (incorrectly) returns 0. */
-int
-tor_log2(uint64_t u64)
-{
- int r = 0;
- if (u64 >= (U64_LITERAL(1)<<32)) {
- u64 >>= 32;
- r = 32;
- }
- if (u64 >= (U64_LITERAL(1)<<16)) {
- u64 >>= 16;
- r += 16;
- }
- if (u64 >= (U64_LITERAL(1)<<8)) {
- u64 >>= 8;
- r += 8;
- }
- if (u64 >= (U64_LITERAL(1)<<4)) {
- u64 >>= 4;
- r += 4;
- }
- if (u64 >= (U64_LITERAL(1)<<2)) {
- u64 >>= 2;
- r += 2;
- }
- if (u64 >= (U64_LITERAL(1)<<1)) {
- // u64 >>= 1; // not using this any more.
- r += 1;
- }
- return r;
-}
-
-/** Return the power of 2 in range [1,UINT64_MAX] closest to <b>u64</b>. If
- * there are two powers of 2 equally close, round down. */
-uint64_t
-round_to_power_of_2(uint64_t u64)
-{
- int lg2;
- uint64_t low;
- uint64_t high;
- if (u64 == 0)
- return 1;
-
- lg2 = tor_log2(u64);
- low = U64_LITERAL(1) << lg2;
-
- if (lg2 == 63)
- return low;
-
- high = U64_LITERAL(1) << (lg2+1);
- if (high - u64 < u64 - low)
- return high;
- else
- return low;
-}
-
-/** Return the lowest x such that x is at least <b>number</b>, and x modulo
- * <b>divisor</b> == 0. If no such x can be expressed as an unsigned, return
- * UINT_MAX. Asserts if divisor is zero. */
-unsigned
-round_to_next_multiple_of(unsigned number, unsigned divisor)
-{
- tor_assert(divisor > 0);
- if (UINT_MAX - divisor + 1 < number)
- return UINT_MAX;
- number += divisor - 1;
- number -= number % divisor;
- return number;
-}
-
-/** Return the lowest x such that x is at least <b>number</b>, and x modulo
- * <b>divisor</b> == 0. If no such x can be expressed as a uint32_t, return
- * UINT32_MAX. Asserts if divisor is zero. */
-uint32_t
-round_uint32_to_next_multiple_of(uint32_t number, uint32_t divisor)
-{
- tor_assert(divisor > 0);
- if (UINT32_MAX - divisor + 1 < number)
- return UINT32_MAX;
-
- number += divisor - 1;
- number -= number % divisor;
- return number;
-}
-
-/** Return the lowest x such that x is at least <b>number</b>, and x modulo
- * <b>divisor</b> == 0. If no such x can be expressed as a uint64_t, return
- * UINT64_MAX. Asserts if divisor is zero. */
-uint64_t
-round_uint64_to_next_multiple_of(uint64_t number, uint64_t divisor)
-{
- tor_assert(divisor > 0);
- if (UINT64_MAX - divisor + 1 < number)
- return UINT64_MAX;
- number += divisor - 1;
- number -= number % divisor;
- return number;
-}
-
/** Transform a random value <b>p</b> from the uniform distribution in
* [0.0, 1.0[ into a Laplace distributed value with location parameter
* <b>mu</b> and scale parameter <b>b</b>. Truncate the final result
@@ -572,88 +221,10 @@ add_laplace_noise(int64_t signal_, double random_, double delta_f,
return signal_ + noise;
}
-/* Helper: safely add two uint32_t's, capping at UINT32_MAX rather
- * than overflow */
-uint32_t
-tor_add_u32_nowrap(uint32_t a, uint32_t b)
-{
- /* a+b > UINT32_MAX check, without overflow */
- if (PREDICT_UNLIKELY(a > UINT32_MAX - b)) {
- return UINT32_MAX;
- } else {
- return a+b;
- }
-}
-
-/* Helper: return greatest common divisor of a,b */
-static uint64_t
-gcd64(uint64_t a, uint64_t b)
-{
- while (b) {
- uint64_t t = b;
- b = a % b;
- a = t;
- }
- return a;
-}
-
-/* Given a fraction *<b>numer</b> / *<b>denom</b>, simplify it.
- * Requires that the denominator is greater than 0. */
-void
-simplify_fraction64(uint64_t *numer, uint64_t *denom)
-{
- tor_assert(denom);
- uint64_t gcd = gcd64(*numer, *denom);
- *numer /= gcd;
- *denom /= gcd;
-}
-
-/** Return the number of bits set in <b>v</b>. */
-int
-n_bits_set_u8(uint8_t v)
-{
- static const int nybble_table[] = {
- 0, /* 0000 */
- 1, /* 0001 */
- 1, /* 0010 */
- 2, /* 0011 */
- 1, /* 0100 */
- 2, /* 0101 */
- 2, /* 0110 */
- 3, /* 0111 */
- 1, /* 1000 */
- 2, /* 1001 */
- 2, /* 1010 */
- 3, /* 1011 */
- 2, /* 1100 */
- 3, /* 1101 */
- 3, /* 1110 */
- 4, /* 1111 */
- };
-
- return nybble_table[v & 15] + nybble_table[v>>4];
-}
-
/* =====
* String manipulation
* ===== */
-/** Remove from the string <b>s</b> every character which appears in
- * <b>strip</b>. */
-void
-tor_strstrip(char *s, const char *strip)
-{
- char *readp = s;
- while (*readp) {
- if (strchr(strip, *readp)) {
- ++readp;
- } else {
- *s++ = *readp++;
- }
- }
- *s = '\0';
-}
-
/** Return a pointer to a NUL-terminated hexadecimal string encoding
* the first <b>fromlen</b> bytes of <b>from</b>. (fromlen must be \<= 32.) The
* result does not need to be deallocated, but repeated calls to
@@ -669,145 +240,6 @@ hex_str(const char *from, size_t fromlen)
return buf;
}
-/** Convert all alphabetic characters in the nul-terminated string <b>s</b> to
- * lowercase. */
-void
-tor_strlower(char *s)
-{
- while (*s) {
- *s = TOR_TOLOWER(*s);
- ++s;
- }
-}
-
-/** Convert all alphabetic characters in the nul-terminated string <b>s</b> to
- * lowercase. */
-void
-tor_strupper(char *s)
-{
- while (*s) {
- *s = TOR_TOUPPER(*s);
- ++s;
- }
-}
-
-/** Return 1 if every character in <b>s</b> is printable, else return 0.
- */
-int
-tor_strisprint(const char *s)
-{
- while (*s) {
- if (!TOR_ISPRINT(*s))
- return 0;
- s++;
- }
- return 1;
-}
-
-/** Return 1 if no character in <b>s</b> is uppercase, else return 0.
- */
-int
-tor_strisnonupper(const char *s)
-{
- while (*s) {
- if (TOR_ISUPPER(*s))
- return 0;
- s++;
- }
- return 1;
-}
-
-/** Return true iff every character in <b>s</b> is whitespace space; else
- * return false. */
-int
-tor_strisspace(const char *s)
-{
- while (*s) {
- if (!TOR_ISSPACE(*s))
- return 0;
- s++;
- }
- return 1;
-}
-
-/** As strcmp, except that either string may be NULL. The NULL string is
- * considered to be before any non-NULL string. */
-int
-strcmp_opt(const char *s1, const char *s2)
-{
- if (!s1) {
- if (!s2)
- return 0;
- else
- return -1;
- } else if (!s2) {
- return 1;
- } else {
- return strcmp(s1, s2);
- }
-}
-
-/** Compares the first strlen(s2) characters of s1 with s2. Returns as for
- * strcmp.
- */
-int
-strcmpstart(const char *s1, const char *s2)
-{
- size_t n = strlen(s2);
- return strncmp(s1, s2, n);
-}
-
-/** Compare the s1_len-byte string <b>s1</b> with <b>s2</b>,
- * without depending on a terminating nul in s1. Sorting order is first by
- * length, then lexically; return values are as for strcmp.
- */
-int
-strcmp_len(const char *s1, const char *s2, size_t s1_len)
-{
- size_t s2_len = strlen(s2);
- if (s1_len < s2_len)
- return -1;
- if (s1_len > s2_len)
- return 1;
- return fast_memcmp(s1, s2, s2_len);
-}
-
-/** Compares the first strlen(s2) characters of s1 with s2. Returns as for
- * strcasecmp.
- */
-int
-strcasecmpstart(const char *s1, const char *s2)
-{
- size_t n = strlen(s2);
- return strncasecmp(s1, s2, n);
-}
-
-/** Compares the last strlen(s2) characters of s1 with s2. Returns as for
- * strcmp.
- */
-int
-strcmpend(const char *s1, const char *s2)
-{
- size_t n1 = strlen(s1), n2 = strlen(s2);
- if (n2>n1)
- return strcmp(s1,s2);
- else
- return strncmp(s1+(n1-n2), s2, n2);
-}
-
-/** Compares the last strlen(s2) characters of s1 with s2. Returns as for
- * strcasecmp.
- */
-int
-strcasecmpend(const char *s1, const char *s2)
-{
- size_t n1 = strlen(s1), n2 = strlen(s2);
- if (n2>n1) /* then they can't be the same; figure out which is bigger */
- return strcasecmp(s1,s2);
- else
- return strncasecmp(s1+(n1-n2), s2, n2);
-}
-
/** Compare the value of the string <b>prefix</b> with the start of the
* <b>memlen</b>-byte memory chunk at <b>mem</b>. Return as for strcmp.
*
@@ -824,179 +256,6 @@ fast_memcmpstart(const void *mem, size_t memlen,
return fast_memcmp(mem, prefix, plen);
}
-/** Return a pointer to the first char of s that is not whitespace and
- * not a comment, or to the terminating NUL if no such character exists.
- */
-const char *
-eat_whitespace(const char *s)
-{
- tor_assert(s);
-
- while (1) {
- switch (*s) {
- case '\0':
- default:
- return s;
- case ' ':
- case '\t':
- case '\n':
- case '\r':
- ++s;
- break;
- case '#':
- ++s;
- while (*s && *s != '\n')
- ++s;
- }
- }
-}
-
-/** Return a pointer to the first char of s that is not whitespace and
- * not a comment, or to the terminating NUL if no such character exists.
- */
-const char *
-eat_whitespace_eos(const char *s, const char *eos)
-{
- tor_assert(s);
- tor_assert(eos && s <= eos);
-
- while (s < eos) {
- switch (*s) {
- case '\0':
- default:
- return s;
- case ' ':
- case '\t':
- case '\n':
- case '\r':
- ++s;
- break;
- case '#':
- ++s;
- while (s < eos && *s && *s != '\n')
- ++s;
- }
- }
- return s;
-}
-
-/** Return a pointer to the first char of s that is not a space or a tab
- * or a \\r, or to the terminating NUL if no such character exists. */
-const char *
-eat_whitespace_no_nl(const char *s)
-{
- while (*s == ' ' || *s == '\t' || *s == '\r')
- ++s;
- return s;
-}
-
-/** As eat_whitespace_no_nl, but stop at <b>eos</b> whether we have
- * found a non-whitespace character or not. */
-const char *
-eat_whitespace_eos_no_nl(const char *s, const char *eos)
-{
- while (s < eos && (*s == ' ' || *s == '\t' || *s == '\r'))
- ++s;
- return s;
-}
-
-/** Return a pointer to the first char of s that is whitespace or <b>#</b>,
- * or to the terminating NUL if no such character exists.
- */
-const char *
-find_whitespace(const char *s)
-{
- /* tor_assert(s); */
- while (1) {
- switch (*s)
- {
- case '\0':
- case '#':
- case ' ':
- case '\r':
- case '\n':
- case '\t':
- return s;
- default:
- ++s;
- }
- }
-}
-
-/** As find_whitespace, but stop at <b>eos</b> whether we have found a
- * whitespace or not. */
-const char *
-find_whitespace_eos(const char *s, const char *eos)
-{
- /* tor_assert(s); */
- while (s < eos) {
- switch (*s)
- {
- case '\0':
- case '#':
- case ' ':
- case '\r':
- case '\n':
- case '\t':
- return s;
- default:
- ++s;
- }
- }
- return s;
-}
-
-/** Return the first occurrence of <b>needle</b> in <b>haystack</b> that
- * occurs at the start of a line (that is, at the beginning of <b>haystack</b>
- * or immediately after a newline). Return NULL if no such string is found.
- */
-const char *
-find_str_at_start_of_line(const char *haystack, const char *needle)
-{
- size_t needle_len = strlen(needle);
-
- do {
- if (!strncmp(haystack, needle, needle_len))
- return haystack;
-
- haystack = strchr(haystack, '\n');
- if (!haystack)
- return NULL;
- else
- ++haystack;
- } while (*haystack);
-
- return NULL;
-}
-
-/** Returns true if <b>string</b> could be a C identifier.
- A C identifier must begin with a letter or an underscore and the
- rest of its characters can be letters, numbers or underscores. No
- length limit is imposed. */
-int
-string_is_C_identifier(const char *string)
-{
- size_t iter;
- size_t length = strlen(string);
- if (!length)
- return 0;
-
- for (iter = 0; iter < length ; iter++) {
- if (iter == 0) {
- if (!(TOR_ISALPHA(string[iter]) ||
- string[iter] == '_'))
- return 0;
- } else {
- if (!(TOR_ISALPHA(string[iter]) ||
- TOR_ISDIGIT(string[iter]) ||
- string[iter] == '_'))
- return 0;
- }
- }
-
- return 1;
-}
-
/** Return true iff the 'len' bytes at 'mem' are all zero. */
int
tor_mem_is_zero(const char *mem, size_t len)
@@ -2052,88 +1311,6 @@ format_time_interval(char *out, size_t out_len, long interval)
}
/* =====
- * Cached time
- * ===== */
-
-#ifndef TIME_IS_FAST
-/** Cached estimate of the current time. Updated around once per second;
- * may be a few seconds off if we are really busy. This is a hack to avoid
- * calling time(NULL) (which not everybody has optimized) on critical paths.
- */
-static time_t cached_approx_time = 0;
-
-/** Return a cached estimate of the current time from when
- * update_approx_time() was last called. This is a hack to avoid calling
- * time(NULL) on critical paths: please do not even think of calling it
- * anywhere else. */
-time_t
-approx_time(void)
-{
- return cached_approx_time;
-}
-
-/** Update the cached estimate of the current time. This function SHOULD be
- * called once per second, and MUST be called before the first call to
- * get_approx_time. */
-void
-update_approx_time(time_t now)
-{
- cached_approx_time = now;
-}
-#endif /* !defined(TIME_IS_FAST) */
-
-/* =====
- * Rate limiting
- * ===== */
-
-/** If the rate-limiter <b>lim</b> is ready at <b>now</b>, return the number
- * of calls to rate_limit_is_ready (including this one!) since the last time
- * rate_limit_is_ready returned nonzero. Otherwise return 0.
- * If the call number hits <b>RATELIM_TOOMANY</b> limit, drop a warning
- * about this event and stop counting. */
-static int
-rate_limit_is_ready(ratelim_t *lim, time_t now)
-{
- if (lim->rate + lim->last_allowed <= now) {
- int res = lim->n_calls_since_last_time + 1;
- lim->last_allowed = now;
- lim->n_calls_since_last_time = 0;
- return res;
- } else {
- if (lim->n_calls_since_last_time <= RATELIM_TOOMANY) {
- ++lim->n_calls_since_last_time;
- }
-
- return 0;
- }
-}
-
-/** If the rate-limiter <b>lim</b> is ready at <b>now</b>, return a newly
- * allocated string indicating how many messages were suppressed, suitable to
- * append to a log message. Otherwise return NULL. */
-char *
-rate_limit_log(ratelim_t *lim, time_t now)
-{
- int n;
- if ((n = rate_limit_is_ready(lim, now))) {
- if (n == 1) {
- return tor_strdup("");
- } else {
- char *cp=NULL;
- const char *opt_over = (n >= RATELIM_TOOMANY) ? "over " : "";
- /* XXXX this is not exactly correct: the messages could have occurred
- * any time between the old value of lim->allowed and now. */
- tor_asprintf(&cp,
- " [%s%d similar message(s) suppressed in last %d seconds]",
- opt_over, n-1, lim->rate);
- return cp;
- }
- } else {
- return NULL;
- }
-}
-
-/* =====
* File helpers
* ===== */
@@ -2146,7 +1323,7 @@ write_all(tor_socket_t fd, const char *buf, size_t count, int isSocket)
{
size_t written = 0;
ssize_t result;
- tor_assert(count < SSIZE_MAX);
+ raw_assert(count < SSIZE_MAX);
while (written != count) {
if (isSocket)
@@ -3207,342 +2384,6 @@ expand_filename(const char *filename)
#endif /* defined(_WIN32) */
}
-#define MAX_SCANF_WIDTH 9999
-
-/** Helper: given an ASCII-encoded decimal digit, return its numeric value.
- * NOTE: requires that its input be in-bounds. */
-static int
-digit_to_num(char d)
-{
- int num = ((int)d) - (int)'0';
- tor_assert(num <= 9 && num >= 0);
- return num;
-}
-
-/** Helper: Read an unsigned int from *<b>bufp</b> of up to <b>width</b>
- * characters. (Handle arbitrary width if <b>width</b> is less than 0.) On
- * success, store the result in <b>out</b>, advance bufp to the next
- * character, and return 0. On failure, return -1. */
-static int
-scan_unsigned(const char **bufp, unsigned long *out, int width, unsigned base)
-{
- unsigned long result = 0;
- int scanned_so_far = 0;
- const int hex = base==16;
- tor_assert(base == 10 || base == 16);
- if (!bufp || !*bufp || !out)
- return -1;
- if (width<0)
- width=MAX_SCANF_WIDTH;
-
- while (**bufp && (hex?TOR_ISXDIGIT(**bufp):TOR_ISDIGIT(**bufp))
- && scanned_so_far < width) {
- unsigned digit = hex?hex_decode_digit(*(*bufp)++):digit_to_num(*(*bufp)++);
- // Check for overflow beforehand, without actually causing any overflow
- // This preserves functionality on compilers that don't wrap overflow
- // (i.e. that trap or optimise away overflow)
- // result * base + digit > ULONG_MAX
- // result * base > ULONG_MAX - digit
- if (result > (ULONG_MAX - digit)/base)
- return -1; /* Processing this digit would overflow */
- result = result * base + digit;
- ++scanned_so_far;
- }
-
- if (!scanned_so_far) /* No actual digits scanned */
- return -1;
-
- *out = result;
- return 0;
-}
-
-/** Helper: Read an signed int from *<b>bufp</b> of up to <b>width</b>
- * characters. (Handle arbitrary width if <b>width</b> is less than 0.) On
- * success, store the result in <b>out</b>, advance bufp to the next
- * character, and return 0. On failure, return -1. */
-static int
-scan_signed(const char **bufp, long *out, int width)
-{
- int neg = 0;
- unsigned long result = 0;
-
- if (!bufp || !*bufp || !out)
- return -1;
- if (width<0)
- width=MAX_SCANF_WIDTH;
-
- if (**bufp == '-') {
- neg = 1;
- ++*bufp;
- --width;
- }
-
- if (scan_unsigned(bufp, &result, width, 10) < 0)
- return -1;
-
- if (neg && result > 0) {
- if (result > ((unsigned long)LONG_MAX) + 1)
- return -1; /* Underflow */
- else if (result == ((unsigned long)LONG_MAX) + 1)
- *out = LONG_MIN;
- else {
- /* We once had a far more clever no-overflow conversion here, but
- * some versions of GCC apparently ran it into the ground. Now
- * we just check for LONG_MIN explicitly.
- */
- *out = -(long)result;
- }
- } else {
- if (result > LONG_MAX)
- return -1; /* Overflow */
- *out = (long)result;
- }
-
- return 0;
-}
-
-/** Helper: Read a decimal-formatted double from *<b>bufp</b> of up to
- * <b>width</b> characters. (Handle arbitrary width if <b>width</b> is less
- * than 0.) On success, store the result in <b>out</b>, advance bufp to the
- * next character, and return 0. On failure, return -1. */
-static int
-scan_double(const char **bufp, double *out, int width)
-{
- int neg = 0;
- double result = 0;
- int scanned_so_far = 0;
-
- if (!bufp || !*bufp || !out)
- return -1;
- if (width<0)
- width=MAX_SCANF_WIDTH;
-
- if (**bufp == '-') {
- neg = 1;
- ++*bufp;
- }
-
- while (**bufp && TOR_ISDIGIT(**bufp) && scanned_so_far < width) {
- const int digit = digit_to_num(*(*bufp)++);
- result = result * 10 + digit;
- ++scanned_so_far;
- }
- if (**bufp == '.') {
- double fracval = 0, denominator = 1;
- ++*bufp;
- ++scanned_so_far;
- while (**bufp && TOR_ISDIGIT(**bufp) && scanned_so_far < width) {
- const int digit = digit_to_num(*(*bufp)++);
- fracval = fracval * 10 + digit;
- denominator *= 10;
- ++scanned_so_far;
- }
- result += fracval / denominator;
- }
-
- if (!scanned_so_far) /* No actual digits scanned */
- return -1;
-
- *out = neg ? -result : result;
- return 0;
-}
-
-/** Helper: copy up to <b>width</b> non-space characters from <b>bufp</b> to
- * <b>out</b>. Make sure <b>out</b> is nul-terminated. Advance <b>bufp</b>
- * to the next non-space character or the EOS. */
-static int
-scan_string(const char **bufp, char *out, int width)
-{
- int scanned_so_far = 0;
- if (!bufp || !out || width < 0)
- return -1;
- while (**bufp && ! TOR_ISSPACE(**bufp) && scanned_so_far < width) {
- *out++ = *(*bufp)++;
- ++scanned_so_far;
- }
- *out = '\0';
- return 0;
-}
-
-/** Locale-independent, minimal, no-surprises scanf variant, accepting only a
- * restricted pattern format. For more info on what it supports, see
- * tor_sscanf() documentation. */
-int
-tor_vsscanf(const char *buf, const char *pattern, va_list ap)
-{
- int n_matched = 0;
-
- while (*pattern) {
- if (*pattern != '%') {
- if (*buf == *pattern) {
- ++buf;
- ++pattern;
- continue;
- } else {
- return n_matched;
- }
- } else {
- int width = -1;
- int longmod = 0;
- ++pattern;
- if (TOR_ISDIGIT(*pattern)) {
- width = digit_to_num(*pattern++);
- while (TOR_ISDIGIT(*pattern)) {
- width *= 10;
- width += digit_to_num(*pattern++);
- if (width > MAX_SCANF_WIDTH)
- return -1;
- }
- if (!width) /* No zero-width things. */
- return -1;
- }
- if (*pattern == 'l') {
- longmod = 1;
- ++pattern;
- }
- if (*pattern == 'u' || *pattern == 'x') {
- unsigned long u;
- const int base = (*pattern == 'u') ? 10 : 16;
- if (!*buf)
- return n_matched;
- if (scan_unsigned(&buf, &u, width, base)<0)
- return n_matched;
- if (longmod) {
- unsigned long *out = va_arg(ap, unsigned long *);
- *out = u;
- } else {
- unsigned *out = va_arg(ap, unsigned *);
- if (u > UINT_MAX)
- return n_matched;
- *out = (unsigned) u;
- }
- ++pattern;
- ++n_matched;
- } else if (*pattern == 'f') {
- double *d = va_arg(ap, double *);
- if (!longmod)
- return -1; /* float not supported */
- if (!*buf)
- return n_matched;
- if (scan_double(&buf, d, width)<0)
- return n_matched;
- ++pattern;
- ++n_matched;
- } else if (*pattern == 'd') {
- long lng=0;
- if (scan_signed(&buf, &lng, width)<0)
- return n_matched;
- if (longmod) {
- long *out = va_arg(ap, long *);
- *out = lng;
- } else {
- int *out = va_arg(ap, int *);
-#if LONG_MAX > INT_MAX
- if (lng < INT_MIN || lng > INT_MAX)
- return n_matched;
-#endif
- *out = (int)lng;
- }
- ++pattern;
- ++n_matched;
- } else if (*pattern == 's') {
- char *s = va_arg(ap, char *);
- if (longmod)
- return -1;
- if (width < 0)
- return -1;
- if (scan_string(&buf, s, width)<0)
- return n_matched;
- ++pattern;
- ++n_matched;
- } else if (*pattern == 'c') {
- char *ch = va_arg(ap, char *);
- if (longmod)
- return -1;
- if (width != -1)
- return -1;
- if (!*buf)
- return n_matched;
- *ch = *buf++;
- ++pattern;
- ++n_matched;
- } else if (*pattern == '%') {
- if (*buf != '%')
- return n_matched;
- if (longmod)
- return -1;
- ++buf;
- ++pattern;
- } else {
- return -1; /* Unrecognized pattern component. */
- }
- }
- }
-
- return n_matched;
-}
-
-/** Minimal sscanf replacement: parse <b>buf</b> according to <b>pattern</b>
- * and store the results in the corresponding argument fields. Differs from
- * sscanf in that:
- * <ul><li>It only handles %u, %lu, %x, %lx, %[NUM]s, %d, %ld, %lf, and %c.
- * <li>It only handles decimal inputs for %lf. (12.3, not 1.23e1)
- * <li>It does not handle arbitrarily long widths.
- * <li>Numbers do not consume any space characters.
- * <li>It is locale-independent.
- * <li>%u and %x do not consume any space.
- * <li>It returns -1 on malformed patterns.</ul>
- *
- * (As with other locale-independent functions, we need this to parse data that
- * is in ASCII without worrying that the C library's locale-handling will make
- * miscellaneous characters look like numbers, spaces, and so on.)
- */
-int
-tor_sscanf(const char *buf, const char *pattern, ...)
-{
- int r;
- va_list ap;
- va_start(ap, pattern);
- r = tor_vsscanf(buf, pattern, ap);
- va_end(ap);
- return r;
-}
-
-/** Append the string produced by tor_asprintf(<b>pattern</b>, <b>...</b>)
- * to <b>sl</b>. */
-void
-smartlist_add_asprintf(struct smartlist_t *sl, const char *pattern, ...)
-{
- va_list ap;
- va_start(ap, pattern);
- smartlist_add_vasprintf(sl, pattern, ap);
- va_end(ap);
-}
-
-/** va_list-based backend of smartlist_add_asprintf. */
-void
-smartlist_add_vasprintf(struct smartlist_t *sl, const char *pattern,
- va_list args)
-{
- char *str = NULL;
-
- tor_vasprintf(&str, pattern, args);
- tor_assert(str != NULL);
-
- smartlist_add(sl, str);
-}
-
-/** Append a copy of string to sl */
-void
-smartlist_add_strdup(struct smartlist_t *sl, const char *string)
-{
- char *copy;
-
- copy = tor_strdup(string);
-
- smartlist_add(sl, copy);
-}
-
/** Return a new list containing the filenames in the directory <b>dirname</b>.
* Return NULL on error or if <b>dirname</b> is not a directory.
*/
@@ -3906,85 +2747,6 @@ tor_join_win_cmdline(const char *argv[])
return joined_argv;
}
-/* As format_{hex,dex}_number_sigsafe, but takes a <b>radix</b> argument
- * in range 2..16 inclusive. */
-static int
-format_number_sigsafe(unsigned long x, char *buf, int buf_len,
- unsigned int radix)
-{
- unsigned long tmp;
- int len;
- char *cp;
-
- /* NOT tor_assert. This needs to be safe to run from within a signal handler,
- * and from within the 'tor_assert() has failed' code. */
- if (radix < 2 || radix > 16)
- return 0;
-
- /* Count how many digits we need. */
- tmp = x;
- len = 1;
- while (tmp >= radix) {
- tmp /= radix;
- ++len;
- }
-
- /* Not long enough */
- if (!buf || len >= buf_len)
- return 0;
-
- cp = buf + len;
- *cp = '\0';
- do {
- unsigned digit = (unsigned) (x % radix);
- tor_assert(cp > buf);
- --cp;
- *cp = "0123456789ABCDEF"[digit];
- x /= radix;
- } while (x);
-
- /* NOT tor_assert; see above. */
- if (cp != buf) {
- abort(); // LCOV_EXCL_LINE
- }
-
- return len;
-}
-
-/**
- * Helper function to output hex numbers from within a signal handler.
- *
- * Writes the nul-terminated hexadecimal digits of <b>x</b> into a buffer
- * <b>buf</b> of size <b>buf_len</b>, and return the actual number of digits
- * written, not counting the terminal NUL.
- *
- * If there is insufficient space, write nothing and return 0.
- *
- * This accepts an unsigned int because format_helper_exit_status() needs to
- * call it with a signed int and an unsigned char, and since the C standard
- * does not guarantee that an int is wider than a char (an int must be at
- * least 16 bits but it is permitted for a char to be that wide as well), we
- * can't assume a signed int is sufficient to accommodate an unsigned char.
- * Thus, format_helper_exit_status() will still need to emit any require '-'
- * on its own.
- *
- * For most purposes, you'd want to use tor_snprintf("%x") instead of this
- * function; it's designed to be used in code paths where you can't call
- * arbitrary C functions.
- */
-int
-format_hex_number_sigsafe(unsigned long x, char *buf, int buf_len)
-{
- return format_number_sigsafe(x, buf, buf_len, 16);
-}
-
-/** As format_hex_number_sigsafe, but format the number in base 10. */
-int
-format_dec_number_sigsafe(unsigned long x, char *buf, int buf_len)
-{
- return format_number_sigsafe(x, buf, buf_len, 10);
-}
-
#ifndef _WIN32
/** Format <b>child_state</b> and <b>saved_errno</b> as a hex string placed in
* <b>hex_errno</b>. Called between fork and _exit, so must be signal-handler
@@ -4801,8 +3563,8 @@ process_environment_t *
process_environment_make(struct smartlist_t *env_vars)
{
process_environment_t *env = tor_malloc_zero(sizeof(process_environment_t));
- size_t n_env_vars = smartlist_len(env_vars);
- size_t i;
+ int n_env_vars = smartlist_len(env_vars);
+ int i;
size_t total_env_length;
smartlist_t *env_vars_sorted;
@@ -4813,7 +3575,7 @@ process_environment_make(struct smartlist_t *env_vars)
total_env_length = 1; /* terminating NUL of terminating empty string */
for (i = 0; i < n_env_vars; ++i) {
- const char *s = smartlist_get(env_vars, i);
+ const char *s = smartlist_get(env_vars, (int)i);
size_t slen = strlen(s);
tor_assert(slen + 1 != 0);
@@ -4843,7 +3605,7 @@ process_environment_make(struct smartlist_t *env_vars)
const char *prev_env_var = NULL;
for (i = 0; i < n_env_vars; ++i) {
- const char *s = smartlist_get(env_vars_sorted, i);
+ const char *s = smartlist_get(env_vars_sorted, (int)i);
size_t slen = strlen(s);
size_t s_name_len = str_num_before(s, '=');
@@ -5375,4 +4137,3 @@ tor_ntohll(uint64_t a)
{
return tor_htonll(a);
}
-
diff --git a/src/common/util.h b/src/common/util.h
index 7172b7da08..d1b4e8fe9e 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -1,6 +1,6 @@
/* Copyright (c) 2003-2004, Roger Dingledine
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -12,17 +12,27 @@
#define TOR_UTIL_H
#include "orconfig.h"
-#include "torint.h"
-#include "compat.h"
-#include "di_ops.h"
-#include "testsupport.h"
+#include "lib/cc/torint.h"
+#include "common/compat.h"
+#include "lib/ctime/di_ops.h"
+#include "lib/testsupport/testsupport.h"
#include <stdio.h>
#include <stdlib.h>
#ifdef _WIN32
/* for the correct alias to struct stat */
#include <sys/stat.h>
#endif
-#include "util_bug.h"
+#include "lib/err/torerr.h"
+#include "lib/malloc/util_malloc.h"
+#include "lib/wallclock/approx_time.h"
+#include "lib/string/util_string.h"
+#include "lib/string/scanf.h"
+#include "lib/intmath/bits.h"
+#include "lib/intmath/addsub.h"
+#include "lib/intmath/muldiv.h"
+#include "lib/intmath/cmp.h"
+#include "lib/log/ratelim.h"
+#include "lib/log/util_bug.h"
#ifndef O_BINARY
#define O_BINARY 0
@@ -34,114 +44,11 @@
#define O_NOFOLLOW 0
#endif
-/* If we're building with dmalloc, we want all of our memory allocation
- * functions to take an extra file/line pair of arguments. If not, not.
- * We define DMALLOC_PARAMS to the extra parameters to insert in the
- * function prototypes, and DMALLOC_ARGS to the extra arguments to add
- * to calls. */
-#ifdef USE_DMALLOC
-#define DMALLOC_PARAMS , const char *file, const int line
-#define DMALLOC_ARGS , SHORT_FILE__, __LINE__
-#else
-#define DMALLOC_PARAMS
-#define DMALLOC_ARGS
-#endif /* defined(USE_DMALLOC) */
-
-/* Memory management */
-void *tor_malloc_(size_t size DMALLOC_PARAMS) ATTR_MALLOC;
-void *tor_malloc_zero_(size_t size DMALLOC_PARAMS) ATTR_MALLOC;
-void *tor_calloc_(size_t nmemb, size_t size DMALLOC_PARAMS) ATTR_MALLOC;
-void *tor_realloc_(void *ptr, size_t size DMALLOC_PARAMS);
-void *tor_reallocarray_(void *ptr, size_t size1, size_t size2 DMALLOC_PARAMS);
-char *tor_strdup_(const char *s DMALLOC_PARAMS) ATTR_MALLOC ATTR_NONNULL((1));
-char *tor_strndup_(const char *s, size_t n DMALLOC_PARAMS)
- ATTR_MALLOC ATTR_NONNULL((1));
-void *tor_memdup_(const void *mem, size_t len DMALLOC_PARAMS)
- ATTR_MALLOC ATTR_NONNULL((1));
-void *tor_memdup_nulterm_(const void *mem, size_t len DMALLOC_PARAMS)
- ATTR_MALLOC ATTR_NONNULL((1));
-void tor_free_(void *mem);
uint64_t tor_htonll(uint64_t a);
uint64_t tor_ntohll(uint64_t a);
-#ifdef USE_DMALLOC
-extern int dmalloc_free(const char *file, const int line, void *pnt,
- const int func_id);
-#define tor_free(p) STMT_BEGIN \
- if (PREDICT_LIKELY((p)!=NULL)) { \
- dmalloc_free(SHORT_FILE__, __LINE__, (p), 0); \
- (p)=NULL; \
- } \
- STMT_END
-#else /* !(defined(USE_DMALLOC)) */
-/** Release memory allocated by tor_malloc, tor_realloc, tor_strdup,
- * etc. Unlike the free() function, the tor_free() macro sets the
- * pointer value to NULL after freeing it.
- *
- * This is a macro. If you need a function pointer to release memory from
- * tor_malloc(), use tor_free_().
- *
- * Note that this macro takes the address of the pointer it is going to
- * free and clear. If that pointer is stored with a nonstandard
- * alignment (eg because of a "packed" pragma) it is not correct to use
- * tor_free().
- */
-#ifdef __GNUC__
-#define tor_free(p) STMT_BEGIN \
- typeof(&(p)) tor_free__tmpvar = &(p); \
- raw_free(*tor_free__tmpvar); \
- *tor_free__tmpvar=NULL; \
- STMT_END
-#else
-#define tor_free(p) STMT_BEGIN \
- raw_free(p); \
- (p)=NULL; \
- STMT_END
-#endif
-#endif /* defined(USE_DMALLOC) */
-
-#define tor_malloc(size) tor_malloc_(size DMALLOC_ARGS)
-#define tor_malloc_zero(size) tor_malloc_zero_(size DMALLOC_ARGS)
-#define tor_calloc(nmemb,size) tor_calloc_(nmemb, size DMALLOC_ARGS)
-#define tor_realloc(ptr, size) tor_realloc_(ptr, size DMALLOC_ARGS)
-#define tor_reallocarray(ptr, sz1, sz2) \
- tor_reallocarray_((ptr), (sz1), (sz2) DMALLOC_ARGS)
-#define tor_strdup(s) tor_strdup_(s DMALLOC_ARGS)
-#define tor_strndup(s, n) tor_strndup_(s, n DMALLOC_ARGS)
-#define tor_memdup(s, n) tor_memdup_(s, n DMALLOC_ARGS)
-#define tor_memdup_nulterm(s, n) tor_memdup_nulterm_(s, n DMALLOC_ARGS)
-
-/* Aliases for the underlying system malloc/realloc/free. Only use
- * them to indicate "I really want the underlying system function, I know
- * what I'm doing." */
-#define raw_malloc malloc
-#define raw_realloc realloc
-#define raw_free free
-#define raw_strdup strdup
void tor_log_mallinfo(int severity);
-/* Helper macro: free a variable of type 'typename' using freefn, and
- * set the variable to NULL.
- */
-#define FREE_AND_NULL(typename, freefn, var) \
- do { \
- /* only evaluate (var) once. */ \
- typename **tmp__free__ptr ## freefn = &(var); \
- freefn(*tmp__free__ptr ## freefn); \
- (*tmp__free__ptr ## freefn) = NULL; \
- } while (0)
-
-/** Macro: yield a pointer to the field at position <b>off</b> within the
- * structure <b>st</b>. Example:
- * <pre>
- * struct a { int foo; int bar; } x;
- * off_t bar_offset = offsetof(struct a, bar);
- * int *bar_p = STRUCT_VAR_P(&x, bar_offset);
- * *bar_p = 3;
- * </pre>
- */
-#define STRUCT_VAR_P(st, off) ((void*) ( ((char*)(st)) + (off) ) )
-
/** Macro: yield a pointer to an enclosing structure given a pointer to
* a substructure at offset <b>off</b>. Example:
* <pre>
@@ -164,54 +71,13 @@ void tor_log_mallinfo(int severity);
double tor_mathlog(double d) ATTR_CONST;
long tor_lround(double d) ATTR_CONST;
int64_t tor_llround(double d) ATTR_CONST;
-int tor_log2(uint64_t u64) ATTR_CONST;
-uint64_t round_to_power_of_2(uint64_t u64);
-unsigned round_to_next_multiple_of(unsigned number, unsigned divisor);
-uint32_t round_uint32_to_next_multiple_of(uint32_t number, uint32_t divisor);
-uint64_t round_uint64_to_next_multiple_of(uint64_t number, uint64_t divisor);
int64_t sample_laplace_distribution(double mu, double b, double p);
int64_t add_laplace_noise(int64_t signal, double random, double delta_f,
double epsilon);
-int n_bits_set_u8(uint8_t v);
int64_t clamp_double_to_int64(double number);
-void simplify_fraction64(uint64_t *numer, uint64_t *denom);
-
-uint32_t tor_add_u32_nowrap(uint32_t a, uint32_t b);
-
-/* Compute the CEIL of <b>a</b> divided by <b>b</b>, for nonnegative <b>a</b>
- * and positive <b>b</b>. Works on integer types only. Not defined if a+(b-1)
- * can overflow. */
-#define CEIL_DIV(a,b) (((a)+((b)-1))/(b))
-
-/* Return <b>v</b> if it's between <b>min</b> and <b>max</b>. Otherwise
- * return <b>min</b> if <b>v</b> is smaller than <b>min</b>, or <b>max</b> if
- * <b>b</b> is larger than <b>max</b>.
- *
- * Requires that <b>min</b> is no more than <b>max</b>. May evaluate any of
- * its arguments more than once! */
-#define CLAMP(min,v,max) \
- ( ((v) < (min)) ? (min) : \
- ((v) > (max)) ? (max) : \
- (v) )
/* String manipulation */
-/** Allowable characters in a hexadecimal string. */
-#define HEX_CHARACTERS "0123456789ABCDEFabcdef"
-void tor_strlower(char *s) ATTR_NONNULL((1));
-void tor_strupper(char *s) ATTR_NONNULL((1));
-int tor_strisprint(const char *s) ATTR_NONNULL((1));
-int tor_strisnonupper(const char *s) ATTR_NONNULL((1));
-int tor_strisspace(const char *s);
-int strcmp_opt(const char *s1, const char *s2);
-int strcmpstart(const char *s1, const char *s2) ATTR_NONNULL((1,2));
-int strcmp_len(const char *s1, const char *s2, size_t len) ATTR_NONNULL((1,2));
-int strcasecmpstart(const char *s1, const char *s2) ATTR_NONNULL((1,2));
-int strcmpend(const char *s1, const char *s2) ATTR_NONNULL((1,2));
-int strcasecmpend(const char *s1, const char *s2) ATTR_NONNULL((1,2));
-int fast_memcmpstart(const void *mem, size_t memlen, const char *prefix);
-
-void tor_strstrip(char *s, const char *strip) ATTR_NONNULL((1,2));
long tor_parse_long(const char *s, int base, long min,
long max, int *ok, char **next);
unsigned long tor_parse_ulong(const char *s, int base, unsigned long min,
@@ -220,16 +86,9 @@ double tor_parse_double(const char *s, double min, double max, int *ok,
char **next);
uint64_t tor_parse_uint64(const char *s, int base, uint64_t min,
uint64_t max, int *ok, char **next);
+
const char *hex_str(const char *from, size_t fromlen) ATTR_NONNULL((1));
-const char *eat_whitespace(const char *s);
-const char *eat_whitespace_eos(const char *s, const char *eos);
-const char *eat_whitespace_no_nl(const char *s);
-const char *eat_whitespace_eos_no_nl(const char *s, const char *eos);
-const char *find_whitespace(const char *s);
-const char *find_whitespace_eos(const char *s, const char *eos);
-const char *find_str_at_start_of_line(const char *haystack,
- const char *needle);
-int string_is_C_identifier(const char *string);
+
int string_is_key_value(int severity, const char *string);
int string_is_valid_dest(const char *string);
int string_is_valid_nonrfc_hostname(const char *string);
@@ -239,6 +98,7 @@ int string_is_valid_ipv6_address(const char *string);
int tor_mem_is_zero(const char *mem, size_t len);
int tor_digest_is_zero(const char *digest);
int tor_digest256_is_zero(const char *digest);
+
char *esc_for_log(const char *string) ATTR_MALLOC;
char *esc_for_log_len(const char *chars, size_t n) ATTR_MALLOC;
const char *escaped(const char *string);
@@ -246,19 +106,6 @@ const char *escaped(const char *string);
char *tor_escape_str_for_pt_args(const char *string,
const char *chars_to_escape);
-struct smartlist_t;
-int tor_vsscanf(const char *buf, const char *pattern, va_list ap) \
- CHECK_SCANF(2, 0);
-int tor_sscanf(const char *buf, const char *pattern, ...)
- CHECK_SCANF(2, 3);
-
-void smartlist_add_asprintf(struct smartlist_t *sl, const char *pattern, ...)
- CHECK_PRINTF(2, 3);
-void smartlist_add_vasprintf(struct smartlist_t *sl, const char *pattern,
- va_list args)
- CHECK_PRINTF(2, 0);
-void smartlist_add_strdup(struct smartlist_t *sl, const char *string);
-
/* Time helpers */
long tv_udiff(const struct timeval *start, const struct timeval *end);
long tv_mdiff(const struct timeval *start, const struct timeval *end);
@@ -280,52 +127,6 @@ int parse_iso_time_nospace(const char *cp, time_t *t);
int parse_http_time(const char *buf, struct tm *tm);
int format_time_interval(char *out, size_t out_len, long interval);
-/* Cached time */
-#ifdef TIME_IS_FAST
-#define approx_time() time(NULL)
-#define update_approx_time(t) STMT_NIL
-#else
-time_t approx_time(void);
-void update_approx_time(time_t now);
-#endif /* defined(TIME_IS_FAST) */
-
-/* Rate-limiter */
-
-/** A ratelim_t remembers how often an event is occurring, and how often
- * it's allowed to occur. Typical usage is something like:
- *
- <pre>
- if (possibly_very_frequent_event()) {
- const int INTERVAL = 300;
- static ratelim_t warning_limit = RATELIM_INIT(INTERVAL);
- char *m;
- if ((m = rate_limit_log(&warning_limit, approx_time()))) {
- log_warn(LD_GENERAL, "The event occurred!%s", m);
- tor_free(m);
- }
- }
- </pre>
-
- As a convenience wrapper for logging, you can replace the above with:
- <pre>
- if (possibly_very_frequent_event()) {
- static ratelim_t warning_limit = RATELIM_INIT(300);
- log_fn_ratelim(&warning_limit, LOG_WARN, LD_GENERAL,
- "The event occurred!");
- }
- </pre>
- */
-typedef struct ratelim_t {
- int rate;
- time_t last_allowed;
- int n_calls_since_last_time;
-} ratelim_t;
-
-#define RATELIM_INIT(r) { (r), 0, 0 }
-#define RATELIM_TOOMANY (16*1000*1000)
-
-char *rate_limit_log(ratelim_t *lim, time_t now);
-
/* File helpers */
ssize_t write_all(tor_socket_t fd, const char *buf, size_t count,int isSocket);
ssize_t read_all(tor_socket_t fd, char *buf, size_t count, int isSocket);
@@ -385,6 +186,7 @@ typedef struct sized_chunk_t {
const char *bytes;
size_t len;
} sized_chunk_t;
+struct smartlist_t;
int write_chunks_to_file(const char *fname, const struct smartlist_t *chunks,
int bin, int no_tempfile);
int append_bytes_to_file(const char *fname, const char *str, size_t len,
@@ -546,9 +348,6 @@ int32_t tor_weak_random_range(tor_weak_rng_t *rng, int32_t top);
* <b>n</b> */
#define tor_weak_random_one_in_n(rng, n) (0==tor_weak_random_range((rng),(n)))
-int format_hex_number_sigsafe(unsigned long x, char *buf, int max_len);
-int format_dec_number_sigsafe(unsigned long x, char *buf, int max_len);
-
#ifdef UTIL_PRIVATE
/* Prototypes for private functions only used by util.c (and unit tests) */
@@ -564,9 +363,4 @@ STATIC int format_helper_exit_status(unsigned char child_state,
#endif /* defined(UTIL_PRIVATE) */
-int size_mul_check(const size_t x, const size_t y);
-
-#define ARRAY_LENGTH(x) ((sizeof(x)) / sizeof(x[0]))
-
#endif /* !defined(TOR_UTIL_H) */
-
diff --git a/src/common/util_format.c b/src/common/util_format.c
index e51757a4e8..04fd59d660 100644
--- a/src/common/util_format.c
+++ b/src/common/util_format.c
@@ -1,7 +1,7 @@
/* Copyright (c) 2001, Matej Pfajfar.
* Copyright (c) 2001-2004, Roger Dingledine.
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -12,10 +12,11 @@
*/
#include "orconfig.h"
-#include "torlog.h"
-#include "util.h"
-#include "util_format.h"
-#include "torint.h"
+#include <stddef.h>
+#include "lib/log/torlog.h"
+#include "common/util.h"
+#include "common/util_format.h"
+#include "lib/cc/torint.h"
#include <stddef.h>
#include <string.h>
@@ -464,39 +465,6 @@ base16_encode(char *dest, size_t destlen, const char *src, size_t srclen)
*cp = '\0';
}
-/** Helper: given a hex digit, return its value, or -1 if it isn't hex. */
-static inline int
-hex_decode_digit_(char c)
-{
- switch (c) {
- case '0': return 0;
- case '1': return 1;
- case '2': return 2;
- case '3': return 3;
- case '4': return 4;
- case '5': return 5;
- case '6': return 6;
- case '7': return 7;
- case '8': return 8;
- case '9': return 9;
- case 'A': case 'a': return 10;
- case 'B': case 'b': return 11;
- case 'C': case 'c': return 12;
- case 'D': case 'd': return 13;
- case 'E': case 'e': return 14;
- case 'F': case 'f': return 15;
- default:
- return -1;
- }
-}
-
-/** Helper: given a hex digit, return its value, or -1 if it isn't hex. */
-int
-hex_decode_digit(char c)
-{
- return hex_decode_digit_(c);
-}
-
/** Given a hexadecimal string of <b>srclen</b> bytes in <b>src</b>, decode
* it and store the result in the <b>destlen</b>-byte buffer at <b>dest</b>.
* Return the number of bytes decoded on success, -1 on failure. If
@@ -519,8 +487,8 @@ base16_decode(char *dest, size_t destlen, const char *src, size_t srclen)
end = src+srclen;
while (src<end) {
- v1 = hex_decode_digit_(*src);
- v2 = hex_decode_digit_(*(src+1));
+ v1 = hex_decode_digit(*src);
+ v2 = hex_decode_digit(*(src+1));
if (v1<0||v2<0)
return -1;
*(uint8_t*)dest = (v1<<4)|v2;
@@ -532,4 +500,3 @@ base16_decode(char *dest, size_t destlen, const char *src, size_t srclen)
return (int) (dest-dest_orig);
}
-
diff --git a/src/common/util_format.h b/src/common/util_format.h
index 0aefe3a44e..713fd0d003 100644
--- a/src/common/util_format.h
+++ b/src/common/util_format.h
@@ -1,14 +1,14 @@
/* Copyright (c) 2001, Matej Pfajfar.
* Copyright (c) 2001-2004, Roger Dingledine.
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
#ifndef TOR_UTIL_FORMAT_H
#define TOR_UTIL_FORMAT_H
-#include "testsupport.h"
-#include "torint.h"
+#include "lib/testsupport/testsupport.h"
+#include "lib/cc/torint.h"
/** @{ */
/** These macros don't check for overflow. Use them only for constant inputs
@@ -44,9 +44,7 @@ void base32_encode(char *dest, size_t destlen, const char *src, size_t srclen);
int base32_decode(char *dest, size_t destlen, const char *src, size_t srclen);
size_t base32_encoded_size(size_t srclen);
-int hex_decode_digit(char c);
void base16_encode(char *dest, size_t destlen, const char *src, size_t srclen);
int base16_decode(char *dest, size_t destlen, const char *src, size_t srclen);
#endif /* !defined(TOR_UTIL_FORMAT_H) */
-
diff --git a/src/common/util_process.c b/src/common/util_process.c
index c2826152e9..321258b694 100644
--- a/src/common/util_process.c
+++ b/src/common/util_process.c
@@ -1,6 +1,6 @@
/* Copyright (c) 2003-2004, Roger Dingledine
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2017, The Tor Project, Inc. */
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -19,10 +19,10 @@
#include <sys/wait.h>
#endif
-#include "compat.h"
-#include "util.h"
-#include "torlog.h"
-#include "util_process.h"
+#include "common/compat.h"
+#include "common/util.h"
+#include "lib/log/torlog.h"
+#include "common/util_process.h"
#include "ht.h"
/* ================================================== */
diff --git a/src/common/util_process.h b/src/common/util_process.h
index c9aa771b77..f637881940 100644
--- a/src/common/util_process.h
+++ b/src/common/util_process.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2017, The Tor Project, Inc. */
+/* Copyright (c) 2011-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
diff --git a/src/common/workqueue.c b/src/common/workqueue.c
index 563a98af96..84945882d6 100644
--- a/src/common/workqueue.c
+++ b/src/common/workqueue.c
@@ -24,14 +24,14 @@
*/
#include "orconfig.h"
-#include "compat.h"
-#include "compat_libevent.h"
-#include "compat_threads.h"
-#include "crypto_rand.h"
-#include "util.h"
-#include "workqueue.h"
+#include "common/compat.h"
+#include "common/compat_libevent.h"
+#include "common/compat_threads.h"
+#include "lib/crypt_ops/crypto_rand.h"
+#include "common/util.h"
+#include "common/workqueue.h"
#include "tor_queue.h"
-#include "torlog.h"
+#include "lib/log/torlog.h"
#include <event2/event.h>
diff --git a/src/common/workqueue.h b/src/common/workqueue.h
index e1fe612e2b..1e0efcb1a2 100644
--- a/src/common/workqueue.h
+++ b/src/common/workqueue.h
@@ -1,10 +1,10 @@
-/* Copyright (c) 2013-2017, The Tor Project, Inc. */
+/* Copyright (c) 2013-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
#ifndef TOR_WORKQUEUE_H
#define TOR_WORKQUEUE_H
-#include "compat.h"
+#include "common/compat.h"
/** A replyqueue is used to tell the main thread about the outcome of
* work that we queued for the workers. */
diff --git a/src/config/geoip b/src/config/geoip
index 9fbb8c4a06..a9fa374a0d 100644
--- a/src/config/geoip
+++ b/src/config/geoip
@@ -1,4 +1,4 @@
-# Last updated based on May 1 2018 Maxmind GeoLite2 Country
+# Last updated based on June 7 2018 Maxmind GeoLite2 Country
# wget https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz
# gunzip GeoLite2-Country.mmdb.gz
# python mmdb-convert.py GeoLite2-Country.mmdb
@@ -595,9 +595,7 @@
86454848,86454855,DE
86454856,86454899,FR
86454900,86454903,GB
-86454904,86455003,FR
-86455004,86455007,ES
-86455008,86455591,FR
+86454904,86455591,FR
86455592,86455595,NL
86455596,86455623,FR
86455624,86455624,DE
@@ -722,9 +720,7 @@
86472952,86472955,PL
86472956,86473087,FR
86473088,86473151,PT
-86473152,86473347,FR
-86473348,86473359,ES
-86473360,86473807,FR
+86473152,86473807,FR
86473808,86473823,GB
86473824,86473839,FR
86473840,86473855,PT
@@ -732,9 +728,7 @@
86474164,86474167,GB
86474168,86474307,FR
86474308,86474311,DE
-86474312,86474391,FR
-86474392,86474395,ES
-86474396,86474467,FR
+86474312,86474467,FR
86474468,86474475,GB
86474476,86474479,DE
86474480,86474527,FR
@@ -1732,7 +1726,7 @@
90516480,90516735,DE
90516736,90516991,RO
90516992,90517503,FR
-90517504,90518527,US
+90517504,90518527,RU
90518528,90520575,KZ
90520576,90528767,RU
90528768,90533887,NL
@@ -1984,7 +1978,9 @@
92737152,92737183,NL
92737184,92737199,FR
92737200,92737215,PL
-92737216,92737611,FR
+92737216,92737279,FR
+92737280,92737311,FI
+92737312,92737611,FR
92737612,92737615,GB
92737616,92737887,FR
92737888,92737903,IT
@@ -2146,9 +2142,7 @@
92761152,92761215,PT
92761216,92761375,FR
92761376,92761391,FI
-92761392,92762055,FR
-92762056,92762059,GB
-92762060,92762127,FR
+92761392,92762127,FR
92762128,92762135,ES
92762136,92762279,FR
92762280,92762283,GB
@@ -2249,7 +2243,9 @@
92786416,92786419,GB
92786420,92786527,FR
92786528,92786535,ES
-92786536,92786827,FR
+92786536,92786655,FR
+92786656,92786671,FI
+92786672,92786827,FR
92786828,92786831,IT
92786832,92786911,FR
92786912,92786927,ES
@@ -2354,8 +2350,8 @@
93417472,93419519,IR
93419520,93421567,IT
93421568,93425663,DE
-93425664,93425919,US
-93425920,93426183,SE
+93425664,93426175,US
+93426176,93426183,SE
93426184,93427711,US
93427712,93429759,NO
93429760,93431807,RU
@@ -2395,9 +2391,7 @@
93753344,93756415,GB
93756416,93757439,FR
93757440,93765631,GB
-93765632,93774847,SE
-93774848,93775871,NO
-93775872,93782015,SE
+93765632,93782015,SE
93782016,93836287,GB
93836288,93836799,NL
93836800,93842351,GB
@@ -2469,8 +2463,7 @@
94184192,94184447,RU
94184448,94186239,SE
94186240,94186495,IT
-94186496,94186751,SE
-94186752,94187007,NL
+94186496,94187007,SE
94187008,94187263,GB
94187264,94187775,SE
94187776,94188031,NO
@@ -2653,7 +2646,9 @@
95569920,95571967,SE
95571968,95574015,RU
95574016,95576063,IT
-95576064,95580159,GB
+95576064,95578624,GB
+95578625,95578879,US
+95578880,95580159,GB
95580160,95582207,NL
95582208,95584255,IT
95584256,95617023,GE
@@ -2703,7 +2698,7 @@
96250880,96251903,UA
96251904,96252159,DE
96252160,96252415,ES
-96252416,96252671,FR
+96252416,96252671,RO
96252672,96252927,NL
96252928,96256511,RU
96256512,96256767,FR
@@ -2812,7 +2807,9 @@
96756000,96756071,FR
96756072,96756079,ES
96756080,96756095,GB
-96756096,96756427,FR
+96756096,96756159,FR
+96756160,96756175,GB
+96756176,96756427,FR
96756428,96756431,ES
96756432,96756543,FR
96756544,96756551,ES
@@ -2829,7 +2826,9 @@
96757884,96757887,ES
96757888,96758247,FR
96758248,96758251,DE
-96758252,96759311,FR
+96758252,96759071,FR
+96759072,96759103,CZ
+96759104,96759311,FR
96759312,96759327,BE
96759328,96759471,FR
96759472,96759487,GB
@@ -3236,16 +3235,13 @@
100329472,100331519,RU
100331520,100335615,TR
100335616,100401151,KZ
-100532224,100536063,RO
-100536064,100536319,DE
-100536320,100547839,RO
+100532224,100540415,DE
+100540416,100544511,US
+100544512,100547583,RO
+100547584,100547839,CZ
100547840,100548095,DE
-100548096,100548607,US
-100548608,100548631,RO
-100548632,100548639,US
-100548640,100548655,RO
-100548656,100548671,US
-100548672,100548872,RO
+100548096,100548863,US
+100548864,100548872,RO
100548873,100548873,TR
100548874,100550143,RO
100550144,100550399,NL
@@ -3253,7 +3249,7 @@
100550656,100550911,RO
100550912,100551167,NL
100551168,100551423,US
-100551424,100551679,RO
+100551424,100551679,DE
100551680,100552191,US
100552192,100552447,GB
100552448,100552703,US
@@ -3265,8 +3261,8 @@
100553984,100554495,DE
100554496,100554751,US
100554752,100555263,DE
-100555264,100555519,US
-100555520,100558847,RO
+100555264,100555775,US
+100555776,100558847,RO
100558848,100559255,DE
100559256,100559263,EG
100559264,100559359,DE
@@ -3566,7 +3562,9 @@
225108480,225108991,FI
225108992,225109503,IN
225109504,225110015,MY
-225110016,225443839,US
+225110016,225112063,US
+225112064,225112575,SG
+225112576,225443839,US
225443840,225705983,JP
225705984,226230271,US
226230272,226361343,KR
@@ -3711,7 +3709,9 @@
265005312,265005567,GB
265005568,265025791,US
265025792,265026047,GB
-265026048,265527295,US
+265026048,265525583,US
+265525584,265525599,GB
+265525600,265527295,US
265527296,265529599,JP
265529600,265529855,US
265529856,265535487,JP
@@ -3728,7 +3728,9 @@
284354560,284356607,IN
284356608,288064511,US
288064512,288065535,CL
-288065536,288151551,US
+288065536,288075775,US
+288075776,288077823,BR
+288077824,288151551,US
288151552,288161791,CA
288161792,288167423,US
288167424,288167935,CA
@@ -3970,7 +3972,13 @@
337920000,337928191,AU
337928192,337932287,US
337932288,337934335,AU
-337934336,344260607,US
+337934336,337987583,US
+337987584,337993727,AE
+337993728,338001919,JP
+338001920,338018303,US
+338018304,338026495,AU
+338026496,338051071,CH
+338051072,344260607,US
344260608,344260863,GB
344260864,344261119,US
344261120,344261778,GB
@@ -4146,8 +4154,8 @@
387825664,387833855,CA
387833856,387975167,US
387975168,387976191,NL
-387976192,387977215,US
-387977216,387978239,NL
+387976192,387977727,US
+387977728,387978239,NL
387978240,387979263,US
387979264,387980287,NL
387980288,387994623,US
@@ -4160,9 +4168,7 @@
388035072,388035583,NL
388035584,388038655,US
388038656,388042751,NL
-388042752,388050943,US
-388050944,388051967,NL
-388051968,388055039,US
+388042752,388055039,US
388055040,388059135,NL
388059136,388084735,US
388084736,388085759,NL
@@ -4172,14 +4178,12 @@
388091904,388095999,NL
388096000,388100095,US
388100096,388101119,NL
-388101120,388139007,US
-388139008,388139263,NL
-388139264,388139519,US
+388101120,388139519,US
388139520,388140031,NL
388140032,388149247,US
388149248,388153343,NL
-388153344,388194303,US
-388194304,388202495,NL
+388153344,388198399,US
+388198400,388202495,NL
388202496,388206591,US
388206592,388207103,NL
388207104,388207871,US
@@ -4224,14 +4228,12 @@
388550656,388554751,NL
388554752,388558847,US
388558848,388562943,NL
-388562944,388567039,US
-388567040,388571135,NL
-388571136,388617215,US
+388562944,388617215,US
388617216,388620287,NL
388620288,388632575,US
388632576,388636671,NL
-388636672,388665343,US
-388665344,388668415,NL
+388636672,388666367,US
+388666368,388668415,NL
388668416,388677631,US
388677632,388681727,NL
388681728,388698111,US
@@ -4250,19 +4252,17 @@
388843520,388844543,NL
388844544,388849663,US
388849664,388853759,NL
-388853760,388856831,US
-388856832,388857343,NL
+388853760,388856575,US
+388856576,388857343,NL
388857344,388857599,US
388857600,388857855,NL
-388857856,388862975,US
-388862976,388865023,NL
+388857856,388863999,US
+388864000,388865023,NL
388865024,388885503,US
388885504,388890623,NL
388890624,388893695,US
388893696,388894719,NL
-388894720,388896767,US
-388896768,388897279,NL
-388897280,388897791,US
+388894720,388897791,US
388897792,388898815,NL
388898816,388919295,US
388919296,388923391,NL
@@ -4280,9 +4280,7 @@
389044224,389045247,NL
389045248,389060607,US
389060608,389061631,NL
-389061632,389076479,US
-389076480,389078015,NL
-389078016,389102079,US
+389061632,389102079,US
389102080,389102591,NL
389102592,389136383,US
389136384,389140479,NL
@@ -4292,8 +4290,8 @@
389165056,389169151,NL
389169152,389177343,US
389177344,389181439,NL
-389181440,389185535,US
-389185536,389201919,NL
+389181440,389189631,US
+389189632,389201919,NL
389201920,389242879,US
389242880,389251071,NL
389251072,389273599,US
@@ -4312,15 +4310,15 @@
389350656,389351423,NL
389351424,389351935,US
389351936,389365759,NL
-389365760,389391359,US
-389391360,389394431,NL
+389365760,389392383,US
+389392384,389394431,NL
389394432,389413375,US
389413376,389413887,NL
389413888,389414911,US
389414912,389419007,NL
389419008,389435391,US
-389435392,389445119,NL
-389445120,389447679,US
+389435392,389445631,NL
+389445632,389447679,US
389447680,389451775,NL
389451776,389455359,US
389455360,389455615,NL
@@ -4488,7 +4486,11 @@
392112816,392112823,GB
392112824,392114895,US
392114896,392114903,TH
-392114904,392245247,US
+392114904,392119039,US
+392119040,392119551,HR
+392119552,392119807,US
+392119808,392120319,HR
+392120320,392245247,US
392245248,392249343,SG
392249344,392257535,HK
392257536,392265727,BR
@@ -4527,11 +4529,7 @@
392611840,392612351,HK
392612352,392617983,US
392617984,392626175,HK
-392626176,392658943,US
-392658944,392659199,JP
-392659200,392659455,US
-392659456,392659583,JP
-392659584,392659807,US
+392626176,392659807,US
392659808,392659823,IE
392659824,392659871,SG
392659872,392659903,NL
@@ -4559,7 +4557,10 @@
392663360,392663391,IE
392663392,392663487,US
392663488,392663519,IE
-392663520,392665855,US
+392663520,392664383,US
+392664384,392664415,IE
+392664416,392664431,NL
+392664432,392665855,US
392665856,392665887,HK
392665888,392665983,US
392665984,392666015,HK
@@ -4611,8 +4612,8 @@
392685056,392685087,IE
392685088,392685103,NL
392685104,392685119,US
-392685120,392685151,IE
-392685152,392686607,US
+392685120,392685135,IE
+392685136,392686607,US
392686608,392686623,AT
392686624,392686639,FI
392686640,392686655,IE
@@ -4788,15 +4789,33 @@
394280960,394281471,US
394289152,394289407,US
394296320,394296831,NL
-394297344,394362879,US
+394297344,394297855,US
+394305536,394305791,CA
+394313728,394313983,US
+394321920,394322175,CA
+394330112,394330367,US
+394338304,394338559,CA
+394346496,394362879,US
394362880,394363135,GB
-394363136,394559743,US
+394363136,394395903,US
+394403840,394404095,CA
+394412032,394445055,US
+394452992,394453247,VG
+394461184,394461439,US
+394469376,394469631,CA
+394477568,394559743,US
+394567680,394567935,CA
394575872,394576383,CA
+394584064,394584319,US
394592256,394593279,US
+394600448,394600703,US
394608640,394608703,CA
394608704,394608711,US
394608712,394608895,CA
-394625024,394756351,US
+394616832,394617087,US
+394625024,394665983,US
+394665984,394666239,CA
+394666240,394756351,US
394772480,394772735,CA
394788864,394854399,US
394854400,394854655,CA
@@ -4869,28 +4888,25 @@
397443072,397443327,US
397459456,397459711,CA
397475840,397541375,US
-397541376,397541887,CA
-397557760,397558015,CA
+397541376,397574143,CA
397574144,397574399,US
397590528,397590783,LC
397606912,397607423,CA
397623296,397623551,US
397639680,397639935,US
397656064,397656319,PR
-397672448,397688831,US
+397672448,397672703,US
397688832,397689087,CA
-397689088,397738239,US
-397754368,397754623,US
+397705216,397770751,US
397770752,397771007,CA
397787136,397787391,US
-397803520,397819903,CA
+397803520,397803775,CA
397819904,397820159,US
-397820160,397852671,CA
+397836288,397836799,CA
397852672,397852927,US
-397852928,397869055,CA
-397869056,397918207,US
+397869056,397902079,US
397918208,397918463,CA
-397918464,398065663,US
+397934592,398065663,US
398065664,398065919,CA
398082048,398082303,JP
398098432,398098687,US
@@ -4898,22 +4914,18 @@
398131200,398196735,US
398196736,398196991,KY
398213120,398213375,US
-398229504,398311423,US
+398229504,398295295,US
398311424,398311679,LC
-398311680,398327807,US
398327808,398328063,PR
398344192,398344447,US
398360576,398360831,CA
398376960,398377215,US
-398393344,398393599,US
-398409728,398409983,US
+398393344,398426111,US
398426112,398426367,CA
398442496,398442751,US
398458880,398500351,US
398500352,398500863,NL
-398500864,398532607,US
-398532608,398536703,NL
-398536704,398566911,US
+398500864,398566911,US
398566912,398567423,NL
398567424,398640127,US
398640128,398641151,NL
@@ -4967,7 +4979,9 @@
399172864,399173119,NL
399173120,399175679,US
399175680,399179775,NL
-399179776,399280127,US
+399179776,399243519,US
+399243520,399243775,NL
+399243776,399280127,US
399280128,399280639,NL
399280640,399280895,US
399280896,399281151,NL
@@ -4977,12 +4991,12 @@
399342336,399342591,NL
399342592,399353855,US
399353856,399354879,NL
-399354880,399355391,US
-399355392,399359999,NL
+399354880,399355903,US
+399355904,399359999,NL
399360000,399367167,US
399367168,399367679,NL
-399367680,399368191,US
-399368192,399378943,NL
+399367680,399377407,US
+399377408,399378943,NL
399378944,399380479,US
399380480,399388671,NL
399388672,399396863,US
@@ -4995,13 +5009,15 @@
399486976,399491071,NL
399491072,399495167,US
399495168,399503359,NL
-399503360,399590399,US
+399503360,399526911,US
+399526912,399527935,NL
+399527936,399590399,US
399590400,399591935,NL
399591936,399594495,US
399594496,399595519,NL
399595520,399598591,US
-399598592,399599615,NL
-399599616,399642623,US
+399598592,399599871,NL
+399599872,399642623,US
399642624,399643647,NL
399643648,399644671,US
399644672,399647231,NL
@@ -5071,7 +5087,9 @@
400144384,400145407,NL
400145408,400154623,US
400154624,400162815,NL
-400162816,400201215,US
+400162816,400186367,US
+400186368,400187391,NL
+400187392,400201215,US
400201216,400202751,NL
400202752,400203775,US
400203776,400211967,NL
@@ -5083,9 +5101,7 @@
400263168,400263679,NL
400263680,400264703,US
400264704,400265215,NL
-400265216,400267263,US
-400267264,400268287,NL
-400268288,400400383,US
+400265216,400400383,US
400400384,400410111,NL
400410112,400411647,US
400411648,400412671,NL
@@ -5311,8 +5327,7 @@
400895360,400895407,US
400895408,400895455,CA
400895456,400895567,US
-400895568,400895615,GB
-400895616,400895663,CA
+400895568,400895663,CA
400895664,400895679,US
400895680,400895711,CA
400895712,400896511,US
@@ -5354,7 +5369,7 @@
400898312,400898319,US
400898320,400898447,CA
400898448,400898495,US
-400898496,400898527,CN
+400898496,400898527,CA
400898528,400898559,US
400898560,400898575,CA
400898576,400898591,US
@@ -5638,8 +5653,7 @@
401393152,401393407,US
401393408,401393663,CA
401393664,401393919,US
-401393920,401394495,CA
-401394496,401394527,CN
+401393920,401394527,CA
401394528,401394559,US
401394560,401395455,CA
401395456,401395711,US
@@ -5758,7 +5772,9 @@
401419776,401420031,CA
401420032,401420287,US
401420288,401420543,CA
-401420544,401547263,US
+401420544,401425407,US
+401425408,401426431,CA
+401426432,401547263,US
401547264,401555455,CA
401555456,402096639,US
402096640,402096895,FR
@@ -5844,7 +5860,9 @@
402243584,402247679,CA
402247680,402249215,US
402249216,402249727,GB
-402249728,402259967,US
+402249728,402253823,US
+402253824,402255871,NL
+402255872,402259967,US
402259968,402260031,CA
402260032,402260039,FI
402260040,402260127,CA
@@ -5901,7 +5919,9 @@
402262752,402262759,US
402262760,402262847,CA
402262848,402262855,US
-402262856,402262927,CA
+402262856,402262871,CA
+402262872,402262879,US
+402262880,402262927,CA
402262928,402262935,US
402262936,402262943,CA
402262944,402262951,US
@@ -6319,7 +6339,7 @@
402531584,402531839,US
402531840,402531935,CA
402531936,402532031,US
-402532032,402532063,CN
+402532032,402532063,CA
402532064,402532095,US
402532096,402532159,CA
402532160,402532231,US
@@ -6686,14 +6706,7 @@
455081984,455213055,AU
455213056,455245823,NP
455245824,455258111,JP
-455258112,455258367,TM
-455258368,455258623,SG
-455258624,455258688,KH
-455258689,455260671,SG
-455260672,455260674,KH
-455260675,455260927,SG
-455260928,455260960,KH
-455260961,455262207,SG
+455258112,455262207,SG
455262208,455270399,JP
455270400,455272447,AU
455272448,455274495,CN
@@ -6801,7 +6814,9 @@
460275712,460277759,AU
460277760,460278783,IN
460278784,460279807,JP
-460279808,460283903,AU
+460279808,460280831,AU
+460280832,460281087,PH
+460281088,460283903,AU
460283904,460292095,KR
460292096,460300287,JP
460300288,460312575,HK
@@ -7134,7 +7149,7 @@
521028608,521028863,RU
521028864,521029119,RO
521029120,521029375,ES
-521029376,521029631,US
+521029376,521029631,RO
521029632,521030399,GB
521030400,521030655,TR
521030656,521031679,FR
@@ -7159,9 +7174,9 @@
521066496,521072639,RO
521072640,521074687,GR
521074688,521074943,EG
-521074944,521075199,RO
+521074944,521075199,GB
521075200,521075327,FR
-521075328,521075455,RO
+521075328,521075455,GB
521075456,521075711,EG
521075712,521076479,RO
521076480,521076735,IN
@@ -7635,9 +7650,7 @@
531428280,531428287,IT
531428288,531428351,GB
531428352,531428359,IT
-531428360,531428487,GB
-531428488,531428495,IT
-531428496,531428599,GB
+531428360,531428599,GB
531428600,531428607,IT
531428608,531430319,GB
531430320,531430327,IT
@@ -7862,13 +7875,15 @@
533837824,533839871,DE
533839872,533856255,IS
533856256,533858303,FR
-533858304,533858751,TR
+533858304,533858671,TR
+533858672,533858687,AT
+533858688,533858751,TR
533858752,533858815,AT
533858816,533858895,TR
533858896,533858903,AT
533858904,533859071,TR
-533859072,533859087,AT
-533859088,533859647,TR
+533859072,533859091,AT
+533859092,533859647,TR
533859648,533859663,AT
533859664,533860351,TR
533862400,533864447,GB
@@ -8160,11 +8175,7 @@
544250532,544436771,US
544436772,544436775,CA
544436776,586153983,US
-586153984,586975999,IE
-586976000,586976088,US
-586976089,586976089,IE
-586976090,586976255,US
-586976256,587006719,IE
+586153984,587006719,IE
587006720,587006975,GB
587006976,587202559,IE
587202560,597295103,US
@@ -8225,13 +8236,12 @@
620701312,620701439,HK
620701440,620701695,JP
620701696,620703743,PK
-620703744,620704767,US
+620703744,620704767,AU
620704768,620705791,BD
620705792,620706815,HK
620707840,620708863,IN
620708864,620709887,HK
620709888,620711935,AU
-620711936,620712959,HK
620712960,620715007,IN
620715008,620716031,AU
620716032,620716287,TW
@@ -8351,15 +8361,14 @@
621417472,621417727,DE
621417728,621418495,NL
621418496,621420543,US
-621420544,621420799,HK
+621420544,621420799,NL
621420800,621421055,SG
621421056,621421567,US
621421568,621422591,NL
621422592,621422847,HK
621422848,621423103,SG
621423104,621423615,US
-621423616,621423871,GB
-621423872,621428735,NL
+621423616,621428735,NL
621428736,621429759,IR
621429760,621430271,DE
621430272,621430527,ES
@@ -8563,7 +8572,7 @@
623794176,623796223,ES
623796224,623798271,GB
623798272,623800319,GE
-623800320,623800575,SE
+623800320,623800575,NL
623800576,623800831,LU
623800832,623801087,BG
623801088,623802367,NL
@@ -9132,9 +9141,7 @@
624688308,624688311,ES
624688312,624688315,FR
624688316,624688319,GB
-624688320,624688383,FR
-624688384,624688399,ES
-624688400,624688435,FR
+624688320,624688435,FR
624688436,624688439,IE
624688440,624688443,ES
624688444,624688487,FR
@@ -9216,9 +9223,7 @@
625518592,625518847,NL
625518848,625519103,US
625519104,625520135,NL
-625520136,625520479,US
-625520480,625520495,NL
-625520496,625520511,US
+625520136,625520511,US
625520512,625520639,NL
625520640,625522687,RU
625522688,625523455,SE
@@ -9253,7 +9258,9 @@
625786880,625795071,PS
625795072,625803263,SA
625803264,625811455,TR
-625811456,625815551,FR
+625811712,625811967,FR
+625812224,625812479,FR
+625814272,625815551,FR
625815552,625817599,IQ
625817600,625817911,NL
625817912,625817915,GB
@@ -9353,18 +9360,14 @@
628847616,628848639,GB
628848640,628850687,DE
628850688,628850943,NO
-628850944,628851199,SE
-628851200,628851231,NO
-628851232,628851263,SE
-628851264,628851285,NO
-628851286,628851286,SE
-628851287,628851295,NO
-628851296,628851327,SE
-628851328,628851455,NO
-628851456,628851486,SE
-628851487,628851519,NO
-628851520,628851551,SE
-628851552,628852723,NO
+628850944,628851486,SE
+628851487,628851487,NO
+628851488,628851489,SE
+628851490,628851490,NO
+628851491,628852479,SE
+628852480,628852607,NO
+628852608,628852671,SE
+628852672,628852723,NO
628852724,628852727,SE
628852728,628852735,NO
628852736,628867071,SE
@@ -9580,7 +9583,7 @@
631025664,631026687,IR
631026688,631027711,RO
631027712,631027967,KR
-631027968,631028223,US
+631027968,631028223,CZ
631028224,631028351,GB
631028352,631028735,US
631028736,631029759,ES
@@ -9624,7 +9627,9 @@
631177216,631242751,IT
631242752,631408581,FR
631408582,631408582,RE
-631408583,632291327,FR
+631408583,631824425,FR
+631824426,631824426,BE
+631824427,632291327,FR
632291328,632815615,IT
632815616,632946687,BE
632946688,632954879,AT
@@ -9969,7 +9974,9 @@
637268992,637270015,US
637270016,637272063,RO
637272064,637272831,RU
-637272832,637275135,DE
+637272832,637274111,DE
+637274112,637274623,SE
+637274624,637275135,DE
637275136,637275391,RU
637275392,637276159,NL
637276160,637278207,RU
@@ -10029,8 +10036,8 @@
639246336,639320063,US
639320064,639328255,CA
639328256,639442943,US
-639442944,639451135,CA
-639451136,641738239,US
+639442944,639444991,CA
+639444992,641738239,US
641738240,641738495,CA
641738496,641761535,US
641761536,641761791,CA
@@ -10249,7 +10256,9 @@
645186560,645187583,CA
645187584,645221119,US
645221120,645222399,CA
-645222400,645224959,US
+645222400,645222655,US
+645222656,645222911,CA
+645222912,645224959,US
645224960,645225215,CA
645225216,645225471,US
645225472,645225983,CA
@@ -10409,7 +10418,9 @@
675455488,675455615,GB
675455616,675455743,AT
675455744,675455871,NL
-675455872,675463167,US
+675455872,675455999,FI
+675456000,675456255,ZA
+675456256,675463167,US
675463168,675463295,KR
675463296,675463423,US
675463424,675463807,KR
@@ -10457,19 +10468,12 @@
676195328,676195359,IE
676195360,676249599,US
676249600,676251647,IN
-676251648,676253731,US
-676253732,676253743,AU
-676253744,676253759,US
-676253760,676253823,AU
-676253824,676253887,US
-676253888,676254207,AU
+676251648,676254207,US
676254208,676254463,NL
676254464,676254719,IE
676254720,676254975,FI
676254976,676255231,AT
-676255232,676255487,US
-676255488,676255743,AU
-676255744,676257535,US
+676255232,676257535,US
676257536,676257791,SG
676257792,676259839,US
676259840,676261887,SG
@@ -10481,7 +10485,7 @@
676313088,676317183,JP
676317184,676317439,MY
676317440,676317951,GB
-676317952,676319231,IE
+676317952,676319231,US
676319232,676319743,JP
676319744,676319999,HK
676320000,676320511,AU
@@ -10492,8 +10496,7 @@
676322048,676322303,IN
676322304,676322815,KR
676322816,676323327,FR
-676323328,676325375,US
-676325376,676331519,IE
+676323328,676331519,US
676331520,676332543,GB
676332544,676333567,FI
676333568,676334591,MY
@@ -10502,9 +10505,7 @@
676338688,676339711,AT
676339712,676341759,KR
676341760,676343807,CA
-676343808,676347903,NL
-676347904,676368383,JP
-676368384,676388863,US
+676343808,676388863,US
676388864,676392959,KR
676392960,676397055,CA
676397056,676401151,US
@@ -10515,21 +10516,19 @@
676421632,676442111,GB
676442112,676454399,JP
676454400,676462591,IN
-676462592,676463103,US
-676463104,676463615,NL
-676463616,676464639,US
-676464640,676465663,NL
+676462592,676465663,US
676465664,676466687,AU
-676466688,676467711,US
-676467712,676495359,NL
+676466688,676469759,US
+676469760,676470783,SG
+676470784,676471807,AU
+676471808,676495359,US
676495360,676503551,KR
676503552,676511743,CA
676511744,676519935,AU
676519936,676524031,FR
-676524032,676525055,NL
+676524032,676525055,US
676525056,676526079,AU
-676526080,676528127,NL
-676528128,676544511,US
+676526080,676544511,US
676544512,676560895,HK
676560896,676659199,US
676659200,676696063,IE
@@ -10553,14 +10552,18 @@
676929536,676954111,US
676954112,676970495,FR
676970496,676978687,KR
-676978688,677020095,US
+676978688,677019647,US
+677019648,677019663,CA
+677019664,677020095,US
677020096,677020127,IE
677020128,677020159,US
677020160,677020191,NL
677020192,677020207,AU
677020208,677020239,US
677020240,677020255,AU
-677020256,677020351,US
+677020256,677020271,US
+677020272,677020303,GB
+677020304,677020351,US
677020352,677020367,CA
677020368,677020383,AU
677020384,677020399,IN
@@ -10618,7 +10621,11 @@
677023392,677023423,AU
677023424,677023455,JP
677023456,677023471,NL
-677023472,677023935,US
+677023472,677023519,US
+677023520,677023583,GB
+677023584,677023647,US
+677023648,677023679,CA
+677023680,677023935,US
677023936,677023967,NL
677023968,677023999,BR
677024000,677024031,IE
@@ -10648,9 +10655,12 @@
677025088,677025151,US
677025152,677025279,IE
677025280,677025311,AU
-677025312,677025407,US
+677025312,677025343,US
+677025344,677025407,GB
677025408,677025535,NL
-677025536,677027839,US
+677025536,677025631,US
+677025632,677025663,CA
+677025664,677027839,US
677027840,677036031,SG
677036032,677057535,US
677057536,677058559,IE
@@ -11222,40 +11232,12 @@
677853952,677853967,AT
677853968,677853983,IE
677853984,677853999,FI
-677854000,677854031,NL
-677854032,677854047,FI
-677854048,677854063,IE
-677854064,677854079,AT
-677854080,677854095,NL
-677854096,677854111,FI
-677854112,677854127,IE
-677854128,677854143,AT
-677854144,677854159,NL
+677854000,677854015,NL
+677854016,677854159,US
677854160,677854175,FI
-677854176,677854191,IE
-677854192,677854207,AT
-677854208,677854223,NL
-677854224,677854239,FI
-677854240,677854255,IE
-677854256,677854271,AT
-677854272,677854287,NL
+677854176,677854287,US
677854288,677854303,FI
-677854304,677854319,IE
-677854320,677854335,AT
-677854336,677854975,US
-677854976,677854991,KR
-677854992,677855007,HK
-677855008,677855023,SG
-677855024,677855039,MY
-677855040,677855055,KR
-677855056,677855071,HK
-677855072,677855087,SG
-677855088,677855103,MY
-677855104,677855119,KR
-677855120,677855135,HK
-677855136,677855151,SG
-677855152,677855167,MY
-677855168,678100991,US
+677854304,678100991,US
678100992,678101247,NL
678101248,678101503,FI
678101504,678101759,AT
@@ -11295,7 +11277,18 @@
678170816,678171007,NL
678171008,678171391,IE
678171392,678171775,NL
-678171776,678200831,US
+678171776,678174911,US
+678174912,678175103,IE
+678175104,678175295,NL
+678175296,678177791,US
+678177792,678178175,IE
+678178176,678178367,US
+678178368,678178751,NL
+678178752,678181103,US
+678181104,678181199,IE
+678181200,678181247,US
+678181248,678181343,NL
+678181344,678200831,US
678200832,678201087,BR
678201088,678202111,US
678202112,678202367,NL
@@ -11367,7 +11360,15 @@
678231296,678231551,BR
678231552,678231807,AU
678231808,678232063,NL
-678232064,678428671,US
+678232064,678248959,US
+678248960,678252031,IE
+678252032,678253567,US
+678253568,678256639,NL
+678256640,678290367,US
+678290368,678290751,IE
+678290752,678290943,US
+678290944,678291327,NL
+678291328,678428671,US
678428672,678436863,IE
678436864,678437887,US
678437888,678438015,IE
@@ -11394,9 +11395,16 @@
678756352,678764543,AU
678764544,678821887,US
678821888,678854655,NL
-678854656,678920191,US
+678854656,678905855,US
+678905856,678907903,AE
+678907904,678908927,CH
+678908928,678920191,US
678920192,678928383,NL
-678928384,679198719,US
+678928384,678930431,US
+678930432,678936575,AE
+678936576,678952959,SG
+678952960,678955007,AE
+678955008,679198719,US
679198720,679215103,AE
679215104,679280639,US
679280640,679297023,AE
@@ -11412,8 +11420,7 @@
679349376,679349503,HK
679349504,679349759,JP
679349760,679350015,AU
-679350016,679350335,GB
-679350336,679350399,US
+679350016,679350399,GB
679350400,679350527,KR
679350528,679350655,BR
679350656,679351039,IN
@@ -11422,7 +11429,9 @@
679351552,679362559,US
679362560,679378943,CN
679378944,679395327,AU
-679395328,679403519,US
+679395328,679395839,AE
+679395840,679396095,CH
+679396096,679403519,US
679403520,679411711,AU
679411712,679428095,US
679428096,679436287,AU
@@ -11601,7 +11610,6 @@
692998144,692999167,NG
692999168,693000191,SL
693000192,693001215,NG
-693001216,693002239,BW
693002240,693002505,GA
693002506,693002506,CM
693002507,693003263,GA
@@ -11617,7 +11625,7 @@
693013504,693014527,ZA
693014528,693015551,GH
693015552,693016575,EG
-693016576,693017599,GA
+693016576,693017087,GA
693017600,693018623,NG
693019648,693020671,ZA
693020672,693021695,TZ
@@ -12719,7 +12727,7 @@
737359872,737361919,NZ
737361920,737364991,HK
737364992,737367039,IN
-737367040,737367807,GB
+737367040,737367807,US
737367808,737368063,DE
737368064,737369087,CN
737369088,737370111,HK
@@ -13025,7 +13033,9 @@
737882112,737883135,JP
737883136,737884159,AU
737884160,737886207,TW
-737886208,737887231,PH
+737886208,737886463,HK
+737886464,737886975,PH
+737886976,737887231,HK
737887232,737888255,KR
737888256,737889279,IN
737889280,737890303,HK
@@ -13050,8 +13060,8 @@
737912320,737912575,AU
737912576,737912703,SG
737912704,737912831,MY
-737912832,737915903,IN
-737915904,737916927,US
+737912832,737916159,IN
+737916160,737916927,US
737916928,737917951,JP
737917952,737918975,IN
737918976,737919999,CN
@@ -13234,7 +13244,9 @@
747672064,747700223,BE
747700224,750649855,US
750649856,750650111,AT
-750650112,755105791,US
+750650112,750651391,US
+750651392,750651647,AU
+750651648,755105791,US
755105792,755179519,CA
755179520,755236863,US
755236864,755237673,CL
@@ -13249,7 +13261,8 @@
755261952,755262463,BO
755262464,755263487,AR
755263488,755269631,BR
-755269632,755270655,HN
+755269632,755270143,HN
+755270144,755270655,US
755270656,755271679,BR
755271680,755272703,HN
755272704,755277823,BR
@@ -13257,7 +13270,8 @@
755279872,755280895,CL
755280896,755281919,HN
755281920,755287039,BR
-755287040,755288063,HN
+755287040,755287551,US
+755287552,755288063,HN
755288064,755289087,EC
755289088,755290111,HN
755290112,755292159,BR
@@ -13398,9 +13412,11 @@
757135360,757137407,JP
757137408,757176319,US
757176320,757176575,FR
-757176576,757186559,US
-757186560,757190655,CA
-757190656,757600255,US
+757176576,757178111,US
+757178112,757178367,IT
+757178368,757188607,US
+757188608,757189119,CA
+757189120,757600255,US
757600256,757604351,CA
757604352,757608447,US
757608448,757609471,SG
@@ -13524,7 +13540,9 @@
757791232,757800959,US
757800960,757801983,HK
757801984,757803007,TW
-757803008,757809151,US
+757803008,757807871,US
+757807872,757808127,RU
+757808128,757809151,US
757809152,757809407,CA
757809408,757809663,RO
757809664,757809919,GB
@@ -13875,7 +13893,6 @@
759182336,759183359,HK
759183360,759184383,AU
759184384,759185407,NZ
-759185408,759186431,HK
759186432,759187455,AU
759187456,759187967,SG
759187968,759188479,TW
@@ -14257,7 +14274,9 @@
762381312,762382335,JP
762382336,762383359,NZ
762383360,762388479,CN
-762388480,762389503,HK
+762388480,762388991,HK
+762388992,762389247,KR
+762389248,762389503,HK
762389504,762390527,AU
762390528,762391551,CN
762391552,762393599,KR
@@ -14298,7 +14317,6 @@
762430464,762431487,AU
762431488,762437631,CN
762437632,762438655,IN
-762438656,762439679,CN
762439680,762440703,AU
762440704,762441727,BD
762441728,762442751,CN
@@ -14350,7 +14368,6 @@
762503168,762504191,IN
762504192,762505215,CN
762505216,762506239,BD
-762506240,762507263,CN
762507264,762510335,IN
762510336,762511359,CN
762511360,762514431,IN
@@ -14398,7 +14415,7 @@
762562560,762563583,CN
762563584,762564607,AU
762564608,762565631,IN
-762565632,762567679,CN
+762565632,762566655,CN
762567680,762568703,MY
762568704,762569727,BD
762569728,762570751,CN
@@ -14409,7 +14426,8 @@
762575872,762578943,IN
762578944,762580479,HK
762580480,762580991,JP
-762580992,762584063,CN
+762580992,762582015,CN
+762583040,762584063,CN
762584064,762585087,IN
762585088,762587135,CN
762587136,762588159,HK
@@ -14743,7 +14761,7 @@
763182080,763183103,IN
763183104,763183615,HK
763183616,763183871,LT
-763183872,763184127,JP
+763183872,763184127,HK
763184128,763185151,IN
763185152,763186175,ID
763186176,763194367,CN
@@ -14855,7 +14873,7 @@
763329536,763331583,CN
763331584,763332607,ID
763332608,763333631,IN
-763333632,763334655,AU
+763333632,763334655,BN
763334656,763336703,CN
763336704,763337727,KH
763337728,763338751,CN
@@ -14879,9 +14897,16 @@
767557632,767623167,ZA
767623168,767688703,HK
767688704,767754239,ZA
-767754240,767819775,HK
+767754240,767754751,HK
+767754752,767755263,KR
+767755264,767756287,NG
+767756288,767806975,HK
+767806976,767807487,KR
+767807488,767819775,HK
767819776,768016383,ZA
-768016384,768081919,US
+768016384,768062207,US
+768062208,768063231,HK
+768063232,768081919,US
768081920,768606207,ZA
768606208,768868351,GH
768868352,769130495,ZM
@@ -15241,28 +15266,32 @@
770263040,770264063,CO
770264064,770268159,BR
770268160,770269183,EC
-770269184,770274303,BR
+770269184,770270207,BR
+770270208,770271231,EC
+770271232,770274303,BR
770274304,770275327,MX
770275328,770280447,BR
770280448,770281471,AR
770281472,770287615,BR
770287616,770288639,CO
770288640,770304511,BR
-770305024,770305535,AR
-770305536,770316287,BR
-770317312,770318335,BR
+770304512,770305535,AR
+770305536,770318335,BR
770318336,770319359,AR
770319360,770325503,BR
770325504,770326527,VE
770326528,770331647,BR
-770331648,770332671,PY
+770331648,770332415,PY
+770332416,770332671,AR
770332672,770333695,BZ
770333696,770338815,BR
770338816,770339839,CW
770339840,770341887,AR
770341888,770350079,BR
770350080,770351103,CL
+770351104,770351615,AR
770351616,770352127,BR
+770352128,770353151,TT
770353152,770354175,BR
770354176,770355199,AR
770355200,770356223,BR
@@ -15276,19 +15305,64 @@
770379776,770384895,BR
770384896,770385919,CL
770385920,770386943,CO
-770386944,770388991,BR
-770390016,770393087,BR
-770394112,770398207,BR
+770386944,770398207,BR
770398208,770399231,AR
770399232,770400255,BR
770400256,770401279,AR
770401280,770406399,BR
770406400,770407423,PY
-770407424,770419711,BR
+770407424,770408447,BR
+770408448,770409471,MX
+770409472,770411519,BR
+770411520,770412543,EC
+770412544,770419711,BR
770419712,770420735,MX
-770420736,770433023,BR
+770420736,770429951,BR
+770429952,770430975,EC
+770430976,770433023,BR
770433024,770433535,CO
+770433536,770433791,BR
+770433792,770434047,PA
+770434048,770435071,DO
+770435072,770440191,BR
+770440192,770441215,MX
+770441216,770447359,BR
770447360,770448383,AR
+770448384,770449407,VE
+770449408,770450431,AR
+770450432,770451455,BR
+770451456,770452479,AR
+770452480,770453503,PE
+770453504,770461695,BR
+770461696,770462719,AR
+770462720,770463743,BR
+770463744,770464767,CL
+770464768,770465791,AR
+770465792,770466815,BR
+770466816,770467839,AR
+770467840,770468863,EC
+770468864,770471935,BR
+770472960,770473983,CL
+770475008,770477055,BR
+770477056,770478079,BZ
+770478080,770479103,BR
+770479104,770480127,EC
+770480128,770483199,BR
+770483200,770484223,CL
+770484224,770485247,EC
+770485248,770485759,PE
+770485760,770486271,CL
+770486272,770488319,BR
+770488320,770489343,CL
+770490368,770491391,BO
+770491392,770503679,BR
+770503680,770504703,PY
+770504704,770514943,BR
+770516992,770518015,BR
+770518016,770519039,PY
+770519040,770520063,DO
+770522112,770528255,BR
+770530304,770540543,BR
770703360,771227647,EG
771227648,771229695,IN
771229696,771230719,CN
@@ -15471,9 +15545,9 @@
772285696,772285951,GR
772285952,772287771,RU
772287772,772287772,NL
-772287773,772316927,RU
-772316928,772317183,KZ
-772317184,772339967,RU
+772287773,772328447,RU
+772328448,772329471,ES
+772329472,772339967,RU
772339968,772340223,NL
772340224,772340735,RU
772340736,772341247,KZ
@@ -16417,9 +16491,7 @@
778677508,778677759,ES
778677760,778678859,FR
778678860,778678863,GB
-778678864,778678919,FR
-778678920,778678927,ES
-778678928,778679212,FR
+778678864,778679212,FR
778679213,778679214,FI
778679215,778679279,FR
778679280,778679295,ES
@@ -16483,7 +16555,9 @@
778690736,778690751,PT
778690752,778691459,FR
778691460,778691463,BE
-778691464,778691763,FR
+778691464,778691543,FR
+778691544,778691551,GB
+778691552,778691763,FR
778691764,778691767,DE
778691768,778691887,FR
778691888,778691895,PT
@@ -16668,7 +16742,7 @@
781545472,781549567,CZ
781549568,781553663,RU
781553664,781557759,PL
-781557760,781565951,UA
+781561856,781565951,UA
781565952,781570047,IT
781570048,781574143,PL
781574144,781578239,RU
@@ -16713,8 +16787,10 @@
781975552,782106623,NO
782106624,782254079,RU
782254080,782270463,UA
-782270464,782311167,RU
-782311168,782311423,CZ
+782270464,782310143,RU
+782310144,782310399,NL
+782310400,782311167,RU
+782311168,782311423,DE
782311424,782313471,RU
782313472,782313727,UA
782313728,782317567,RU
@@ -17271,9 +17347,7 @@
787716096,787718143,NL
787718144,787718911,RU
787718912,787719167,NL
-787719168,787719679,RU
-787719680,787719935,NL
-787719936,787722239,RU
+787719168,787722239,RU
787722240,787722751,NL
787722752,787725311,RU
787725312,787728639,NL
@@ -17392,9 +17466,7 @@
788086784,788094975,BG
788094976,788095231,AU
788095232,788095487,DE
-788095488,788095999,AU
-788096000,788097023,IR
-788097024,788101119,AU
+788095488,788101119,AU
788101120,788103167,IR
788103168,788111359,HU
788111360,788119551,LT
@@ -17557,7 +17629,9 @@
793453218,793453218,HK
793453219,793454975,US
793454976,793454976,HK
-793454977,794329087,US
+793454977,793490778,US
+793490779,793490779,HK
+793490780,794329087,US
794329088,794361855,SG
794361856,794369288,HK
794369289,794369289,CN
@@ -17616,8 +17690,7 @@
825420800,825421823,MY
825421824,825425919,NZ
825425920,825434111,CA
-825434112,825438207,CN
-825438208,825439743,US
+825434112,825439743,US
825439744,825440255,CA
825440256,825442303,CN
825442304,825448447,US
@@ -17738,7 +17811,9 @@
839016960,839017087,US
839017088,839026687,DE
839026688,839027711,US
-839027712,839041023,DE
+839027712,839040599,DE
+839040600,839040607,US
+839040608,839041023,DE
839041024,839042047,US
839042048,839046143,DE
839046144,839047167,US
@@ -17746,7 +17821,9 @@
839081472,839081727,US
839081728,839116543,DE
839116544,839116799,US
-839116800,839119871,DE
+839116800,839117823,DE
+839117824,839118847,US
+839118848,839119871,DE
839119872,839120895,US
839120896,839122943,DE
839122944,839340031,US
@@ -17754,7 +17831,7 @@
839341056,839343103,DE
839343104,839344127,NL
839344128,839348223,US
-839348224,839348479,DE
+839348224,839348479,GB
839348480,839348735,AT
839348736,839348991,GB
839348992,839349247,AT
@@ -17865,9 +17942,25 @@
858136352,858136383,GB
858136384,858148863,FR
858148864,858149887,GB
-858149888,858149951,FR
-858149952,858150015,GB
-858150016,858158111,FR
+858149888,858149919,FR
+858149920,858149935,GB
+858149936,858149951,FR
+858149952,858150079,GB
+858150080,858150271,FR
+858150272,858150335,GB
+858150336,858150391,FR
+858150392,858150463,GB
+858150464,858150591,FR
+858150592,858150655,GB
+858150656,858150783,FR
+858150784,858150911,GB
+858150912,858151455,FR
+858151456,858151471,GB
+858151472,858151935,FR
+858151936,858152959,GB
+858152960,858157055,FR
+858157056,858158079,DE
+858158080,858158111,FR
858158112,858158207,DE
858158208,858158271,FR
858158272,858158399,DE
@@ -17875,7 +17968,26 @@
858158528,858158655,DE
858158656,858158783,FR
858158784,858158847,DE
-858158848,858161151,FR
+858158848,858158975,FR
+858158976,858159039,DE
+858159040,858159167,FR
+858159168,858159231,DE
+858159232,858159295,FR
+858159296,858159359,DE
+858159360,858159627,FR
+858159628,858159631,ES
+858159632,858159639,FR
+858159640,858159643,BE
+858159644,858159647,CZ
+858159648,858159651,NL
+858159652,858159655,PT
+858159656,858159659,FI
+858159660,858159763,FR
+858159764,858159767,DE
+858159768,858159807,FR
+858159808,858159871,DE
+858159872,858160127,FR
+858160128,858161151,DE
858161152,858163199,PL
858163200,858165247,FR
858165248,858165311,PL
@@ -17889,26 +18001,57 @@
858166208,858166271,PL
858166272,858167295,FR
858167296,858167359,PL
-858167360,858169855,FR
+858167360,858167487,FR
+858167488,858167551,PL
+858167552,858167679,FR
+858167680,858167807,PL
+858167808,858168063,FR
+858168064,858168127,PL
+858168128,858168447,FR
+858168448,858168639,PL
+858168640,858169855,FR
858169856,858169983,ES
-858169984,858170195,FR
-858170196,858170207,DE
+858169984,858170199,FR
+858170200,858170207,DE
858170208,858170751,FR
858170752,858170879,IT
858170880,858171023,FR
858171024,858171039,GB
-858171040,858171359,FR
+858171040,858171263,FR
+858171264,858171279,IE
+858171280,858171359,FR
858171360,858171391,NL
858171392,858173055,FR
858173056,858173071,BE
-858173072,858178239,FR
+858173072,858173207,FR
+858173208,858173215,FI
+858173216,858173227,FR
+858173228,858173231,BE
+858173232,858178239,FR
858178240,858178271,GB
-858178272,858193919,FR
+858178272,858179583,FR
+858179584,858179711,ES
+858179712,858181215,FR
+858181216,858181247,CZ
+858181248,858182399,FR
+858182400,858182527,IT
+858182528,858182655,ES
+858182656,858183935,FR
+858183936,858183967,FI
+858183968,858185087,FR
+858185088,858185215,ES
+858185216,858191743,FR
+858191744,858191871,IT
+858191872,858193919,FR
858193920,858259455,SA
858259456,859059509,GB
859059510,859059510,FR
859059511,860094463,GB
-860094464,860159999,FR
+860094464,860094911,FR
+860094912,860094927,IE
+860094928,860096383,FR
+860096384,860096511,ES
+860096512,860159999,FR
860160000,860553215,GB
860553216,860618751,FR
860618752,860684287,GB
@@ -17945,9 +18088,9 @@
865992704,866123775,FR
866123776,866189311,GB
866189312,866254847,FR
-866254848,866360831,GB
-866360832,866361343,DE
-866361344,866844671,GB
+866254848,866361343,GB
+866361344,866385919,NL
+866385920,866844671,GB
866844672,866910207,IE
866910208,867041279,GB
867041280,867172351,NO
@@ -18074,8 +18217,8 @@
872304256,872304311,FR
872304312,872304319,BE
872304320,872304383,IE
-872304384,872304395,FR
-872304396,872304399,CZ
+872304384,872304391,FR
+872304392,872304399,CZ
872304400,872304447,FR
872304448,872304511,ES
872304512,872304831,FR
@@ -18092,9 +18235,7 @@
872306368,872306399,GB
872306400,872307263,FR
872307264,872307327,ES
-872307328,872307391,FR
-872307392,872307455,IT
-872307456,872307743,FR
+872307328,872307743,FR
872307744,872307759,IT
872307760,872308351,FR
872308352,872308371,GB
@@ -18276,7 +18417,9 @@
872347264,872347271,CZ
872347272,872347511,FR
872347512,872347519,ES
-872347520,872348095,FR
+872347520,872347647,FR
+872347648,872347679,GB
+872347680,872348095,FR
872348096,872348159,IT
872348160,872348799,FR
872348800,872348863,BE
@@ -18286,7 +18429,9 @@
872349040,872349055,IT
872349056,872349983,FR
872349984,872350015,GB
-872350016,872350271,FR
+872350016,872350039,FR
+872350040,872350047,NL
+872350048,872350271,FR
872350272,872350335,BE
872350336,872350351,NL
872350352,872350399,FR
@@ -18394,7 +18539,9 @@
872379200,872379263,DE
872379264,872379375,FR
872379376,872379391,GB
-872379392,872379967,FR
+872379392,872379775,FR
+872379776,872379903,IT
+872379904,872379967,FR
872379968,872380031,NL
872380032,872380143,FR
872380144,872380147,DE
@@ -18516,9 +18663,7 @@
872403776,872403839,DE
872403840,872404071,FR
872404072,872404079,PL
-872404080,872404303,FR
-872404304,872404319,IT
-872404320,872404511,FR
+872404080,872404511,FR
872404512,872404543,IT
872404544,872404639,FR
872404640,872404671,PL
@@ -18652,7 +18797,11 @@
878522390,878522391,DE
878522392,878538785,US
878538786,878538787,IE
-878538788,878576895,US
+878538788,878545659,US
+878545660,878545661,GB
+878545662,878545915,US
+878545916,878545917,GB
+878545918,878576895,US
878576896,878577151,IE
878577152,878577407,KR
878577408,878577663,BR
@@ -18781,7 +18930,12 @@
878706704,878706719,BR
878706720,878772223,US
878772224,878772239,BR
-878772240,878788623,US
+878772240,878772255,US
+878772256,878772287,CL
+878772288,878772351,BR
+878772352,878772479,US
+878772480,878772735,BR
+878772736,878788623,US
878788624,878788671,BR
878788672,878789119,US
878789120,878790655,BR
@@ -18805,7 +18959,17 @@
878808992,878809087,US
878809088,878809343,NL
878809344,878809599,IE
-878809600,878821375,US
+878809600,878809855,GB
+878809856,878810111,NL
+878810112,878810239,IE
+878810240,878810367,AT
+878810368,878810623,NL
+878810624,878810879,FR
+878810880,878811135,NL
+878811136,878811263,AT
+878811264,878811391,NL
+878811392,878811519,IE
+878811520,878821375,US
878821376,878821695,NL
878821696,878821759,US
878821760,878822655,NL
@@ -18815,7 +18979,9 @@
878837888,878838143,AU
878838144,878838271,US
878838272,878838527,AU
-878838528,878854143,US
+878838528,878841855,US
+878841856,878841919,ZA
+878841920,878854143,US
878854144,878854207,JP
878854208,878854399,HK
878854400,878854783,SG
@@ -18827,10 +18993,13 @@
878856448,878857087,JP
878857088,878857215,KR
878857216,878857535,AU
-878857536,878857599,US
+878857536,878857567,JP
+878857568,878857599,US
878857600,878857727,JP
-878857728,878857855,HK
-878857856,878862335,US
+878857728,878857983,HK
+878857984,878858239,JP
+878858240,878858367,SG
+878858368,878862335,US
878862336,878862975,HK
878862976,878863103,US
878863104,878863359,HK
@@ -18848,8 +19017,8 @@
879297280,879297535,NL
879297536,879297791,IE
879297792,879345663,US
-879345664,879345919,IN
-879345920,879499263,US
+879345664,879346175,IN
+879346176,879499263,US
879499264,879501311,NL
879501312,879502335,HK
879502336,879503359,BR
@@ -18984,7 +19153,7 @@
879892480,879894527,IN
879894528,879896575,JP
879896576,879897599,IN
-879897600,879899647,US
+879897600,879899647,KR
879899648,879900159,HK
879900160,879900671,US
879900672,879901183,SG
@@ -18993,7 +19162,8 @@
879905792,879906815,IE
879906816,879910911,GB
879910912,879912959,IE
-879912960,879916031,US
+879912960,879915007,FR
+879915008,879916031,US
879916032,879917055,NL
879917056,879918079,IE
879918080,879927295,US
@@ -19030,7 +19200,10 @@
880557568,880557823,CA
880557824,880558079,US
880558080,880574463,CA
-880574464,880807935,US
+880574464,880642559,US
+880642560,880643071,IE
+880643072,880643583,NL
+880643584,880807935,US
880807936,880808191,CA
880808192,880861183,US
880861184,880869375,HK
@@ -19104,8 +19277,8 @@
881906304,881906367,IE
881906368,881906495,DE
881906496,881906559,US
-881906560,881906623,GB
-881906624,881909823,US
+881906560,881906635,GB
+881906636,881909823,US
881909824,881909887,AU
881909888,881909951,SG
881909952,881910079,US
@@ -19265,13 +19438,17 @@
888135680,888135935,HK
888135936,888136447,AU
888136448,888136703,SG
-888136704,888138751,US
-888138752,888139263,AE
-888139264,888139775,US
-888139776,888140031,BR
+888136704,888137471,US
+888137472,888137727,GB
+888137728,888137983,US
+888137984,888138239,AE
+888138240,888139775,US
+888139776,888140031,GB
888140032,888140287,FR
888140288,888140799,NL
-888140800,888274943,US
+888140800,888141823,US
+888141824,888142079,IE
+888142080,888274943,US
888274944,888291327,CA
888291328,888348671,US
888348672,888356863,JP
@@ -19309,17 +19486,7 @@
888758272,889016319,US
889016320,889020415,SG
889020416,889028607,JP
-889028608,889036799,US
-889036800,889039871,IN
-889039872,889041919,JP
-889041920,889042943,NL
-889042944,889043967,IE
-889043968,889046015,KR
-889046016,889048063,CA
-889048064,889050111,AU
-889050112,889051135,SG
-889051136,889052159,HK
-889052160,889135103,US
+889028608,889135103,US
889135104,889143295,AU
889143296,889192447,US
889192448,905969663,DE
@@ -19344,7 +19511,7 @@
908331904,908332847,FR
908332848,908332863,LT
908332864,908332991,FR
-908332992,908333023,GB
+908332992,908333023,CZ
908333024,908333823,FR
908333824,908333951,DE
908333952,908334079,GB
@@ -19356,7 +19523,9 @@
908334952,908334959,ES
908334960,908335871,FR
908335872,908335999,ES
-908336000,908336167,FR
+908336000,908336031,FR
+908336032,908336039,DE
+908336040,908336167,FR
908336168,908336183,ES
908336184,908336215,FR
908336216,908336219,ES
@@ -19437,9 +19606,7 @@
908349504,908349519,LT
908349520,908349647,FR
908349648,908349655,ES
-908349656,908349711,FR
-908349712,908349727,ES
-908349728,908349767,FR
+908349656,908349767,FR
908349768,908349775,ES
908349776,908349823,FR
908349824,908349951,GB
@@ -19545,11 +19712,14 @@
908371968,908374015,PL
908374016,908376127,FR
908376128,908376255,PL
-908376256,908376767,FR
+908376256,908376591,FR
+908376592,908376599,PL
+908376600,908376767,FR
908376768,908376895,PL
908376896,908376959,FR
908376960,908377087,PL
-908377088,908378271,FR
+908377088,908378255,FR
+908378256,908378271,NL
908378272,908378279,ES
908378280,908378383,FR
908378384,908378399,LT
@@ -19601,7 +19771,8 @@
908383016,908383023,ES
908383024,908384511,FR
908384512,908384639,BE
-908384640,908385063,FR
+908384640,908384767,PL
+908384768,908385063,FR
908385064,908385071,ES
908385072,908385407,FR
908385408,908385423,LT
@@ -19909,9 +20080,7 @@
908455488,908455551,PL
908455552,908456831,FR
908456832,908457535,GB
-908457536,908460815,FR
-908460816,908460831,GB
-908460832,908461143,FR
+908457536,908461143,FR
908461144,908461147,ES
908461148,908462063,FR
908462064,908462079,GB
@@ -19923,17 +20092,19 @@
908464720,908464723,GB
908464724,908465759,FR
908465760,908465791,CZ
-908465792,908467967,FR
+908465792,908467323,FR
+908467324,908467327,NL
+908467328,908467967,FR
908467968,908468095,BE
908468096,908472319,FR
908472320,908472575,PL
908472576,908472671,FR
908472672,908472767,PL
908472768,908472831,FR
-908472832,908472895,PL
-908472896,908472959,FR
-908472960,908472991,PL
-908472992,908473215,FR
+908472832,908472991,PL
+908472992,908473023,FR
+908473024,908473087,PL
+908473088,908473215,FR
908473216,908473231,PL
908473232,908473343,FR
908473344,908474367,PL
@@ -20004,9 +20175,9 @@
908499200,908499263,FR
908499264,908499519,DE
908499520,908499583,FR
-908499584,908499711,DE
-908499712,908499967,FR
-908499968,908500991,DE
+908499584,908499775,DE
+908499776,908499903,FR
+908499904,908500991,DE
908500992,908501407,FR
908501408,908501439,GB
908501440,908501791,FR
@@ -20035,10 +20206,16 @@
908512832,908512895,PL
908512896,908513023,FR
908513024,908513087,PL
-908513088,908513535,FR
+908513088,908513343,FR
+908513344,908513375,GB
+908513376,908513535,FR
908513536,908513727,GB
-908513728,908514303,FR
-908514304,908514367,GB
+908513728,908513791,FR
+908513792,908513855,GB
+908513856,908514047,FR
+908514048,908514143,GB
+908514144,908514239,FR
+908514240,908514367,GB
908514368,908514495,FR
908514496,908514591,GB
908514592,908514687,FR
@@ -20727,8 +20904,8 @@
1023246336,1023279103,CN
1023279104,1023311871,IN
1023311872,1023317503,US
-1023317504,1023317759,IN
-1023317760,1023323429,US
+1023317504,1023318015,IN
+1023318016,1023323429,US
1023323430,1023323430,CN
1023323431,1023328255,US
1023328256,1023344639,JP
@@ -21025,7 +21202,9 @@
1041748048,1041748063,DE
1041748064,1041748823,FR
1041748824,1041748831,DE
-1041748832,1041750351,FR
+1041748832,1041748969,FR
+1041748970,1041748970,DE
+1041748971,1041750351,FR
1041750352,1041750367,DE
1041750368,1041752319,FR
1041752320,1041752575,AT
@@ -21198,9 +21377,7 @@
1044685159,1044685159,JE
1044685160,1044685311,GG
1044685312,1044685567,JE
-1044685568,1044692422,GG
-1044692423,1044692423,IM
-1044692424,1044692991,GG
+1044685568,1044692991,GG
1044692992,1044697087,AT
1044697088,1044697343,DE
1044697344,1044698111,AT
@@ -21259,9 +21436,7 @@
1044935184,1044935191,BE
1044935192,1044936115,GB
1044936116,1044936119,BE
-1044936120,1044936487,GB
-1044936488,1044936495,BE
-1044936496,1044936735,GB
+1044936120,1044936735,GB
1044936736,1044936743,BE
1044936744,1044937247,GB
1044937248,1044937255,BE
@@ -21269,7 +21444,9 @@
1044938504,1044938511,LU
1044938512,1044938679,GB
1044938680,1044938687,LU
-1044938688,1044946943,GB
+1044938688,1044938703,GB
+1044938704,1044938711,ES
+1044938712,1044946943,GB
1044946944,1044955135,UA
1044955136,1044963327,NL
1044963328,1044971519,FI
@@ -21372,8 +21549,8 @@
1046323200,1046331391,ES
1046347776,1046413311,IT
1046413312,1046446079,SE
-1046446080,1046481927,DE
-1046481928,1046482951,GB
+1046446080,1046482943,DE
+1046482944,1046482951,GB
1046482952,1046482952,DE
1046482953,1046483199,GB
1046483200,1046483231,DE
@@ -21483,7 +21660,9 @@
1046512584,1046512599,DE
1046512600,1046514687,GB
1046514688,1046517759,DE
-1046517760,1046518359,GB
+1046517760,1046517959,GB
+1046517960,1046517967,DE
+1046517968,1046518359,GB
1046518360,1046518367,DE
1046518368,1046518911,GB
1046518912,1046518975,DE
@@ -21701,7 +21880,6 @@
1047735770,1047735770,DE
1047736552,1047736553,US
1047739838,1047739838,GB
-1047740544,1047740671,DE
1047758474,1047758474,GB
1047758911,1047758911,CZ
1047759119,1047759119,AT
@@ -21800,6 +21978,7 @@
1048985696,1048985711,DE
1048985728,1048985735,DE
1048985792,1048985799,DE
+1048985848,1048985855,DE
1048987480,1048987487,DE
1048991960,1048991967,DE
1048992528,1048992535,DE
@@ -21820,7 +21999,9 @@
1049100288,1049231359,GB
1049231360,1049235144,DE
1049235145,1049235145,FR
-1049235146,1049266175,DE
+1049235146,1049243647,DE
+1049243648,1049247743,GB
+1049247744,1049266175,DE
1049266176,1049268223,ES
1049268224,1049296895,DE
1049296896,1049362431,EG
@@ -22759,7 +22940,6 @@
1053294616,1053294623,AT
1053294656,1053294679,AT
1053295104,1053296639,AT
-1053296896,1053297023,IT
1053297152,1053297663,IT
1053301056,1053301071,FR
1053302780,1053302783,FR
@@ -22931,7 +23111,10 @@
1054277632,1054343167,KW
1054343168,1054351359,NL
1054351360,1054359551,UA
-1054359552,1054363647,GB
+1054359552,1054360575,RO
+1054360576,1054361599,GB
+1054361600,1054362623,RO
+1054362624,1054363647,GB
1054363648,1054367743,RO
1054367744,1054375935,FI
1054375936,1054381571,GB
@@ -23318,9 +23501,13 @@
1071141874,1071141874,HK
1071141875,1071144959,US
1071144960,1071153151,LB
-1071153152,1071170815,US
+1071153152,1071156467,US
+1071156468,1071156471,KR
+1071156472,1071170815,US
1071170816,1071171071,PH
-1071171072,1071201551,US
+1071171072,1071190219,US
+1071190220,1071190220,HK
+1071190221,1071201551,US
1071201552,1071201567,TH
1071201568,1071206911,US
1071206912,1071207167,HK
@@ -23332,15 +23519,20 @@
1071278960,1071278963,SG
1071278964,1071284223,US
1071284224,1071292415,AU
-1071292416,1071301135,US
-1071301136,1071301143,FR
-1071301144,1071318783,US
+1071292416,1071300607,US
+1071300608,1071301631,FR
+1071301632,1071318783,US
1071318784,1071319039,IN
1071319040,1071382975,US
1071382976,1071383039,HK
1071383040,1071477247,US
1071477248,1071480831,CA
-1071480832,1071522817,US
+1071480832,1071514981,US
+1071514982,1071514982,HK
+1071514983,1071515063,US
+1071515064,1071515067,GB
+1071515068,1071515071,ES
+1071515072,1071522817,US
1071522818,1071522818,MW
1071522819,1071726951,US
1071726952,1071726955,IE
@@ -23355,7 +23547,9 @@
1071954424,1071998999,US
1071999000,1071999003,GB
1071999004,1072099327,US
-1072099328,1072099519,DE
+1072099328,1072099479,DE
+1072099480,1072099487,FR
+1072099488,1072099519,DE
1072099520,1072099527,FR
1072099528,1072099535,NL
1072099536,1072099583,DE
@@ -23666,7 +23860,8 @@
1075576897,1075585023,NO
1075585024,1075609599,US
1075609600,1075613695,TT
-1075613696,1075646463,US
+1075613696,1075617791,US
+1075621888,1075646463,US
1075646464,1075650559,CA
1075650560,1075855359,US
1075855360,1075871743,DO
@@ -23748,19 +23943,38 @@
1076049920,1076050175,IL
1076050176,1076174847,US
1076174848,1076178943,BM
-1076178944,1076183807,US
+1076178944,1076183231,US
+1076183232,1076183295,CA
+1076183296,1076183807,US
1076183808,1076184063,CA
-1076184064,1076191743,US
+1076184064,1076185215,US
+1076185216,1076185343,CA
+1076185344,1076185919,US
+1076185920,1076185951,CA
+1076185952,1076186751,US
+1076186752,1076186783,CA
+1076186784,1076189215,US
+1076189216,1076189247,CA
+1076189248,1076190783,US
+1076190784,1076190815,CA
+1076190816,1076191231,US
+1076191232,1076191359,CA
+1076191360,1076191743,US
1076191744,1076191999,CN
-1076192000,1076193375,US
+1076192000,1076192127,US
+1076192128,1076192191,CA
+1076192192,1076193375,US
1076193376,1076193383,PG
-1076193384,1076194559,US
+1076193384,1076194431,US
+1076194432,1076194463,CA
+1076194464,1076194559,US
1076194560,1076194815,CA
1076194816,1076195071,US
1076195072,1076195327,IN
1076195328,1076196095,US
-1076196096,1076196351,CA
-1076196352,1076198655,US
+1076196096,1076196415,CA
+1076196416,1076198527,US
+1076198528,1076198655,CA
1076198656,1076198911,AE
1076198912,1076302439,US
1076302440,1076302447,CA
@@ -23774,7 +23988,8 @@
1076323840,1076324095,CH
1076324096,1076338687,US
1076338688,1076346879,CA
-1076346880,1076387839,US
+1076346880,1076363263,US
+1076371456,1076387839,US
1076387840,1076393727,CA
1076393728,1076394239,US
1076394240,1076396031,CA
@@ -23813,7 +24028,9 @@
1077007168,1077007175,CA
1077007176,1077055487,US
1077055488,1077059583,CA
-1077059584,1077444607,US
+1077059584,1077155839,US
+1077155840,1077157887,CA
+1077157888,1077444607,US
1077444608,1077452799,CA
1077452800,1077460991,JP
1077460992,1077465855,US
@@ -23842,7 +24059,9 @@
1077857309,1077857379,FR
1077857380,1077857380,MF
1077857381,1077857535,FR
-1077857536,1077865983,US
+1077857536,1077858015,US
+1077858016,1077858047,CN
+1077858048,1077865983,US
1077865984,1077866239,CA
1077866240,1077886975,US
1077886976,1077903359,JP
@@ -23885,8 +24104,8 @@
1077968766,1077968768,MX
1077968769,1077977087,US
1077977088,1077985279,CA
-1077985280,1077993471,US
-1077993472,1078018047,CA
+1077985280,1078001663,US
+1078001664,1078018047,CA
1078018048,1078067199,US
1078067200,1078071295,BS
1078071296,1078075391,CA
@@ -23900,7 +24119,9 @@
1078285012,1078288383,CA
1078288384,1078429695,US
1078429696,1078429951,GR
-1078429952,1078438399,US
+1078429952,1078433631,US
+1078433632,1078433663,CN
+1078433664,1078438399,US
1078438400,1078438655,CA
1078438656,1078438911,US
1078438912,1078438929,CN
@@ -23988,7 +24209,9 @@
1079320576,1079322831,CA
1079322832,1079322839,US
1079322840,1079328767,CA
-1079328768,1079379199,US
+1079328768,1079355967,US
+1079355968,1079355991,CA
+1079355992,1079379199,US
1079379200,1079379455,CA
1079379456,1079383039,US
1079383040,1079383295,VG
@@ -24679,7 +24902,9 @@
1093967872,1093976063,HK
1093976064,1093984255,US
1093984256,1093986303,IE
-1093986304,1094061971,US
+1093986304,1093990399,US
+1093990400,1093992447,AE
+1093992448,1094061971,US
1094061972,1094061975,NL
1094061976,1094064127,US
1094064128,1094064383,IE
@@ -24790,7 +25015,9 @@
1098070272,1098070279,GR
1098070280,1098070295,US
1098070296,1098070303,BE
-1098070304,1098096287,US
+1098070304,1098072967,US
+1098072968,1098072975,CA
+1098072976,1098096287,US
1098096288,1098096295,BR
1098096296,1098178383,US
1098178384,1098178391,CA
@@ -24806,7 +25033,9 @@
1100505128,1100505135,CA
1100505136,1100560647,US
1100560648,1100560655,TR
-1100560656,1101116083,US
+1100560656,1100671719,US
+1100671720,1100671727,DE
+1100671728,1101116083,US
1101116084,1101116084,KR
1101116085,1101182975,US
1101182976,1101183487,YE
@@ -24878,9 +25107,15 @@
1102005504,1102005759,PK
1102005760,1102006271,US
1102006272,1102006527,CA
-1102006528,1102389247,US
+1102006528,1102008095,US
+1102008096,1102008103,CA
+1102008104,1102008607,US
+1102008608,1102008639,CA
+1102008640,1102389247,US
1102389248,1102393343,CA
-1102393344,1102446591,US
+1102393344,1102397439,US
+1102397440,1102405631,HK
+1102405632,1102446591,US
1102446592,1102448383,HN
1102448384,1102449151,US
1102449152,1102449407,SV
@@ -25015,7 +25250,9 @@
1110126592,1110130687,CA
1110130688,1110248623,US
1110248624,1110248631,CA
-1110248632,1110270207,US
+1110248632,1110260431,US
+1110260432,1110260447,CO
+1110260448,1110270207,US
1110270208,1110270335,CA
1110270336,1110310911,US
1110310912,1110376447,CA
@@ -25088,16 +25325,22 @@
1110929408,1110933503,BM
1110933504,1111195647,US
1111195648,1111212031,CA
-1111212032,1111228415,US
+1111220224,1111228415,US
1111228416,1111244799,AR
1111244800,1111916543,US
1111916544,1111916895,CA
1111916896,1111916903,US
-1111916904,1111922687,CA
+1111916904,1111917999,CA
+1111918000,1111918015,NL
+1111918016,1111922687,CA
1111922688,1111922943,US
-1111922944,1111937727,CA
+1111922944,1111926313,CA
+1111926314,1111926314,US
+1111926315,1111937727,CA
1111937728,1111937735,US
-1111937736,1111949311,CA
+1111937736,1111940607,CA
+1111940608,1111940863,US
+1111940864,1111949311,CA
1111949312,1111982079,US
1111982080,1111998463,IT
1111998464,1112412671,US
@@ -25128,7 +25371,9 @@
1112653858,1112653858,US
1112653859,1112653981,VG
1112653982,1112653982,US
-1112653983,1112657919,VG
+1112653983,1112657484,VG
+1112657485,1112657487,HK
+1112657488,1112657919,VG
1112657920,1112817663,US
1112817664,1112821759,IM
1112821760,1112867327,US
@@ -25353,7 +25598,9 @@
1115134976,1115135359,HK
1115135360,1115135375,NL
1115135376,1115135391,US
-1115135392,1115135647,SG
+1115135392,1115135423,SG
+1115135424,1115135615,US
+1115135616,1115135647,SG
1115135648,1115135999,US
1115136000,1115144191,CA
1115144192,1115693055,US
@@ -25414,8 +25661,8 @@
1117413632,1117414143,US
1117414144,1117414911,CA
1117414912,1117416703,US
-1117416704,1117417471,CA
-1117417472,1117417983,US
+1117416704,1117417215,CA
+1117417216,1117417983,US
1117417984,1117418495,CA
1117418496,1117419007,US
1117419008,1117419519,CA
@@ -25457,7 +25704,9 @@
1117724672,1117728767,CA
1117728768,1117744127,US
1117744128,1117749247,CA
-1117749248,1117823231,US
+1117749248,1117817919,US
+1117817920,1117817983,CA
+1117817984,1117823231,US
1117823232,1117823487,CA
1117823488,1117823999,US
1117824000,1117824511,CA
@@ -25469,15 +25718,33 @@
1117995008,1117999103,CA
1117999104,1118027775,US
1118027776,1118031871,CA
-1118031872,1118126335,US
-1118126336,1118126591,CA
-1118126592,1118130687,US
+1118031872,1118126079,US
+1118126080,1118126591,CA
+1118126592,1118126847,US
+1118126848,1118127103,CA
+1118127104,1118127487,US
+1118127488,1118127615,CA
+1118127616,1118128383,US
+1118128384,1118128639,CA
+1118128640,1118129279,US
+1118129280,1118129663,CA
+1118129664,1118129887,US
+1118129888,1118129919,CA
+1118129920,1118130687,US
1118130688,1118131199,CA
-1118131200,1118131967,US
-1118131968,1118132479,CA
+1118131200,1118131711,US
+1118131712,1118132479,CA
1118132480,1118132991,US
-1118132992,1118133247,CA
-1118133248,1118139903,US
+1118132992,1118133375,CA
+1118133376,1118133759,US
+1118133760,1118133887,CA
+1118133888,1118134815,US
+1118134816,1118134879,CA
+1118134880,1118134911,US
+1118134912,1118134975,CA
+1118134976,1118136063,US
+1118136064,1118136191,CA
+1118136192,1118139903,US
1118139904,1118140159,CA
1118140160,1118157567,US
1118157568,1118157583,SV
@@ -25613,19 +25880,41 @@
1120383744,1120385535,CA
1120385536,1120385791,US
1120385792,1120387071,CA
-1120387072,1120486655,US
-1120486656,1120486911,CA
-1120486912,1120487423,US
+1120387072,1120486399,US
+1120486400,1120486911,CA
+1120486912,1120487359,US
+1120487360,1120487391,CA
+1120487392,1120487423,US
1120487424,1120487679,CA
-1120487680,1120489471,US
+1120487680,1120488575,US
+1120488576,1120488703,CA
+1120488704,1120488831,US
+1120488832,1120488863,CA
+1120488864,1120489215,US
+1120489216,1120489343,CA
+1120489344,1120489471,US
1120489472,1120489727,CA
-1120489728,1120491519,US
+1120489728,1120489983,US
+1120489984,1120490239,CA
+1120490240,1120491519,US
1120491520,1120491775,CA
1120491776,1120492543,US
1120492544,1120493055,CA
-1120493056,1120497407,US
-1120497408,1120497663,CA
-1120497664,1120498943,US
+1120493056,1120493183,US
+1120493184,1120493215,CA
+1120493216,1120494975,US
+1120494976,1120495039,CA
+1120495040,1120496255,US
+1120496256,1120496287,CA
+1120496288,1120496385,US
+1120496386,1120496638,CA
+1120496639,1120496895,US
+1120496896,1120497023,CA
+1120497024,1120497375,US
+1120497376,1120497663,CA
+1120497664,1120498143,US
+1120498144,1120498303,CA
+1120498304,1120498943,US
1120498944,1120499199,CA
1120499200,1120509951,US
1120509952,1120516095,SV
@@ -25718,8 +26007,7 @@
1122535424,1122538495,KR
1122538496,1122635775,US
1122635776,1122639871,CA
-1122639872,1122648063,US
-1122656256,1122672639,US
+1122639872,1122672639,US
1122672640,1122676735,AU
1122676736,1123123199,US
1123123200,1123127295,CA
@@ -26114,8 +26402,8 @@
1139171072,1139175423,US
1139175424,1139175935,PR
1139175936,1139179519,US
-1139179520,1139195903,CA
-1139195904,1139216383,US
+1139179520,1139187711,CA
+1139187712,1139216383,US
1139216384,1139220479,CA
1139220480,1139265535,US
1139265536,1139269631,CA
@@ -26156,7 +26444,11 @@
1145430016,1145475071,US
1145475072,1145479167,CA
1145479168,1145487359,US
-1145487360,1145491455,DE
+1145487360,1145488639,DE
+1145488640,1145489919,US
+1145489920,1145490943,DE
+1145490944,1145491199,CH
+1145491200,1145491455,DE
1145491456,1145503743,US
1145503744,1145520127,CA
1145520128,1150287871,US
@@ -26166,8 +26458,8 @@
1151868928,1151889407,US
1151889408,1151892703,CA
1151892704,1151892711,DZ
-1151892712,1151897599,CA
-1151897600,1152073727,US
+1151892712,1151893503,CA
+1151893504,1152073727,US
1152073728,1152077823,CA
1152077824,1152085152,US
1152085153,1152085168,KN
@@ -26436,7 +26728,9 @@
1160665600,1160665855,CH
1160665856,1160667135,US
1160667136,1160675327,CA
-1160675328,1160683519,US
+1160675328,1160681727,US
+1160681728,1160681983,SG
+1160681984,1160683519,US
1160683520,1160691711,CA
1160691712,1160847359,US
1160847360,1160855551,CA
@@ -26447,7 +26741,8 @@
1160925184,1160945663,US
1160945664,1160953855,CA
1160953856,1160967679,US
-1160967680,1160968191,GB
+1160967680,1160967935,GB
+1160967936,1160968191,IT
1160968192,1160968703,SE
1160968704,1160969215,US
1160969216,1160970239,NL
@@ -26665,6 +26960,7 @@
1162926016,1162926071,US
1162926072,1162926079,AU
1162926080,1162928127,US
+1162930176,1162932223,CA
1162932224,1163370495,US
1163378688,1163386367,US
1163386368,1163386879,CA
@@ -26888,7 +27184,9 @@
1170489344,1170497535,CA
1170497536,1170505727,US
1170505728,1170522111,CA
-1170522112,1175977983,US
+1170522112,1170552319,US
+1170552320,1170552575,SG
+1170552576,1175977983,US
1175977984,1176068167,CA
1176068168,1176068175,US
1176068176,1176068191,CA
@@ -27084,7 +27382,9 @@
1209359104,1209434111,US
1209434112,1209436671,BB
1209436672,1209437183,VC
-1209437184,1209440767,BB
+1209437184,1209438719,BB
+1209438720,1209439231,GD
+1209439232,1209440767,BB
1209440768,1209441279,GD
1209441280,1209442303,BB
1209442304,1209647103,US
@@ -27116,9 +27416,7 @@
1210099712,1210099719,MX
1210099720,1210109263,US
1210109264,1210109271,CA
-1210109272,1210111999,US
-1210112000,1210112007,CA
-1210112008,1210254935,US
+1210109272,1210254935,US
1210254936,1210254943,CA
1210254944,1210255103,US
1210255104,1210255359,CA
@@ -27192,7 +27490,11 @@
1211390990,1211390990,DE
1211390991,1211391216,US
1211391217,1211391217,IT
-1211391218,1211432959,US
+1211391218,1211394815,US
+1211394816,1211395071,NL
+1211395072,1211395839,US
+1211395840,1211396095,NL
+1211396096,1211432959,US
1211432960,1211473919,CA
1211473920,1211596799,US
1211596800,1211600959,CA
@@ -27390,9 +27692,7 @@
1246905600,1246912511,CA
1246912512,1246923519,US
1246923520,1246923775,AU
-1246923776,1246937087,US
-1246937088,1246945279,CA
-1246945280,1247101439,US
+1246923776,1247101439,US
1247101440,1247101695,CA
1247101696,1247123967,US
1247123968,1247124223,CA
@@ -27446,9 +27746,7 @@
1249024512,1249025023,CA
1249025024,1249029119,US
1249029120,1249030143,CA
-1249030144,1249036287,US
-1249036288,1249037311,TC
-1249037312,1249038335,US
+1249030144,1249038335,US
1249038336,1249040383,CA
1249040384,1249046527,US
1249046528,1249047551,BM
@@ -27543,7 +27841,18 @@
1249533952,1249542143,US
1249542144,1249544191,CA
1249544192,1249545215,US
-1249546240,1249562623,US
+1249546240,1249550351,US
+1249550352,1249550367,GB
+1249550368,1249550375,HK
+1249550376,1249550391,US
+1249550392,1249550399,TW
+1249550400,1249550863,US
+1249550864,1249550879,GB
+1249550880,1249550903,US
+1249550904,1249550911,GB
+1249550912,1249550935,US
+1249550936,1249550943,BY
+1249550944,1249562623,US
1249562624,1249564671,CA
1249564672,1249571839,US
1249571840,1249572863,CA
@@ -27853,7 +28162,7 @@
1293549568,1293680639,ES
1293680640,1293811711,MK
1293811712,1293942783,SA
-1293942784,1293975551,PL
+1293942784,1293975551,IT
1293975552,1294000127,FR
1294000128,1294004223,CH
1294004224,1294073855,PL
@@ -28236,7 +28545,7 @@
1297182208,1297182463,NL
1297182464,1297182719,RO
1297182720,1297184767,ES
-1297184768,1297185279,BZ
+1297184768,1297185279,NL
1297185280,1297185791,RO
1297185792,1297185919,NL
1297185920,1297186815,US
@@ -28308,7 +28617,27 @@
1297727488,1297743871,MD
1297743872,1297760255,DE
1297760256,1297776639,LT
-1297776640,1297793023,DE
+1297776640,1297782783,DE
+1297782784,1297784319,RU
+1297784320,1297784575,DE
+1297784576,1297785087,RU
+1297785088,1297785343,DE
+1297785344,1297785855,RU
+1297785856,1297786111,DE
+1297786112,1297786367,RU
+1297786368,1297788415,DE
+1297788416,1297788671,RU
+1297788672,1297789951,DE
+1297789952,1297790207,RU
+1297790208,1297790463,DE
+1297790464,1297791231,RU
+1297791232,1297791487,DE
+1297791488,1297791743,RU
+1297791744,1297791999,DE
+1297792000,1297792255,RU
+1297792256,1297792511,DE
+1297792512,1297792767,RU
+1297792768,1297793023,DE
1297793024,1297809407,UA
1297809408,1297825791,PL
1297825792,1297838079,RU
@@ -28458,8 +28787,7 @@
1299178496,1299180543,CH
1299180544,1299181567,GB
1299181568,1299182591,DK
-1299183360,1299183615,SE
-1299183616,1299184639,FR
+1299183616,1299183871,SE
1299184640,1299185663,GB
1299185664,1299447807,PL
1299447808,1299622911,AT
@@ -28496,7 +28824,8 @@
1306206208,1306214399,HR
1306214400,1306222591,LT
1306222592,1306230783,HR
-1306230784,1306263551,LT
+1306230784,1306259455,LT
+1306259456,1306263551,HR
1306263552,1306271743,KE
1306271744,1306279935,RU
1306279936,1306288127,IT
@@ -29204,7 +29533,8 @@
1317908480,1317909503,FR
1317909504,1317912575,LU
1317912576,1317928959,GB
-1317928960,1317945343,BG
+1317928960,1317929215,US
+1317929216,1317945343,BG
1317945344,1317978111,AT
1317994496,1318010879,DE
1318010880,1318027263,DK
@@ -29387,11 +29717,12 @@
1332613376,1332614143,UA
1332614144,1332614399,BY
1332614400,1332614655,NL
-1332614656,1332614783,UA
+1332614656,1332614783,RU
1332614784,1332614911,KZ
1332614912,1332615167,RO
1332615168,1332615423,DE
-1332615424,1332615679,UA
+1332615424,1332615551,RU
+1332615552,1332615679,UA
1332615680,1332616191,RO
1332616192,1332616319,GB
1332616320,1332616447,US
@@ -30633,7 +30964,9 @@
1348354048,1348355267,NL
1348355268,1348355269,IE
1348355270,1348358143,NL
-1348358144,1348362239,DE
+1348358144,1348359167,DE
+1348359168,1348361727,AF
+1348361728,1348362239,DE
1348362240,1348366335,MC
1348366336,1348370431,IT
1348370432,1348374527,DE
@@ -30870,7 +31203,9 @@
1357328896,1357329163,NL
1357329164,1357329167,GB
1357329168,1357329183,NL
-1357329184,1357329407,GB
+1357329184,1357329199,GB
+1357329200,1357329215,NL
+1357329216,1357329407,GB
1357329408,1357329415,BE
1357329416,1357332479,GB
1357335808,1357336063,IT
@@ -30951,7 +31286,6 @@
1357878464,1357878527,NO
1357878528,1357878591,AT
1357878592,1357878655,PL
-1357878656,1357878719,DE
1357879296,1357879423,DE
1357883744,1357883759,AT
1357883852,1357883852,SE
@@ -30984,7 +31318,7 @@
1357905408,1357905663,SE
1357905664,1357905919,NL
1357905920,1357910015,LT
-1357910016,1357914111,GR
+1357910016,1357914111,DE
1357914112,1357922303,RU
1357922304,1357926399,SA
1357926400,1357930495,GB
@@ -31004,7 +31338,6 @@
1357963264,1357967359,AT
1357967360,1357971455,RU
1357971456,1357975551,KZ
-1357975552,1357979647,AT
1357979648,1357983743,KZ
1357983744,1357984103,GB
1357984104,1357984111,IT
@@ -31088,7 +31421,8 @@
1358295040,1358299135,RU
1358299136,1358303231,DZ
1358303232,1358306303,RU
-1358306304,1358306815,GB
+1358306304,1358306559,AL
+1358306560,1358306815,GB
1358306816,1358307071,PT
1358307072,1358307327,LV
1358307328,1358315519,DE
@@ -31251,8 +31585,7 @@
1358862848,1358862911,DK
1358862912,1358862914,GB
1358862915,1358862915,DK
-1358862916,1358862975,GB
-1358862976,1358863103,DK
+1358862916,1358863103,GB
1358863104,1358863359,CH
1358863360,1358863871,US
1358863872,1358864383,GB
@@ -31305,7 +31638,8 @@
1359123456,1359123711,DE
1359123712,1359124479,ES
1359124480,1359132671,GB
-1359132672,1359133191,DE
+1359132672,1359133183,ES
+1359133184,1359133191,DE
1359133192,1359133199,NL
1359133200,1359134463,DE
1359134464,1359134719,GR
@@ -31417,8 +31751,8 @@
1360240640,1360244735,ES
1360244736,1360250623,GB
1360250624,1360251391,NL
-1360251392,1360252415,DE
-1360252416,1360257023,GB
+1360251392,1360252927,DE
+1360252928,1360257023,GB
1360257024,1360265215,DK
1360265216,1360265503,NL
1360265504,1360265511,DE
@@ -31494,7 +31828,6 @@
1360437248,1360441343,FI
1360441344,1360445439,HU
1360445440,1360453631,RU
-1360453632,1360457727,DE
1360457728,1360461823,FI
1360461824,1360465919,RU
1360465920,1360470015,UA
@@ -31849,8 +32182,10 @@
1365147648,1365155839,RU
1365155840,1365159935,SE
1365159936,1365164031,HU
-1365164032,1365171967,GB
-1365171968,1365172223,ML
+1365164032,1365171199,GB
+1365171200,1365171455,MT
+1365171456,1365171967,GB
+1365171968,1365172223,MT
1365172224,1365176319,LV
1365176320,1365180415,HU
1365180416,1365182335,DE
@@ -31973,8 +32308,10 @@
1370193920,1370226687,GB
1370226688,1370259455,ES
1370259456,1370292223,SE
-1370292224,1370294271,NL
-1370294272,1370295295,IL
+1370292224,1370293759,NL
+1370293760,1370294015,DE
+1370294016,1370294527,NL
+1370294528,1370295295,IL
1370295296,1370296319,IE
1370296320,1370300415,GB
1370300416,1370301439,NL
@@ -32345,6 +32682,7 @@
1384187136,1384187391,DE
1384188160,1384188415,ES
1384193024,1384194047,DE
+1384196096,1384197119,ES
1384198144,1384202239,GB
1384206336,1384218623,GB
1384218624,1384251391,EG
@@ -32581,10 +32919,7 @@
1386449404,1386449407,DE
1386449408,1386449663,GB
1386449664,1386449919,HK
-1386449920,1386449920,US
-1386449921,1386450175,IL
-1386450176,1386450431,US
-1386450432,1386450943,IL
+1386449920,1386450943,IL
1386450944,1386455039,GB
1386455040,1386456063,DK
1386456064,1386457087,GB
@@ -32821,7 +33156,11 @@
1389166592,1389199359,PS
1389199360,1389199871,AE
1389199872,1389200159,US
-1389200160,1389218815,AE
+1389200160,1389200895,AE
+1389200896,1389211647,DE
+1389211648,1389212672,AE
+1389212673,1389218303,DE
+1389218304,1389218815,AE
1389218816,1389219839,AF
1389219840,1389228415,AE
1389228416,1389228479,LB
@@ -33339,9 +33678,7 @@
1404099584,1404103167,LT
1404103168,1404103679,SE
1404103680,1404108799,LT
-1404108800,1404116991,HR
-1404116992,1404125183,LT
-1404125184,1404141567,HR
+1404108800,1404141567,HR
1404141568,1404149759,LV
1404149760,1404151807,LT
1404151808,1404153855,LV
@@ -33353,7 +33690,8 @@
1404157953,1404161498,LV
1404161499,1404161499,LT
1404161500,1404166143,LV
-1404166144,1404174335,LT
+1404166144,1404166144,LT
+1404166145,1404174335,SE
1404174336,1404182527,HR
1404182528,1404187519,SE
1404187520,1404187535,LV
@@ -33375,7 +33713,9 @@
1404239872,1404242687,LT
1404242688,1404242751,SE
1404242752,1404272639,LT
-1404272640,1404313599,EE
+1404272640,1404297983,EE
+1404297984,1404298239,HR
+1404298240,1404313599,EE
1404313600,1404329983,HR
1404329984,1404332031,EE
1404332032,1404338175,HR
@@ -33416,7 +33756,9 @@
1404815360,1404815871,EE
1404815872,1404816383,LT
1404816384,1404821503,SE
-1404821504,1404862463,LT
+1404821504,1404833791,LT
+1404833792,1404837887,SE
+1404837888,1404862463,LT
1404862464,1404870655,HR
1404870656,1404872703,LT
1404872704,1404875775,SE
@@ -33430,8 +33772,8 @@
1404960768,1404977151,SE
1404977152,1404993535,LT
1404993536,1405009919,SE
-1405009920,1405042687,LT
-1405042688,1405050879,HR
+1405009920,1405026303,LT
+1405026304,1405050879,HR
1405050880,1405059071,AT
1405059072,1405067263,SE
1405067264,1405091839,EE
@@ -33801,7 +34143,9 @@
1410523136,1410531327,PT
1410531328,1410539519,DE
1410539520,1410540543,GB
-1410540544,1410540799,US
+1410540544,1410540545,US
+1410540546,1410540546,GB
+1410540547,1410540799,US
1410540800,1410547711,GB
1410547712,1410555903,CZ
1410555904,1410564095,GB
@@ -33889,7 +34233,9 @@
1411796992,1411805183,PL
1411805184,1411809279,AT
1411809280,1411809535,LV
-1411809536,1411811327,NL
+1411809536,1411809791,NL
+1411809792,1411810047,LV
+1411810048,1411811327,NL
1411811328,1411813375,LV
1411813376,1411817471,NO
1411817472,1411821567,PL
@@ -34007,7 +34353,9 @@
1415577600,1416101887,FR
1416101888,1416364031,NL
1416364032,1416626175,IL
-1416626176,1416888319,AT
+1416626176,1416891391,AT
+1416891392,1416894463,NL
+1416894464,1416904703,AT
1416941568,1416943615,CH
1416944640,1416945663,CZ
1416953856,1417019391,RO
@@ -34057,8 +34405,12 @@
1424503716,1424523263,ES
1424523264,1424556031,RO
1424556032,1424588799,EG
-1424588800,1424590847,GB
-1424590848,1424591871,FR
+1424588800,1424589311,GB
+1424589312,1424589567,FR
+1424589568,1424590847,GB
+1424590848,1424591661,FR
+1424591662,1424591662,GB
+1424591663,1424591871,FR
1424591872,1424592383,GB
1424592384,1424592895,FR
1424592896,1424593119,GB
@@ -34085,7 +34437,9 @@
1424607744,1424607775,DE
1424607776,1424608083,GB
1424608084,1424608087,FR
-1424608088,1424608511,GB
+1424608088,1424608127,GB
+1424608128,1424608191,FR
+1424608192,1424608511,GB
1424608512,1424608527,ES
1424608528,1424608579,GB
1424608580,1424608580,ES
@@ -34274,7 +34628,11 @@
1426735104,1426743295,BE
1426743296,1426751487,LU
1426751488,1426767871,FR
-1426767872,1426784255,DE
+1426767872,1426781583,DE
+1426781584,1426781591,CH
+1426781592,1426781627,DE
+1426781628,1426781631,CH
+1426781632,1426784255,DE
1426784256,1426800639,SE
1426800640,1426817023,PL
1426817024,1426833407,BG
@@ -34346,7 +34704,9 @@
1428160512,1428260863,IT
1428260864,1428261119,GB
1428261120,1429209087,IT
-1429209088,1430257663,ES
+1429209088,1429986993,ES
+1429986994,1429986994,NL
+1429986995,1430257663,ES
1430257664,1430388735,IL
1430388736,1430519807,HU
1430519808,1430650879,FR
@@ -34436,9 +34796,7 @@
1432313856,1432322047,GB
1432322048,1432338431,RU
1432338432,1432346623,FR
-1432346624,1432348671,TR
-1432348672,1432349951,NL
-1432349952,1432351999,TR
+1432346624,1432351999,TR
1432352000,1432352767,NL
1432352768,1432354047,TR
1432354048,1432354815,NL
@@ -34681,7 +35039,10 @@
1438147584,1438147839,SE
1438147840,1438148095,BE
1438148096,1438148351,GB
-1438148352,1438154751,MT
+1438148352,1438148607,MT
+1438148608,1438148863,DE
+1438148864,1438149119,IT
+1438149120,1438154751,MT
1438154752,1438171135,DK
1438171136,1438173183,GB
1438173184,1438179327,IM
@@ -34694,7 +35055,9 @@
1438186496,1438187519,CH
1438187520,1438253055,IR
1438253056,1438318591,RO
-1438318592,1438351359,BG
+1438318592,1438332927,BG
+1438332928,1438333951,ES
+1438333952,1438351359,BG
1438351360,1438359551,US
1438359552,1438384127,BG
1438384128,1438400511,FI
@@ -34736,8 +35099,7 @@
1438578688,1438579967,DE
1438579968,1438580095,NZ
1438580096,1438580223,AU
-1438580224,1438580479,US
-1438580480,1438580735,DE
+1438580224,1438580735,DE
1438580736,1438646271,DK
1438646272,1438662655,RU
1438662656,1438679039,ES
@@ -34876,7 +35238,9 @@
1439447040,1439449087,RO
1439449088,1439450111,GR
1439450112,1439450879,RO
-1439450880,1439451135,IT
+1439450880,1439451012,IT
+1439451013,1439451013,GG
+1439451014,1439451135,IT
1439451136,1439451647,RO
1439451648,1439451903,LT
1439451904,1439452159,RO
@@ -35036,7 +35400,7 @@
1441556992,1441557503,SE
1441557504,1441558015,NL
1441558016,1441564671,GB
-1441564672,1441566719,NL
+1441564672,1441566719,MT
1441566720,1441568767,GB
1441568768,1441570815,FR
1441570816,1441579007,RU
@@ -35522,19 +35886,17 @@
1467473920,1467482111,RU
1467482112,1467484927,BG
1467484928,1467485183,IL
-1467485184,1467507199,BG
-1467507200,1467507455,GB
-1467507456,1467525119,BG
-1467525120,1467527167,DE
-1467527168,1467545599,BG
-1467545600,1467546623,DE
-1467546624,1467566079,BG
+1467485184,1467526143,BG
+1467526144,1467526399,DE
+1467526400,1467566079,BG
1467566080,1467567103,DE
1467567104,1467571199,BG
1467571200,1467572223,DE
-1467572224,1467593727,BG
-1467593728,1467597823,DE
-1467597824,1467613183,BG
+1467572224,1467596799,BG
+1467596800,1467597823,DE
+1467597824,1467604991,BG
+1467604992,1467609087,DE
+1467609088,1467613183,BG
1467613184,1467744255,DE
1467744256,1467777023,GB
1467777024,1467875327,ES
@@ -36125,7 +36487,9 @@
1489855556,1489855559,US
1489855560,1489855807,DE
1489855808,1489855839,US
-1489855840,1489856415,DE
+1489855840,1489855863,DE
+1489855864,1489855871,FI
+1489855872,1489856415,DE
1489856416,1489856419,US
1489856420,1489856527,DE
1489856528,1489856543,US
@@ -36256,7 +36620,9 @@
1494548480,1494556671,GB
1494556672,1494564863,DE
1494564864,1494573055,UA
-1494573056,1494581247,RO
+1494573056,1494580479,RO
+1494580480,1494580735,HU
+1494580736,1494581247,RO
1494581248,1494589439,RU
1494589440,1494597631,US
1494597632,1494605823,IT
@@ -36392,7 +36758,8 @@
1495300096,1495300351,SE
1495300352,1495300607,US
1495300608,1495300863,SE
-1495300864,1495303167,RO
+1495300864,1495301119,GB
+1495301120,1495303167,RO
1495303168,1495304191,US
1495304192,1495306239,MD
1495306240,1495306573,GB
@@ -36477,7 +36844,8 @@
1495376384,1495376639,GB
1495376640,1495382015,RO
1495382016,1495384063,ES
-1495384064,1495385599,RO
+1495384064,1495384319,GB
+1495384320,1495385599,RO
1495385600,1495386623,GB
1495386624,1495387135,RO
1495387136,1495387647,IR
@@ -36532,9 +36900,9 @@
1495441664,1495441919,IT
1495441920,1495442431,SY
1495442432,1495442559,FR
-1495442560,1495442943,RO
+1495442560,1495442943,GB
1495442944,1495443199,AE
-1495443200,1495443455,RO
+1495443200,1495443455,GB
1495443456,1495443967,IR
1495443968,1495444223,RO
1495444224,1495444479,GB
@@ -36581,7 +36949,9 @@
1495485440,1495485695,MD
1495485696,1495485951,RO
1495485952,1495486463,PL
-1495486464,1495487231,RO
+1495486464,1495487183,RO
+1495487184,1495487184,GG
+1495487185,1495487231,RO
1495487232,1495487487,IT
1495487488,1495488767,MD
1495488768,1495489279,GB
@@ -36620,9 +36990,9 @@
1495513088,1495515647,RO
1495515648,1495516159,IR
1495516160,1495516287,FR
-1495516288,1495516671,RO
+1495516288,1495516671,GB
1495516672,1495516927,GR
-1495516928,1495517183,RO
+1495516928,1495517183,GB
1495517184,1495518207,MD
1495518208,1495524095,RO
1495524096,1495524351,ES
@@ -36670,8 +37040,7 @@
1495571456,1495572479,MD
1495572480,1495573503,RO
1495573504,1495574527,KZ
-1495574528,1495574783,ES
-1495574784,1495575039,RO
+1495574528,1495575039,ES
1495575040,1495575551,CH
1495575552,1495575807,NL
1495575808,1495576319,RO
@@ -36709,8 +37078,8 @@
1495609344,1495612159,RO
1495612160,1495612415,GG
1495612416,1495613439,RO
-1495613440,1495614463,GB
-1495614464,1495615487,RO
+1495613440,1495614975,GB
+1495614976,1495615487,RO
1495615488,1495618559,ES
1495618560,1495619583,BE
1495619584,1495620607,AT
@@ -37090,14 +37459,15 @@
1496058112,1496058879,RO
1496058880,1496059903,KZ
1496059904,1496066047,ES
-1496066048,1496066815,RO
+1496066048,1496066815,GB
1496066816,1496067071,QA
1496067072,1496068095,RO
1496068096,1496074239,ES
1496074240,1496075263,GR
1496075264,1496076799,RO
1496076800,1496077055,ES
-1496077056,1496079359,RO
+1496077056,1496078335,RO
+1496078336,1496079359,MD
1496079360,1496081407,GR
1496081408,1496082175,RO
1496082176,1496082431,GB
@@ -37187,9 +37557,7 @@
1496179968,1496180223,IT
1496180224,1496180735,IR
1496180736,1496182783,SE
-1496182784,1496183039,ES
-1496183040,1496183295,US
-1496183296,1496184063,ES
+1496182784,1496184063,ES
1496184064,1496184319,US
1496184320,1496184575,ES
1496184576,1496184740,US
@@ -37202,8 +37570,9 @@
1496193024,1496195071,RO
1496195072,1496195327,ES
1496195328,1496195839,RO
-1496195840,1496196351,ES
-1496196352,1496197119,RO
+1496195840,1496196607,ES
+1496196608,1496196863,RO
+1496196864,1496197119,ES
1496197120,1496197631,MD
1496197632,1496198143,RO
1496198144,1496198655,IR
@@ -37246,7 +37615,8 @@
1496243864,1496243864,TF
1496243865,1496248575,RO
1496248576,1496248831,MD
-1496248832,1496250367,RO
+1496248832,1496250111,RO
+1496250112,1496250367,ES
1496250368,1496251391,US
1496251392,1496252415,GR
1496252416,1496252671,RO
@@ -37441,9 +37811,12 @@
1502980096,1502980223,DE
1502980224,1502980351,IE
1502980352,1502980607,US
-1502980608,1502986239,IE
+1502980608,1502981239,IE
+1502981240,1502981247,FR
+1502981248,1502986239,IE
1502986240,1503002623,NL
-1503002624,1503006719,GE
+1503002624,1503003135,GE
+1503003136,1503006719,AD