Commit Graph

22432 Commits

Author SHA1 Message Date
Nick Mathewson
6711a172c0 Merge remote-tracking branch 'neel/fbsd-cfix' 2018-07-10 14:50:49 -04:00
Nick Mathewson
a2c44a7a7e Isolate resolve.h usage in the modules that really need it.
(Almost none of Tor should actually need to touch the platform resolver.)
2018-07-10 13:36:45 -04:00
Nick Mathewson
8de48c111c Remove addr_port_lookup.
This lets us cut the dependency from address.c to resolve.c: the
address.c module now has no paths to the libc resolver in it.
2018-07-10 13:32:37 -04:00
Nick Mathewson
2f657a1416 Remove all users of addr_port_lookup outside of address.c
This function has a nasty API, since whether or not it invokes the
resolver depends on whether one of its arguments is NULL.  That's a
good way for accidents to happen.

This patch incidentally makes tor-resolve support socks hosts on
IPv6.
2018-07-10 13:23:37 -04:00
Nick Mathewson
c2ddb7b231 Move tor_addr_{,port_}lookup to resolve.c 2018-07-10 13:00:02 -04:00
Nick Mathewson
5d8336c182 Refactor ipv[46].[ch]
These are now combined into an inaddr.[ch], since their purpose is
to implement functions for struct in_addr and struct in6_addr.

The definitions for in6_addr and its allies are now in a separate
header, inaddr_st.h.

Closes ticket 26532.
2018-07-10 12:50:38 -04:00
Neel Chauhan
6d58c20d94 Fix build on FreeBSD post-refactor 2018-07-10 12:32:14 -04:00
Nick Mathewson
ef106ce788 Document the headers in src/app/config/ 2018-07-10 12:28:31 -04:00
Nick Mathewson
4f42c923d6 File-level summary documentation for src/lib/*/*.[ch] 2018-07-10 12:22:01 -04:00
Nick Mathewson
e3e6335a08 Add controller support for listing ExtORPort and HTTPTunnelPorts
Closes ticket 26647.
2018-07-10 10:50:43 -04:00
Nick Mathewson
951d59d706 Use tor_getline() in dirserv.c to remove its upper line limit.
Closes ticket 26223.
2018-07-10 10:36:49 -04:00
Nick Mathewson
6574d4bd27 Refactor dirserv_read_measured_bandwidths to have a single exit point 2018-07-10 10:36:49 -04:00
Nick Mathewson
b04d719c10 Integrate getdelim() and getline() support into Tor. 2018-07-10 10:36:49 -04:00
Nick Mathewson
1604c0fe0e Add the compatibility definition for getdelim.c from netbsd.
We shouldn't actually need this code nearly anywhere we build:
getdelim is POSIX, and mingw provides it.
2018-07-10 10:14:24 -04:00
Nick Mathewson
5ce348c4c7 Bump to 0.3.4.4-rc-dev 2018-07-09 15:17:38 -04:00
Nick Mathewson
f5e3bcb60b Bump to 0.3.3.8-dev. 2018-07-09 15:17:16 -04:00
Nick Mathewson
19f2057d49 Fix some lingering windows compilation issues from Jenkins.
These were caused by the recent refactoring.
2018-07-09 12:54:40 -04:00
Nick Mathewson
eb856a3e51 strcasecmp should not take a size_t argument 2018-07-09 11:17:23 -04:00
Matt Traudt
d20feddfcc Lower log level of "Scheduler of type KIST has been enabled" to INFO 2018-07-09 10:48:43 -04:00
Nick Mathewson
98dff5df3f Merge branch 'maint-0.3.3' into maint-0.3.4 2018-07-09 10:17:20 -04:00
Nick Mathewson
250e0fc1c4 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-07-09 10:17:20 -04:00
Nick Mathewson
1b81c4b5f3 Merge branch 'maint-0.3.4' 2018-07-09 10:17:20 -04:00
Nick Mathewson
6ad2c2b92f Merge remote-tracking branch 'github/bug26269_031' into maint-0.3.2 2018-07-09 10:17:17 -04:00
Nick Mathewson
e7463be39b Merge branch 'maint-0.3.4' 2018-07-09 10:16:51 -04:00
Nick Mathewson
83de46eb25 Changes file and comment for 25928. 2018-07-09 10:16:48 -04:00
Nick Mathewson
529faef28e Merge branch 'maint-0.3.3' into maint-0.3.4 2018-07-09 10:15:16 -04:00
Nick Mathewson
69918629f5 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-07-09 10:14:43 -04:00
Nick Mathewson
4a604d9938 Merge branch 'maint-0.2.9' into maint-0.3.2 2018-07-09 10:14:43 -04:00
Nick Mathewson
8b53dfc362 Merge branch 'bug26269_029' into maint-0.2.9 2018-07-09 10:14:39 -04:00
Nick Mathewson
7746b071d8 Merge remote-tracking branch 'gsomlo/gls-single-da' 2018-07-09 09:59:46 -04:00
Nick Mathewson
a1a55a33c2 Merge branch 'bug26488' 2018-07-09 09:37:14 -04:00
rl1987
46998fc8fd Validate that DirAuthority address is IPv4 2018-07-09 09:37:09 -04:00
Nick Mathewson
03283c00d8 Merge remote-tracking branch 'rl1987/bug26525' 2018-07-09 09:31:12 -04:00
Nick Mathewson
532873a924 Bump to 0.3.3.8 2018-07-09 09:24:07 -04:00
Nick Mathewson
9320100d6e Bump to 0.3.3.4-rc 2018-07-09 09:23:39 -04:00
Nick Mathewson
a95cfb8a58 Clear all control.c flags on control_free_all()
Fixes bug 25512.

(Cherry-picked from 3519d0c808
2018-07-09 09:20:45 -04:00
Nick Mathewson
8e3a52e5c3 Merge branch 'maint-0.3.4' 2018-07-09 09:14:41 -04:00
Nick Mathewson
75d9db9e5b Merge branch 'maint-0.3.3' into maint-0.3.4 2018-07-09 09:14:37 -04:00
Nick Mathewson
f721a08220 Merge remote-tracking branch 'catalyst-github/bug26455_033' into maint-0.3.3 2018-07-09 09:13:58 -04:00
Nick Mathewson
75f7064a13 Merge branch 'maint-0.3.4' 2018-07-09 09:11:42 -04:00
Nick Mathewson
d3894dc34b Merge branch 'maint-0.2.9' into maint-0.3.2 2018-07-09 09:11:41 -04:00
Nick Mathewson
1af69c1812 Merge branch 'maint-0.3.3' into maint-0.3.4 2018-07-09 09:11:41 -04:00
Nick Mathewson
451a84cecb Merge branch 'maint-0.3.2' into maint-0.3.3 2018-07-09 09:11:41 -04:00
Nick Mathewson
fead22fb2a Merge remote-tracking branch 'mikeperry/bug25705_v3_033' into maint-0.3.3 2018-07-09 09:08:58 -04:00
Nick Mathewson
b8554dd880 Make Tor compile with --disable-memory-sentinels again 2018-07-09 08:44:16 -04:00
rl1987
2558634f0c Tool to print expiration date of ed25519_signing_cert 2018-07-08 15:13:33 +02:00
Kaidan
abeb07a1bf Made 'auto' keyword in torrc case insensitive 2018-07-08 00:15:16 +10:00
Karsten Loesing
9faa28b60e Update geoip and geoip6 to the July 3 2018 database. 2018-07-06 20:54:03 +02:00
Nick Mathewson
10c782d7fa Move ntmain.c into libtor-app again
It's needed by main.c

Fixes bug 26662; bug not in any released Tor.
2018-07-06 13:59:40 -04:00
Nick Mathewson
50963f36d7 Actually sort the lines in src/core/include.am 2018-07-05 17:15:50 -04:00
Nick Mathewson
667a6e8fe9 Whoops. Protover.[ch] belong in src/core/or 2018-07-05 17:15:50 -04:00
Nick Mathewson
f720a5a439 Fix everything that previously referred to src/or 2018-07-05 17:15:50 -04:00
Nick Mathewson
5f51c2de8b Fix our build system to know the new locations of the src/or stuff 2018-07-05 17:15:50 -04:00
Nick Mathewson
ef486e3c02 Fix every include path changed in the previous commit (automated)
I am very glad to have written this script.
2018-07-05 17:15:50 -04:00
Nick Mathewson
63b4ea22af Move literally everything out of src/or
This commit won't build yet -- it just puts everything in a slightly
more logical place.

The reasoning here is that "src/core" will hold the stuff that every (or
nearly every) tor instance will need in order to do onion routing.
Other features (including some necessary ones) will live in
"src/feature".  The "src/app" directory will hold the stuff needed
to have Tor be an application you can actually run.

This commit DOES NOT refactor the former contents of src/or into a
logical set of acyclic libraries, or change any code at all.  That
will have to come in the future.

We will continue to move things around and split them in the future,
but I hope this lays a reasonable groundwork for doing so.
2018-07-05 17:15:50 -04:00
Nick Mathewson
81cb0afb2b Start splitting src/or
This is a very gentle commit that just lays the groundwork in the
build system: it puts the include files to build libtor-app.a into
src/core, and to build the tor executable into src/app.  The
executable is now "src/app/tor".
2018-07-05 17:15:50 -04:00
Nick Mathewson
4eac5c6ce6 And tell build.rs to stop looking in src/common 2018-07-05 17:15:24 -04:00
Nick Mathewson
c73bb9937d Fix build.rs to handle removed common. 2018-07-05 17:14:55 -04:00
Nick Mathewson
753b797ca4 Fix up .may_includes for evloop. 2018-07-05 15:50:20 -04:00
Nick Mathewson
1dd5b5f441 Add a missing include. 2018-07-05 15:44:33 -04:00
Nick Mathewson
2d69c32bb6 Clean up include paths for libtor-evloop (automated) 2018-07-05 15:22:17 -04:00
Nick Mathewson
1e417b7275 All remaining files in src/common belong to the event loop. 2018-07-05 15:22:17 -04:00
Nick Mathewson
947de40d19 Move openbsd-malloc responsibility to lib/malloc
(Note that this is not believed to work, but we may as well have it
in the right place till we remove it)
2018-07-05 15:07:08 -04:00
Nick Mathewson
4593829861 Remove util.h
Inline its contents (which were all includes) into or.h, and some of
its contents into other places that didn't include or.h at all.
2018-07-05 15:04:18 -04:00
Nick Mathewson
0adcfbc7c8 Move address_set to src/or
This is temporary, until src/or is split.

Putting this in containers would be another logical alternative,
except that addresses depend on containers, and we don't like
cycles.
2018-07-05 14:51:07 -04:00
Nick Mathewson
24c0f83185 Move socks5_status.h to src/lib/net
There might be a better place for it in the long run, but this is
the best I can think of for now.
2018-07-05 14:48:29 -04:00
Nick Mathewson
0e4b1781f4 Move handles.h to src/lib/container
There might be a better place for it in the long run, but this is
the best we can think of for now.
2018-07-05 14:45:34 -04:00
Nick Mathewson
3d610363ef Include compat_string.h in smartlist.c
We need this for strcasecmp on (some) Windows build environments.

Fix from Gisle Vanem.
2018-07-05 13:53:17 -04:00
Nick Mathewson
fecb8214d5 Try to use stricmp variants that MSDN actually recommends
Per recommendation by Gisle Vanem
2018-07-05 13:51:50 -04:00
Gabriel L. Somlo
97fad99483 Allow single DA if explicitly configured
When on a private network a single directory authority is explicitly
configured, allow that DA's instace of tor to pick itself as its own
DA, by having router_pick_dirserver_generic() set the PDS_ALLOW_SELF
flag when the list of potential sources contains only one element.
This would subsequently allow router_pick_trusteddirserver_impl() to
calculate is 'requreother' condition as 'false', enabling it to pick
itself as a valid DA candidate.

Fixes #25928

Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
2018-07-03 14:58:47 -04:00
Nick Mathewson
2878dad9db Merge branch 'maint-0.3.4' 2018-07-03 13:31:26 -04:00
Nick Mathewson
32d9d69350 Merge remote-tracking branch 'github/bug26568_034' into maint-0.3.4 2018-07-03 13:16:37 -04:00
Nick Mathewson
df98582851 Merge remote-tracking branch 'github/ticket26626' 2018-07-03 12:52:43 -04:00
Nick Mathewson
fe8f774820 Merge branch 'bug26522' 2018-07-03 11:34:36 -04:00
rl1987
d0525c38d6 Refrain from potentially insecure usage of strncat() 2018-07-03 11:34:14 -04:00
Nick Mathewson
77e678c20d Merge remote-tracking branch 'github/shrink_or_h_more' 2018-07-03 11:09:54 -04:00
Nick Mathewson
02a4442524 Fix up some windows compilation issues.
These were mostly cases where our previous macros had been casting,
and the values that we were trying to printf were not in fact
uint64_t.
2018-07-03 11:00:18 -04:00
Nick Mathewson
d5a3bb960d Retire U64_TO_DBL and DBL_TO_U64
These were necessary long ago to work around a bug in VC6.
2018-07-03 10:45:43 -04:00
Nick Mathewson
9568c0ce3d Return U64_PRINTF_ARG and U64_FORMAT
The standard is printf("%"PRIu64, x);
2018-07-03 10:40:59 -04:00
Nick Mathewson
52884f56d4 Replace U64_LITERAL with the standard UINT64_C 2018-07-03 10:33:50 -04:00
Nick Mathewson
cf0b07c2e5 Retire some unused (or nearly unused) macros. 2018-07-03 10:31:19 -04:00
Nick Mathewson
4638be5312 Use the standard SHRT_MAX name. 2018-07-03 10:28:10 -04:00
Nick Mathewson
c75215c23a Clean up various things that broke with our stdint.h changes
Casting before printf was necessary; now it's not so smart.

We don't have SIZEOF_UINT8_T any more.
2018-07-03 10:26:06 -04:00
Nick Mathewson
e2a94dc481 Require stdint.h and inttypes.h
We've been silently requiring stdint.h for a while now, and nobody
has complained.  Closes ticket 26626.
2018-07-03 10:25:31 -04:00
Nick Mathewson
a01b4d7f87 Merge remote-tracking branch 'rl1987/ticket26527' 2018-07-03 09:53:46 -04:00
Nick Mathewson
a4e8f94507 Merge branch 'maint-0.2.9' into maint-0.3.2 2018-07-03 09:48:03 -04:00
Nick Mathewson
4c094436c5 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-07-03 09:48:03 -04:00
Nick Mathewson
d38e474950 Merge branch 'maint-0.3.3' into maint-0.3.4 2018-07-03 09:48:03 -04:00
Nick Mathewson
228d25ddf6 Merge branch 'maint-0.3.4' 2018-07-03 09:48:03 -04:00
rl1987
439b528f25 Rename sandbox_getaddrinfo() et. al. 2018-07-03 15:53:39 +03:00
rl1987
fedb3e46ec Remove ATTR_NONNULL macro 2018-07-03 12:33:09 +03:00
Nick Mathewson
dfdf32404c Partially revert "Use tor_addr_from_getsockname() in several places"
This reverts part of commit 6ed384b827, in order to
fix bug 26568.  Bugfix on 0.3.4.1-alpha.
2018-07-02 16:11:02 -04:00
Nick Mathewson
3baf3d01cb hs_ntor_ref.py: pass only strings to subprocess.Popen
Recent Python3 versions seem to require this on Windows.

Fixes bug 26535; bug copied from ntor_ref.py on 0.3.1.1-alpha.
2018-07-02 14:23:26 -04:00
Nick Mathewson
fc5f8b6931 ntor_ref.py: pass only strings to subprocess.Popen
Recent Python3 versions seem to require this on Windows.

Fixes bug 26535; bug introduced in f4be34f70d, which
was apparently intended itself as a Python3 workaround.
2018-07-02 14:18:41 -04:00
Nick Mathewson
bfcfeaed07 Merge branch 'mikeperry_bug26214-rebased_squashed' into maint-0.3.4 2018-07-02 13:22:07 -04:00
Nick Mathewson
c8ccd028a7 Don't redefine str(n)casecmp on windows unless they're missing
When we do redefine them, use inline functions instead of #define.

This fixes a latent code problem in our redefinition of these
functions, which was exposed by our refactoring: Previously, we
would #define strcasecmp after string.h was included, so nothing bad
would happen.  But when we refactored, we would sometimes #define it
first, which was a problem on mingw, whose headers contain
(approximately):

inline int strcasecmp (const char *a, const char *b)
   { return _stricmp(a,b); }

Our define turned this into:
  inline int _stricmp(const char *a, const char *b)
    { return _stricmp(a,b); }

And GCC would correctly infer that this function would loop forever,
rather than actually comparing anything.  This caused bug 26594.

Fixes bug 26594; bug not in any released version of Tor.
2018-07-02 11:50:17 -04:00
Nick Mathewson
cb1a3674eb File-level documentation for some of src/lib. 2018-07-01 20:22:55 -04:00
Nick Mathewson
83a4946e7b Prune the .may_include files a bit; detect unused lines in them 2018-07-01 18:14:28 -04:00
Nick Mathewson
518ebe14dc fixup! Extract or_options_t from or.h 2018-07-01 16:02:33 -04:00
Nick Mathewson
8d562c040f fixup! Remove system headers from or.h 2018-07-01 15:31:18 -04:00
Nick Mathewson
6c440da926 Remove system headers from or.h 2018-07-01 15:20:37 -04:00
Nick Mathewson
13116378b1 Extract or_options_t from or.h
I decided to have this file included from config.h, though, since it
is used nearly everywhere.
2018-07-01 15:20:37 -04:00
Nick Mathewson
986d761510 Extract or_state_t to its own header.
Fewer modules needed this than I had expected.
2018-07-01 15:20:37 -04:00
Nick Mathewson
f75357ec35 Pull a couple more enums from or.h 2018-07-01 15:20:37 -04:00
Nick Mathewson
6ccd98f93e Move ext_or_cmd_t to proto_ext_or 2018-07-01 15:20:37 -04:00
Nick Mathewson
49f88e77e5 Extract more constants from or.h 2018-07-01 15:20:37 -04:00
Nick Mathewson
f54a5cbfb6 Extract addr_policy_t into a new header. 2018-07-01 15:20:37 -04:00
Nick Mathewson
6da0311d2c Extract various enums and tiny structs from or.h
These all have a logical header to go in.
2018-07-01 15:20:37 -04:00
Nick Mathewson
1743dac078 Minimize headers that include crypto_formats and x25519 stuff 2018-07-01 15:20:37 -04:00
Nick Mathewson
500826479a Remove other needless includes include from or/*.h 2018-07-01 15:20:37 -04:00
Nick Mathewson
471104eaa5 Remove needless includes from or.h
or.h should really include only the minimum of stuff from or/*,
common/*, and lib/*.
2018-07-01 15:20:37 -04:00
Nick Mathewson
7a61a92870 Combine DH_BYTES and DH_KEY_LEN; put them in a lib/defs header. 2018-07-01 11:25:29 -04:00
Nick Mathewson
cf8c3abff1 Merge branch 'maint-0.3.3' into maint-0.3.4 2018-07-01 10:22:21 -04:00
Nick Mathewson
adcd1d8b9a Merge branch 'maint-0.3.4' 2018-07-01 10:22:21 -04:00
Nick Mathewson
9aeef05f8f Merge remote-tracking branch 'dgoulet/bug26523_033_01' into maint-0.3.3 2018-07-01 10:22:18 -04:00
Nick Mathewson
43dc92441d Tabify all of the .am files. 2018-07-01 09:37:28 -04:00
Nick Mathewson
028523c801 Merge branch 'maint-0.3.4' 2018-06-30 09:15:39 -04:00
Nick Mathewson
e042727cf0 Merge remote-tracking branch 'catalyst-github/bug25895_034-squashed' into maint-0.3.4 2018-06-30 09:15:34 -04:00
Nick Mathewson
57155d38a3 Merge branch 'maint-0.3.4' 2018-06-29 23:12:03 -04:00
Nick Mathewson
8093a63f95 Restor EOL@EOF in routerlist.c 2018-06-29 23:08:45 -04:00
Nick Mathewson
ce940c8c09 Add another winsock2 include, for timeval in procmon. 2018-06-29 19:17:24 -04:00
Nick Mathewson
5921b23e15 add an include to fix macos, and probably bsd too 2018-06-29 14:03:13 -04:00
Nick Mathewson
ed84dab8b4 Merge branch 'maint-0.3.1' into maint-0.3.2 2018-06-29 13:49:43 -04:00
Nick Mathewson
36c372581f Merge branch 'maint-0.3.2' into maint-0.3.3 2018-06-29 13:49:43 -04:00
Nick Mathewson
75a6e7e256 Merge branch 'maint-0.3.3' into maint-0.3.4 2018-06-29 13:49:43 -04:00
Nick Mathewson
cd3f957219 Merge branch 'maint-0.3.4' 2018-06-29 13:49:43 -04:00
Nick Mathewson
a3ec89a4f8 Merge branch 'maint-0.2.9' into maint-0.3.1 2018-06-29 13:49:43 -04:00
Nick Mathewson
3c0a63c40f Fix a memory error in test_shared_random
Bug not in any released Tor.
2018-06-29 13:49:02 -04:00
Nick Mathewson
d583459d58 Fix some memory errors in the recent coverity fixes.
Found by asan on travis :/
2018-06-29 13:48:36 -04:00
Nick Mathewson
92b4996b23 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-06-29 13:07:13 -04:00
Nick Mathewson
d3ecb3a8d6 Merge branch 'maint-0.3.3' into maint-0.3.4 2018-06-29 13:07:13 -04:00
Nick Mathewson
1f389dadd0 Merge branch 'maint-0.3.4' 2018-06-29 13:07:13 -04:00
Nick Mathewson
6e9d5fc4ec Merge remote-tracking branch 'ahf-github/maint-0.3.2' into maint-0.3.2 2018-06-29 13:07:07 -04:00
Nick Mathewson
7a47379f25 Merge branch 'maint-0.3.4' 2018-06-29 13:06:16 -04:00
Nick Mathewson
f82f8179e6 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-06-29 13:06:15 -04:00
Nick Mathewson
f6b30a97a9 Merge branch 'maint-0.3.3' into maint-0.3.4 2018-06-29 13:06:15 -04:00
Nick Mathewson
68dfbd5ef4 Merge branch 'maint-0.3.1' into maint-0.3.2 2018-06-29 13:06:15 -04:00
Nick Mathewson
b89a66e997 Merge remote-tracking branch 'ahf-github/maint-0.3.0' into maint-0.3.1 2018-06-29 13:06:11 -04:00
Nick Mathewson
419077c26d Merge remote-tracking branch 'ahf-github/maint-0.3.1' into maint-0.3.1 2018-06-29 13:06:08 -04:00
Nick Mathewson
1a5be3c5e7 Merge branch 'maint-0.3.4' 2018-06-29 13:03:00 -04:00
Nick Mathewson
5ab23e03fa Merge branch 'maint-0.3.3' into maint-0.3.4 2018-06-29 13:02:56 -04:00
Nick Mathewson
df896ed632 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-06-29 13:00:56 -04:00
Nick Mathewson
fe2588a5a8 Merge branch 'maint-0.3.1' into maint-0.3.2 2018-06-29 13:00:56 -04:00
Nick Mathewson
1385a5118d Merge branch 'maint-0.2.9' into maint-0.3.1 2018-06-29 13:00:56 -04:00
Nick Mathewson
9d5b815dca Add a missing include to timers, to make windows happier 2018-06-29 12:59:43 -04:00
Nick Mathewson
6ac64e16ed Eliminate compat.h 2018-06-29 12:21:52 -04:00
Nick Mathewson
077176a34c Stop using util.h and compat.h in src/trunnel/ 2018-06-29 12:21:52 -04:00
Nick Mathewson
666e3e5ec6 Stop using util.h and compat.h in src/tools 2018-06-29 12:21:52 -04:00
Nick Mathewson
4212a135e1 Remove util.h and compat.h includes from src/common 2018-06-29 12:21:52 -04:00
Nick Mathewson
35e1c497aa Combine compat.h into util.h
This is now just a collection of frequently-used headers.
2018-06-29 12:21:52 -04:00
Nick Mathewson
714788b195 Remove non-windows system includes from compat.h and util.h 2018-06-29 12:21:52 -04:00
Nick Mathewson
71e56c70e9 Remove windows libraries from util.h and compat.h 2018-06-29 12:21:52 -04:00
Nick Mathewson
31897a256c Extract socks5_status_t
I'm not sure of the best place to put this header long-term, since
both or/*.c and tools/tor-resolve.c use it.
2018-06-29 12:21:52 -04:00
Nick Mathewson
080069c7b3 Move SIO_IDEAL_SEND_BACKLOG_QUERY into socket.h 2018-06-29 12:21:52 -04:00
Nick Mathewson
b21108f839 Remove an errant (and unused) include permission in lib/tls 2018-06-29 12:21:52 -04:00
Nick Mathewson
e269044ce0 Remove compat.c and util.c 2018-06-29 12:21:52 -04:00
Nick Mathewson
4e11c2ca6c Extract getpass to a new lib/term library
(Term is short for terminal)
2018-06-29 12:21:52 -04:00
Nick Mathewson
e0957022bd Extract get_uname to lib/osinfo. 2018-06-29 12:21:52 -04:00
Nick Mathewson
207fc4cffe Move SUBTYPE_P into compat_compiler.h 2018-06-29 12:21:52 -04:00
Nick Mathewson
77bc65bbc4 Move bool_eq and bool_neq to lib/intmath 2018-06-29 12:21:52 -04:00
Nick Mathewson
40199b180e Remove read_all and write_all
These had become wrappers around their fd and socket variants; there
were only a few users of the original functions still remaining.
2018-06-29 12:21:52 -04:00
Nick Mathewson
0362cdc169 Move fd and memory-info functions. 2018-06-29 12:21:52 -04:00
Nick Mathewson
973afcc40b Move tor_get_avail_disk_space() to lib/fs 2018-06-29 09:43:00 -04:00
Nick Mathewson
f0319fcbde Merge remote-tracking branch 'catalyst-github/fix-macos-includes' 2018-06-28 18:19:53 -04:00
Taylor Yu
f9e22c68a0 Fix macOS includes
Recent code movement from refactoring missed some includes that seem
to be necessary on macOS.
2018-06-28 17:15:53 -05:00
Nick Mathewson
365179cd16 Fix a bogus n in a comment 2018-06-28 17:21:15 -04:00
Nick Mathewson
c84ab36eff A couple of includes to make windows compile again 2018-06-28 16:37:59 -04:00
Nick Mathewson
935ba02565 Fix paths for buffers.h; automated. 2018-06-28 16:29:35 -04:00
Nick Mathewson
d8b34e0886 Move buffers into container
Split the network-only and compression-only parts of buffers into
the appropriate modules.
2018-06-28 16:28:08 -04:00
Nick Mathewson
be40ad51b6 Add sys/capability.h and sys/prctl.h includes in setuid.c 2018-06-28 15:34:51 -04:00
Nick Mathewson
b67754cd64 compat_threads.c needs string.h for memset. 2018-06-28 15:20:26 -04:00
Nick Mathewson
a742a826f6 Remove all include common/ uses in crypto_ops and tls. 2018-06-28 14:40:25 -04:00
Nick Mathewson
0f02d2c041 Fix windows compilation in compat_time
We need to use lib/fs/winlib.h here so that we can use
GetTickCount64.

I would love to declare that XP is dead, and everybody has
GetTickCount64.
2018-06-28 13:40:21 -04:00
Nick Mathewson
7d7af19f1b Use tor_ntohs in compress.c; avoid a winsocks dependency 2018-06-28 13:39:49 -04:00
Nick Mathewson
326c473b79 fixup! Extract time functionality into lib/wallclock and lib/time 2018-06-28 13:39:09 -04:00
Nick Mathewson
02bb701bba Move DLL support to lib/fs 2018-06-28 13:37:51 -04:00
Nick Mathewson
8fc15e4861 Add ntohs and htons to lib/arch/bytes.h 2018-06-28 13:26:27 -04:00
Nick Mathewson
4dda026f0d Update lib/compress to not require common/*.h 2018-06-28 13:19:58 -04:00
Nick Mathewson
3d1e99d01b Move MIN and MAX into lib/intmath/cmp.h 2018-06-28 13:19:42 -04:00
Nick Mathewson
8736892679 Remove a pair of windows flags used nowhere in our code 2018-06-28 13:02:33 -04:00
Nick Mathewson
57f4b83852 Fix up the include path of compat_time.h (automated) 2018-06-28 13:01:54 -04:00
Nick Mathewson
a097ddb4f5 Extract time functionality into lib/wallclock and lib/time 2018-06-28 13:01:54 -04:00
Nick Mathewson
bdea94a665 Move floating-point math functions into a new lib/math 2018-06-28 12:24:45 -04:00
Nick Mathewson
6178a9f758 Move compute_num_cpus to lib/thread 2018-06-28 12:08:18 -04:00
Nick Mathewson
042df08693 Move network_init to lib/net 2018-06-28 11:59:16 -04:00
Nick Mathewson
db1a420c4e Move tor_gethostname to lib/net 2018-06-28 11:57:01 -04:00
Nick Mathewson
8c6ff9fec2 Move tor_escape_str_for_pt_args into or/transports.c 2018-06-28 11:49:27 -04:00
Nick Mathewson
30166261bb Move string_is_key_value to lib/encoding 2018-06-28 11:46:32 -04:00
Nick Mathewson
48ebd9bf76 Move weakrng into lib/intmath 2018-06-28 11:39:49 -04:00
Nick Mathewson
aa3edfd205 Move lockfile code into lib/fs 2018-06-28 11:33:50 -04:00
Nick Mathewson
84b8dfe635 Move socket-errno code into lib/net 2018-06-28 11:20:31 -04:00
Nick Mathewson
315e6b59dd Extract process-management functionality into a new lib/process
Note that procmon does *not* go here, since procmon needs to
integrate with the event loop.
2018-06-28 11:18:13 -04:00
Nick Mathewson
ec4eee6356 Fix the include paths for storagedir,conffile (automated) 2018-06-28 09:42:33 -04:00
Nick Mathewson
a1f3ece16d Move conffile and storagedir to lib/fs 2018-06-28 09:38:17 -04:00
Nick Mathewson
38fd3e0df0 Fix up the modules that include memarea.h (automated) 2018-06-28 09:25:58 -04:00
Nick Mathewson
eee86e627b Extract memarea into its own library 2018-06-28 09:25:18 -04:00
Nick Mathewson
9cf335c9a5 Extract threading code into a new library.
Note that the workqueue code does *not* go here: it is logically at
a higher level, since it needs to use libevent and the networking
stack.
2018-06-28 09:14:42 -04:00
Nick Mathewson
544ab27a94 Extract the alert-socket code into lib/net.
This code was in compat_threads, since it was _used_ for efficiently
notifying the main libevent thread from another thread.  But in
spite of its usage, it's fundamentally a part of the network code.
2018-06-28 08:49:07 -04:00
Nick Mathewson
0b7452eeb2 rectify include paths (automatic) for confline.h 2018-06-27 16:59:56 -04:00
Nick Mathewson
b9b44bf000 Move confline.c to lib/encoding: it is about encoding key-value pairs
Also, move "unescape_string()" to encoding too, since it's about
encoding data as C strings.
2018-06-27 16:59:56 -04:00
Nick Mathewson
696f6f1569 Split confline into confline and conffile.
The "conffile" module knows about includes and filesystem access,
whereas confline doesn't.  This will make it possible to put these
functions into libraries without introducing a cycle.
2018-06-27 16:59:56 -04:00
Nick Mathewson
0a9d8dcf2b Move hex_str to binascii.c 2018-06-27 16:59:56 -04:00
Nick Mathewson
194a34cdc2 Extract time encoding functions into lib/encoding 2018-06-27 16:59:56 -04:00
Nick Mathewson
235ddb15a0 Move util_format into a new libtor-encoding library
libtor-encoding is about various ways to transform data to and from
character sequences.
2018-06-27 16:18:42 -04:00
Nick Mathewson
3cff3e825a Move several address-string-testing functions to address.c 2018-06-27 16:18:42 -04:00
Nick Mathewson
e165c9c304 Move various mem* functions to lib/string 2018-06-27 16:18:42 -04:00
Alex Xu (Hello71)
614a78ddaa Fix Rust cross compilation. 2018-06-27 14:42:06 -05:00
Nick Mathewson
9e592d1dec Move tor_strtok_r to libtor-string 2018-06-27 15:28:55 -04:00
Nick Mathewson
4d81f5211b Move set/get_uint*() to inline functions in arch/bytes.h
Also move our ntohll/htonll functions.
2018-06-27 15:28:44 -04:00
Nick Mathewson
000de2f2ac Merge branch 'fs_refactor' 2018-06-27 14:45:17 -04:00
Nick Mathewson
2113603718 Merge branch 'sandbox_refactor' 2018-06-27 14:45:14 -04:00
Nick Mathewson
b9b05e437d Merge branch 'net_refactor' 2018-06-27 12:52:31 -04:00
Nick Mathewson
300e3bebd1 Merge branch 'ticket26494' 2018-06-27 12:47:08 -04:00
Nick Mathewson
3d606dddb9 fixup! Move format_win32_error into lib/log/ 2018-06-27 12:35:48 -04:00
Nick Mathewson
1e2e0f7e46 Extract functions from compat.c and util.h into a new fs library 2018-06-27 12:30:11 -04:00
Nick Mathewson
3246c114a2 Move format_win32_error into lib/log/ 2018-06-27 12:30:11 -04:00
David Goulet
3f8a12a63a control: Make HSPOST properly parse HSADDRESS= param
For HSv3, the HSADDRESS= wasn't properly parsed for the HSPOST command. It now
correctly use it and furthermore sends back a "200 OK" in case the command is
successful for a v3 descriptor.

Fixes #26523

Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-06-27 12:25:24 -04:00
Nick Mathewson
356f59b1bd Move read/write_all_to_socket into lib/net. 2018-06-27 12:01:11 -04:00
Nick Mathewson
67135ca8e0 Split read_all and write_all into separate functions 2018-06-27 10:47:42 -04:00
Nick Mathewson
05040a9e84 Minimize and permit sandbox includes from crypto_ops. 2018-06-27 10:12:39 -04:00
Nick Mathewson
ad24ccd472 Minimize includes from sandbox.c 2018-06-27 10:11:27 -04:00
Nick Mathewson
55b7939367 Fix up include paths for sandbox.h (automated) 2018-06-27 10:04:41 -04:00
Nick Mathewson
bee580ddba Move sandbox code into a new library. 2018-06-27 10:04:17 -04:00
Nick Mathewson
0742b38725 Revert "Use the "commands" argument of AC_CONFIG_FILES to make scripts +x"
This reverts commit 56c1fbf33f.
2018-06-27 09:53:46 -04:00
Nick Mathewson
d893be190f rectify include paths (automatic) for address.h 2018-06-27 09:13:04 -04:00
Nick Mathewson
3930416dec Link GetAdaptersAddresses, rather than loading it on-demand.
This function has been present since Windows XP.
2018-06-27 09:12:57 -04:00
Nick Mathewson
42b3caa6ad Move network code to libtor-net.
There are some additional changes to come: those points are marked
by XXXX.
2018-06-27 09:08:35 -04:00
Nick Mathewson
80730c45e0 Move tor_parse_long and friends into parse_int.h in libtor-string 2018-06-26 21:02:29 -04:00
Nick Mathewson
7159edf909 Move the escape-for-log code into src/lib/log
It doesn't need anything higher-level, and everything that needs the
logs potentially needs this.
2018-06-26 20:51:17 -04:00
Nick Mathewson
5f41bc91c6 Merge branch 'ticket26439' 2018-06-26 17:02:06 -04:00
Nick Mathewson
ebbb0348dc Finish renaming digestset_contains to digestset_probably_contains
Since bloom filters are probabilistic, it's nice to make it clear
that the "contains" operation can have false positives.
2018-06-26 13:27:50 -04:00
Nick Mathewson
bf89278c79 Refactor bloom filter logic not to be digest-specific.
Now the address-set code and the digest-set code share the same
backend.

Closes ticket 26510
2018-06-26 13:27:23 -04:00
Nick Mathewson
82a7343b06 fixup! Extract core part of smartlist code into its own library. 2018-06-26 12:21:35 -04:00
Nick Mathewson
6e2b6a6685 fixup! Extract core part of smartlist code into its own library. 2018-06-26 12:18:49 -04:00
Nick Mathewson
d7bd8cf3b6 Use raw_assert directly in smartlist_core
I had previously added a "#define tor_assert raw_assert" here, to
make code movement in the previous commit more clear.
2018-06-26 12:16:04 -04:00
Nick Mathewson
b1de1e7a77 Extract core part of smartlist code into its own library.
The smartlist_core library now contains only the parts of smartlists
that are needed for the logging library.  This resolves the
circularity between "container" and "log".

The "containers" library still uses the logging code, and has the
higher-level smartlist functions.
2018-06-26 12:13:23 -04:00
Nick Mathewson
58fc42fdce Fix comments in lib/container/*.c 2018-06-26 11:33:53 -04:00
Nick Mathewson
92d8284a97 Merge branch 'log_dependencies' 2018-06-26 11:27:33 -04:00
Nick Mathewson
cf0597c3b2 Bump version to 0.3.4.3-alpha-dev 2018-06-26 09:12:23 -04:00
rl1987
240f33e327 Generate trunnel impls and include into build 2018-06-26 12:37:33 +03:00
rl1987
adbe6a2521 Copy socks5.trunnel from trunnel examples dir 2018-06-26 12:37:33 +03:00
Nick Mathewson
b556894ef2 Include stdio.h in torerr.c. 2018-06-25 16:52:14 -04:00
Nick Mathewson
6c836b9e8c Bump to 0.3.4.3-alpha. 2018-06-25 14:07:23 -04:00
Nick Mathewson
b059c38d8a Merge branch 'maint-0.3.4' 2018-06-25 13:50:37 -04:00
Corey Farwell
e62582e9fe Run rustfmt on 'src/rust/protover/ffi.rs'. 2018-06-25 08:03:04 -04:00
Corey Farwell
6d2e4dea10 Utilize type param in method invocation. 2018-06-24 22:45:07 -04:00
Corey Farwell
59d4505749 Utilize if..else for switching on boolean values. 2018-06-24 22:44:36 -04:00
Roger Dingledine
04b350b476 better log line for debugging #26485 2018-06-24 18:14:24 -04:00
Roger Dingledine
73ae92dc52 we've never been good at using "directory" well as a noun 2018-06-24 18:08:24 -04:00
Nick Mathewson
d85fbc9a58 Add some casts to get test_dir.c compiling on windows.
Fixed bug 26479.  Bug introduced by 0a6f4627a4292e4; bug not in any
released version.
2018-06-24 14:06:39 -04:00
Nick Mathewson
3cc0a145bd Fix test_geoip failures on windows by writing file in binary mode.
Fixes bug 26480; bug appeared when we re-enabled the geoip tests on
windows.  Bug originally introduced by our fix to 25787; bug not in
any released Tor.
2018-06-24 14:06:05 -04:00
Corey Farwell
94880b2db7 Utilize if let construct instead of explicit unwrapping. 2018-06-24 10:16:11 -04:00
Corey Farwell
7e9c37f9cb Change allocate_and_copy_string to take a &str instead of &String. 2018-06-24 08:58:26 -04:00
Alexander Færøy
8ec6b36dca Fix memory leak in test_sr_setup_commits().
This patch fixes a memory leak in test_sr_setup_commits() where the
place_holder is allocated, but never freed again.

See: Coverity CID 1437440.
2018-06-23 13:11:03 +02:00
Alexander Færøy
3395de51a0 Fix memory leak in disk_state_parse_commits().
This patch fixes a memory leak in disk_state_parse_commits() where if
commit is NULL, we continue the internal loop, but without ever freeing
the args variable.

See: Coverity CID 1437441.
2018-06-23 13:10:57 +02:00
Alexander Færøy
dcbfee246f Fix memory leak in frac_nodes_with_descriptors().
This patch fixes a memory leak in frac_nodes_with_descriptors() where
we might return without free'ing the bandwidths variable.

See: Coverity CID 1437451.
2018-06-23 13:10:29 +02:00
Alexander Færøy
a2e623f631 Fix memory leak in helper_add_hsdir_to_networkstatus().
This patch fixes a memory leak in helper_add_hsdir_to_networkstatus()
where the rs object might not get properly freed.

See: Coverity CID 1437427.
2018-06-23 13:07:56 +02:00
Alexander Færøy
8e805bf0f6 Fix memory leak in new_establish_intro_cell().
This patch fixes a memory leak in new_establish_intro_cell() that could
happen if a test assertion fails and the *cell_out value isn't properly
free'd.

See: Coverity CID 1437445
2018-06-23 13:07:56 +02:00
Alexander Færøy
8550016e6f Fix memory leak in test_channelpadding_consensus().
The relay variable is always allocated, but might not be freed before we
return from this function.

See: Coverity CID 1437431
2018-06-23 12:52:04 +02:00
Alexander Færøy
c997d49ad6 Fix memory link in test_link_specifier().
This patch fixes a memory leak in test_link_specifier() where ls might
not get freed in case one of the test macros fails.

See: Coverity CID 1437434.
2018-06-23 12:39:20 +02:00
Alexander Færøy
3d80c086be Fix memory leak in decode_link_specifiers().
This patch fixes a memory leak in decode_link_specifiers() where the
hs_spec variable might leak if the default label is taken in the
switch/case expression.

See: Coverity CID 1437437.
2018-06-23 11:54:36 +02:00
Alexander Færøy
d86c45bf5c Fix memory leak in client_likes_consensus().
This patches fixes a memory leak in client_likes_consensus() where if
consensus_cache_entry_get_voter_id_digests() would fail we would return
without having free'd the voters list.

See: Coverity CID 1437447
2018-06-23 10:33:40 +02:00
Alexander Færøy
dc2384da30 Fix potential memory leak in hs_helper_build_hs_desc_impl().
This patch fixes a memory leak in hs_helper_build_hs_desc_impl() where
if a test assertion would fail we would leak the storage that `desc`
points to.

See: Coverity CID 1437448
2018-06-23 10:27:10 +02:00
Alexander Færøy
ce5d055ed7 Fix memory leak in pick_hsdir_v3().
This patch fixes a memory leak in pick_hsdir_v3() where we might return
early, but forgot to free the responsible_hsdirs variable. We solve this
by not allocating storage for responsible_hsdirs until it's actually
needed.

See: Coverity CID 1437449
2018-06-23 03:40:32 +02:00
Alexander Færøy
1724f995c7 Fix potential memory leak in test_hs_auth_cookies().
This patch fixes a potential memory leak in test_hs_auth_cookies() if a
test-case fails and we goto the done label where no memory clean up is
done.

See: Coverity CID 1437453
2018-06-23 03:17:09 +02:00
Alexander Færøy
8c8941eb29 Fix potential memory leak in hs_helper_build_intro_point().
This patch fixes a potential memory leak in
hs_helper_build_intro_point() where a `goto done` is called before the
`intro_point` variable have been assigned to the value of the `ip`
variable.

See: Coverity CID 1437460
See: Coverity CID 1437456
2018-06-23 02:29:54 +02:00
Nick Mathewson
1b93b065fc Make an inline static so we can build with coverage enabled. 2018-06-22 14:11:37 -04:00
Nick Mathewson
405fa42e8a Another windows include 2018-06-22 13:52:30 -04:00
Nick Mathewson
4b32446a4c We also need torerr in tm_cvt. 2018-06-22 13:34:35 -04:00
Nick Mathewson
145665abcb Add another include for windows, and change a log to a raw_assert 2018-06-22 13:33:48 -04:00
Nick Mathewson
76a717890e Remove an "m" that did not belong. 2018-06-22 13:32:47 -04:00
Nick Mathewson
4118ba67db Update the micro-revision.i dependencies, and add a stdlib.h 2018-06-22 13:25:58 -04:00
Nick Mathewson
cf66544941 Two more small changes for CI. 2018-06-22 13:10:52 -04:00
Nick Mathewson
7aecea79cb A pair of missing includes. 2018-06-22 12:53:57 -04:00
Nick Mathewson
b0adf2fc9b Fix up the rust build script library list. 2018-06-22 12:04:11 -04:00
Nick Mathewson
bcf3e546d1 Move util_bug into libtor-log 2018-06-22 11:54:38 -04:00
Nick Mathewson
6fc2d53227 Remove util_bug dependency on compat.h 2018-06-22 11:51:58 -04:00
Nick Mathewson
7a93ce8f63 Update .gitignore and .may_include files 2018-06-22 11:46:44 -04:00
Nick Mathewson
79f73ab330 Finally extract the log library and make it build.
This patch:
  - introduces an fdio module for low-level fd functions that don't
    need to log.
  - moves the responsibility for opening files outside of torlog.c,
    so it won't need to call tor_open_cloexec.
2018-06-22 11:40:20 -04:00
Nick Mathewson
90a09df5ba Extract strlcpy and strlcmp to libtor-string 2018-06-22 11:18:19 -04:00
Nick Mathewson
bfb39164ce Extract core part of gmtime_r, localtime_r (without logging) 2018-06-22 11:17:11 -04:00
Nick Mathewson
b2d4e786b7 Remove the util_bug.h include from smartlist.h.
This change makes a whole bunch of things in torlog.c break, since
apparently I did not find all the fd dependencies.
2018-06-22 10:50:14 -04:00
Nick Mathewson
da4ae8a6b6 Automated fixup of include paths after torlog.h movement. 2018-06-22 10:32:10 -04:00
Nick Mathewson
97b15a1d7c Extract the locking and logging code
The locking code gets its own module, since it's more fundamental
than the higher-level locking code.

Extracting the logging code was the whole point here. :)
2018-06-22 10:31:51 -04:00
Nick Mathewson
2cf033f238 Extract simple integer math into its own module 2018-06-22 09:49:13 -04:00
Nick Mathewson
3883338c81 Move smartlist_add_{v,}asprintf into smartlist.[ch]
Now that I know that "strings" nests below "container", I know this
is safe.
2018-06-22 09:49:13 -04:00
Nick Mathewson
1abadee3fd Extract key string manipulation functions into a new library. 2018-06-22 09:49:13 -04:00
Nick Mathewson
1e07b4031e Move ARRAY_LENGTH to compiler_compat.h 2018-06-22 09:49:13 -04:00
Nick Mathewson
0932f32291 Remove compat.h as unneeded from log.c and torlog.h 2018-06-22 09:49:13 -04:00
Nick Mathewson
9426751b72 Extract our code for answering "what time is it right now".
The other time stuff is higher-level
2018-06-22 09:49:13 -04:00
Nick Mathewson
d1cada5a8a Update permissible includes 2018-06-22 09:49:13 -04:00
Nick Mathewson
c2a558a346 Expunge container.h 2018-06-22 09:49:13 -04:00
Nick Mathewson
de508c5f50 Extract smartlist.h from container.h 2018-06-22 09:49:13 -04:00
Nick Mathewson
9cf6fc91b1 Remove map from container.h 2018-06-22 09:49:13 -04:00
Nick Mathewson
50a5954003 Remove bloom filters, order statistics, and bitarrays from container.h 2018-06-22 09:49:13 -04:00
Nick Mathewson
932b4d0a43 Remove container->crypto dependency
Containers were using crypto_digest.h, just to see the value of
DIGEST_LEN.  Moved those constants into a new defs module.
2018-06-22 09:49:13 -04:00
Nick Mathewson
479c2ab503 Move STRUCT_VAR_P to compat_compiler. 2018-06-22 09:49:13 -04:00
Nick Mathewson
657ff55408 Split container.c based on container types, and minimize includes
Minimizing includes revealed other places includes were necessary.
2018-06-22 09:49:13 -04:00
Nick Mathewson
b8be8265b6 Rectify include paths after container split (automatic) 2018-06-22 09:49:13 -04:00
Nick Mathewson
77dff00b18 Refactor container into a library. 2018-06-22 09:49:13 -04:00
Taylor Yu
d935aceb2b Use correct CARGO_HOME in test_rust.sh
Out-of-tree builds could fail to run the rust tests if built in
offline mode.  cargo expects CARGO_HOME to point to the .cargo
directory, not the directory containing .cargo.

Fixes bug 26455; bug not in any released tor.
2018-06-21 18:20:03 -05:00
Nick Mathewson
f95e3bf5fc Simplify include structure of container.[ch] 2018-06-21 15:33:25 -04:00
Nick Mathewson
e066966bf4 Extract tor_malloc and friends to a new module. 2018-06-21 15:20:01 -04:00
Nick Mathewson
56c1fbf33f Use the "commands" argument of AC_CONFIG_FILES to make scripts +x
Closes ticket 26439.
2018-06-21 14:26:47 -04:00
Nick Mathewson
8dcc015975 Fix wide lines in dirauth/dirvote.* 2018-06-21 14:23:32 -04:00
Nick Mathewson
999f7984e1 New script to check includes for modularity violations
Includes configuration files to enforce these rules on lib and
common.  Of course, "common" *is* a modularity violation right now,
so these rules aren't as strict as I would like them to be.
2018-06-21 14:05:33 -04:00
Nick Mathewson
8918bd90e9 Merge branch 'extract_easy_common_libs' 2018-06-21 13:57:13 -04:00
Nick Mathewson
3305ae5044 Rectify include paths (automated).
You have no idea how glad I am that this is automated.
2018-06-21 13:20:07 -04:00
Nick Mathewson
5b8f4769dc Move testsupport.h to its own directory 2018-06-21 13:20:07 -04:00
Nick Mathewson
e9943d5459 Move responsibility for libdonna out of src/common 2018-06-21 13:19:00 -04:00
Nick Mathewson
71571e3428 Additional non-automated change to trunnel-local.h 2018-06-21 13:19:00 -04:00
Nick Mathewson
accf239fa3 Rectify include paths (automated) 2018-06-21 13:19:00 -04:00
Nick Mathewson
25ccfff86a Split crypto and tls libraries into directories
I am calling the crypto library "crypt_ops", since I want
higher-level crypto things to be separated from lower-level ones.
This library will hold only the low-level ones, once we have it
refactored.
2018-06-21 13:14:14 -04:00
Nick Mathewson
49d7c9ce53 Move more compiler-compatibility stuff into compat_compiler.h 2018-06-21 13:14:14 -04:00
Nick Mathewson
68bbe915d9 di_ops.c does not actually log anything. 2018-06-21 13:14:14 -04:00
Nick Mathewson
fa5fda5bbf Rectify include paths (automated) 2018-06-21 13:14:14 -04:00
Nick Mathewson
cd8f919553 Move compiler-compatibility headers into their own module
This one has no generated code.
2018-06-21 13:14:14 -04:00
Nick Mathewson
d2f4a716e8 Remove unused pubsub module. 2018-06-21 13:14:14 -04:00
Nick Mathewson
209a285166 Rectify include paths (automated) 2018-06-21 13:14:14 -04:00
Nick Mathewson
4bdda6d05f Move trace into its own library in libs.
Apparently it has no testing variant.
2018-06-21 13:14:14 -04:00
Nick Mathewson
03d7812615 Make sure liberr-testing is build with testing flags. 2018-06-21 13:14:14 -04:00
Nick Mathewson
b420da4cf8 Rectify include paths (automated) 2018-06-21 13:14:14 -04:00
Nick Mathewson
2d20cbf837 Extract compression functions into a new library. 2018-06-21 13:08:25 -04:00
Roger Dingledine
471418befb tiny comment and whitespace fixes 2018-06-21 13:07:51 -04:00
Nick Mathewson
ad7776f66d Rename libtor.a to libtor-app.a 2018-06-21 11:03:39 -04:00
Nick Mathewson
727db7aeb9 Rectify include paths (automated) 2018-06-21 11:03:39 -04:00
Nick Mathewson
a403ee6bb3 Move consttime library code into its own directory. 2018-06-21 11:03:39 -04:00
Nick Mathewson
275aff6917 Rectify include paths (automated) 2018-06-21 10:47:11 -04:00
Nick Mathewson
2cfcb7b364 Extract error functionality into a new lowest-level library. 2018-06-21 10:47:11 -04:00
Nick Mathewson
b2346b1201 Refactor makefiles to keep list of internal libraries in one place.
This change makes it possible for us to change the list of libraries
more easily, without changing every single linker line.
2018-06-21 10:35:30 -04:00
Nick Mathewson
da728e36f4 Rectify include paths (automated) 2018-06-21 09:55:16 -04:00
Nick Mathewson
874ba6861a Fix distcheck by naming header properly. 2018-06-21 09:37:32 -04:00
Nick Mathewson
2ad062ee60 Merge branch 'mikeperry_bug26214-rebased_squashed' 2018-06-21 09:20:03 -04:00
Mike Perry
46b06cd699 Bug 26214: Test updates. 2018-06-21 09:18:51 -04:00
Mike Perry
dc397f9a61 Bug 26214: Check stream SENDME against max. 2018-06-21 09:18:51 -04:00
Nick Mathewson
92ae9bb95b Hang on; this branch is supposed to be 0.3.4.2-alpha-dev. 2018-06-21 09:01:00 -04:00
Nick Mathewson
c42071f750 Merge branch 'maint-0.3.4' 2018-06-21 08:59:58 -04:00
Nick Mathewson
e845bd17f8 Merge branch 'bug25787_squashed' into maint-0.3.4 2018-06-21 08:56:27 -04:00
Nick Mathewson
cacf326e78 Revise geoip tests to not require paths of actual geoip config
When I wrote the first one of these, it needed the path of the geoip
file.  But that doesn't translate well in at least two cases:

   - Mingw, where the compile-time path is /c/foo/bar and the
     run-time path is c:\foo\bar.

   - Various CI weirdnesses, where we cross-compile a test binary,
     then copy it into limbo and expect it to work.

Together, these problems precluded these tests running on windows.

So, instead let's just generate some minimal files ourselves, and
test against them.

Fixes bug 25787
2018-06-21 08:56:20 -04:00
Nick Mathewson
27e456cd72 Merge remote-tracking branch 'rl1987/ticket19979_2' 2018-06-21 08:53:48 -04:00
Nick Mathewson
72a5ae8c66 Merge branch 'maint-0.3.4' 2018-06-21 08:38:21 -04:00
Nick Mathewson
73bc863822 Merge branch 'additional_rust_test_fixes' into maint-0.3.4 2018-06-21 08:38:17 -04:00
Nick Mathewson
683776bfab Merge branch 'maint-0.3.4' 2018-06-21 08:36:48 -04:00
Nick Mathewson
c389c41292 Merge branch 'maint-0.3.3' into maint-0.3.4 2018-06-21 08:36:48 -04:00
Nick Mathewson
599b53f046 add a bn.h include to crypto_dh.c 2018-06-21 08:34:27 -04:00
Roger Dingledine
7b1a3c5164 fix memory leak in protover.c
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 in the live network due
to out-of-memory issues.

Fixes bug 26435; bugfix on 0.3.3.6.
2018-06-20 19:43:58 -04:00
Nick Mathewson
01d0bf1803 add build.rs to EXTRA_DIST 2018-06-20 19:32:01 -04:00
Nick Mathewson
8f3712cf6e eol@eof is still the law in 0.3.4 :( 2018-06-20 19:05:11 -04:00
Nick Mathewson
d110f9c9a6 Add a leak suppression for backtrace_alloc
This appears to be an internal rust thing: I don't know why it's
leaking.  We should investigate further.
2018-06-20 18:02:49 -04:00
Nick Mathewson
3b606ff787 Merge branch 'maint-0.3.4' into additional_rust_test_fixes 2018-06-20 17:53:51 -04:00
Nick Mathewson
f24797a587 Merge branch 'maint-0.3.4' 2018-06-20 17:49:56 -04:00
Nick Mathewson
f91ea506f0 Fix clang warnings introduced by 9f2b887c5d 2018-06-20 17:49:06 -04:00
Nick Mathewson
3a64052099 Fix memory leak in CryptoDigest type
If you're owning a C pointer, you need to implement Drop.
2018-06-20 17:28:28 -04:00
Nick Mathewson
592e8ac395 Disable doctests in src/rust/crypto module.
These all need C linking to work, and so far, rustdoc does not seem
to respect cargo setting about build scripts or RUSTOPTIONS.
2018-06-20 17:16:44 -04:00
Nick Mathewson
901ada7e5f Fix bugs in rust digest tests 2018-06-20 17:08:00 -04:00
Nick Mathewson
e99ecf9399 Merge branch 'rust_build_script_v3' into additional_rust_test_fixes 2018-06-20 17:07:47 -04:00
Nick Mathewson
398f15bdf1 Merge branch 'maint-0.3.4' 2018-06-20 16:37:39 -04:00
Isis Lovecruft
7589fd6d40 rust: Remove --all-features flag from cargo test call in test_rust.sh.
We'd like to feature gate code that calls C from Rust, as a workaround
to several linker issues when running `cargo test` (#25386), and we
can't feature gate anything out of test code if `cargo test` is called
with `--all-features`.

 * FIXES #26400: https://bugs.torproject.org/26400
2018-06-20 16:37:33 -04:00
Nick Mathewson
c86850c4c9 Don't use any asserts(), even raw, in format_number_sigsafe().
Also explain why.
2018-06-20 16:16:45 -04:00
Nick Mathewson
057d838409 Use raw_assert() in write_all().
This makes tor_log() finally non-circular.
2018-06-20 16:16:45 -04:00
Nick Mathewson
7a2dce9006 Use raw_assert() in central allocation functions.
This is, again, to avoid circularity in the log code.
2018-06-20 16:16:45 -04:00
Nick Mathewson
17ba51a30a Use raw_assert in mutex functions to avoid circularity in logs. 2018-06-20 16:16:45 -04:00
Nick Mathewson
bb15dc1ebd Allow raw_assert() to dump stack traces.
It doesn't do this as beautifully as tor_assert(), but it doesn't
depend on any higher-level code.
2018-06-20 16:16:45 -04:00
Nick Mathewson
a969ce464d Remove log dependency from backtrace.[ch] 2018-06-20 16:16:45 -04:00
Nick Mathewson
3246c9648c Use compat_compiler to restore macros in torerr.h 2018-06-20 15:08:06 -04:00
Nick Mathewson
aa490e971b Split compiler-compatibility parts of compat.h 2018-06-20 15:08:06 -04:00
Nick Mathewson
5ecd1fec15 Move horrible-emergency handling into torerr.[ch]
Previously we had code like this for bad things happening from
signal handlers, but it makes sense to use the same logic to handle
cases when something is happening at a level too low for log.c to be
involved.

My raw_assert*() stuff now uses this code.
2018-06-20 15:08:06 -04:00
Nick Mathewson
8865972a0b Use raw_assert in tor_gettimeofday
We don't want to actually be calling logs when gettimeofday() fails,
since we need gettimeofday() to log.
2018-06-20 10:42:06 -04:00
Nick Mathewson
90aeaa53cd Remove all use of the assert.h header
Nothing in Tor has actually called assert() for some while.
2018-06-20 10:39:07 -04:00
Nick Mathewson
ae01864b5d Add raw_assert() variants for cases where we cannot log.
Remove a different raw_assert() macro declared in log.c
2018-06-20 10:36:14 -04:00
Nick Mathewson
9fa73003fc Remove dmalloc support; closes #26426
Dmalloc hasn't seen a release in over a decade, and there are much
better tools to use these days.
2018-06-20 10:21:34 -04:00
Nick Mathewson
0dab29ce10 Run rectify_include_paths.py 2018-06-20 09:35:05 -04:00
Nick Mathewson
257b280776 Simplify AM_CPPFLAGS include setup
We had accumulated a bunch of cruft here.  Now let's only include
src and src/ext.  (exception: src/trunnel is autogenerated code, and
need to include src/trunnel.)

This commit will break the build hard.  The next commit will fix it.
2018-06-20 09:27:04 -04:00
Nick Mathewson
d7301a456a Merge remote-tracking branch 'neel/b25886c' 2018-06-20 08:32:34 -04:00
Nick Mathewson
e9c93a3415 Merge branch 'maint-0.3.4' 2018-06-20 08:29:52 -04:00
Nick Mathewson
0a6f4627a4 eol@eof in test-dir.c 2018-06-20 08:29:38 -04:00
Nick Mathewson
fb0019daf9 Update copyrights to 2018. 2018-06-20 08:13:28 -04:00
Nick Mathewson
11a76b903b Merge branch 'maint-0.3.4' 2018-06-20 08:05:07 -04:00
Nick Mathewson
7b9cd5cca5 Merge branch 'asn_bug24977_final_squashed' into maint-0.3.4 2018-06-20 08:02:27 -04:00
George Kadianakis
b7b7dab00d Recreate nodelist before use if it's outdated.
We currently only do the check when we are about to use the HSDir indices.
2018-06-20 08:01:02 -04:00
George Kadianakis
a686464420 Recreate voting schedule before use if it's outdated. 2018-06-20 08:01:02 -04:00
Nick Mathewson
334edc22d1 Merge branch 'maint-0.3.4' 2018-06-20 07:55:15 -04:00
Isis Lovecruft
4971d7afa6 rust: Remove redundant "testing" feature from tor_log crate.
It was synonymous with the builtin "test" feature.

 * FIXES #26399: https://bugs.torproject.org/26399
2018-06-20 07:55:12 -04:00
Nick Mathewson
5acbcf150e Merge branch 'maint-0.3.4' 2018-06-20 07:53:22 -04:00
rl1987
9054ccb36b Enable DEBUG_SMARTLIST in unit tests 2018-06-20 07:49:41 -04:00
rl1987
7bb3777dfb Refrain from accessing empty smartlist in test_bridges_clear_bridge_list
Just check that smartlist length is zero instead
2018-06-20 07:49:41 -04:00
Nick Mathewson
152e4a1e50 Merge branch 'maint-0.3.4' 2018-06-20 07:35:17 -04:00
Nick Mathewson
ac1747e47f Merge remote-tracking branch 'catalyst-github/bug26415_034' into maint-0.3.4 2018-06-20 07:35:13 -04:00
Nick Mathewson
b63d6984a6 Merge branch 'maint-0.3.4' 2018-06-19 19:10:28 -04:00
Alexander Færøy
e309aa4c8c Fix linker errors when building Tor.
This patch fixes linking errors when compiling Tor with the dirauth
module disabled.

See: https://bugs.torproject.org/26418
2018-06-19 23:10:12 +02:00
Taylor Yu
bfd36177c4 Fix compilation of Rust crypto doctests
The doctests for src/rust/crypto don't compile for multiple reasons,
including some missing exports and incorrect identifier paths.  Fixes
bug 26415; bugfix on 0.3.4.1-alpha.
2018-06-19 13:53:26 -05:00
rl1987
5af29fbb63 When possible, use RFC5869 HKDF implementation from OpenSSL
Also, stop supporting empty HKDF input key material
2018-06-19 19:26:31 +03:00
Nick Mathewson
bd9ebb3763 Use a rust build script to set linker options correctly for tests.
We need this trick because some of our Rust tests depend on our C
code, which in turn depend on other native libraries, which thereby
pulls a whole mess of our build system into "cargo test".

To solve this, we add a build script (build.rs) to set most of the
options that we want based on the contents of config.rust.  Some
options can't be set, and need to go to the linker directly: we use
a linker replacement (link_rust.sh) for these.  Both config.rust and
link_rust.sh are generated by autoconf for us.

This patch on its own should enough to make the crypto test build,
but not necessarily enough to make it pass.
2018-06-19 12:01:13 -04:00
Nick Mathewson
f3267741e4 Merge branch 'maint-0.3.4' 2018-06-18 17:09:03 -04:00
Nick Mathewson
d27745d81d Remove duplicate MODULE_DIRAUTH_SOURCES from libtor_testing.a
This was already added to LIBTOR_A_SOURCES; it doesn't need to get
added again.

Fixes bug 26402. Bugfix on 0.3.4.1-alpha.
2018-06-18 17:07:27 -04:00
Nick Mathewson
5879909826 Revert "Remove duplicate MODULE_DIRAUTH_SOURCES from libtor_testing.a"
This reverts commit 70d91bd059.
2018-06-18 17:06:18 -04:00
Nick Mathewson
70d91bd059 Remove duplicate MODULE_DIRAUTH_SOURCES from libtor_testing.a
This was already added to LIBTOR_A_SOURCES; it doesn't need to get
added again.

Fixes bug 26402. Bugfix on 0.3.4.1-alpha.
2018-06-18 17:03:52 -04:00
Nick Mathewson
29982e5190 Remove redundant typedefs from _st.h files
The typedefs are already in or.h
2018-06-18 16:05:36 -04:00
David Goulet
a8e76f3824 test: Add missing headers in test_controller.c
After the big or.h refactoring, one single unit test file was missing two
headers for node_t and microdesc_t.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-06-18 15:07:30 -04:00
Isis Lovecruft
508332feaf
rust: Add "test-c-from-rust" feature-gate.
Due to linker issues (#25386) when testing Rust code which calls C,
all tests which touch FFI code should now be feature-gated behind the
"test-c-from-rust" flag.  To run this test code, cargo must be called
with `cargo test --features="test-c-from-rust"`.

 * FIXES #26398: https://bugs.torproject.org/26398
2018-06-18 18:57:38 +00:00
Nick Mathewson
104c2e9e7e Merge branch 'split_or_h' 2018-06-18 14:18:34 -04:00
Nick Mathewson
bcc1368c77 Merge branch 'maint-0.3.4' 2018-06-18 13:10:47 -04:00
Nick Mathewson
3640c63498 Merge remote-tracking branch 'ffmancera-1/bug24658-dh_stream' 2018-06-17 20:39:13 -04:00
Nick Mathewson
16dd2f7bb0 Merge remote-tracking branch 'rl1987/bug25477' 2018-06-17 20:25:40 -04:00
Nick Mathewson
5746e210b8 Merge remote-tracking branch 'rl1987/feature8323_squashed2' 2018-06-17 20:20:15 -04:00
Nick Mathewson
d5e4b6983f Merge remote-tracking branch 'rl1987/bug26282' 2018-06-17 19:32:08 -04:00
Nick Mathewson
987174cc6f Merge remote-tracking branch 'github/bug26152_035' 2018-06-17 19:28:59 -04:00
Nick Mathewson
e6aa2d526e Changes to make the rust crypto::mod tests compile
The digest tests don't link yet, though.
2018-06-16 13:22:44 -04:00
Nick Mathewson
8184f45ad9 Merge branch 'maint-0.3.3' into maint-0.3.4 2018-06-16 13:10:19 -04:00
Nick Mathewson
ccf1eb3164 Fix a bug in my fix for #26258
The fix here is use a different bourne shell subsitution for
CARGO_ONLINE, so that an empty string counts as set.
2018-06-16 13:08:40 -04:00
Nick Mathewson
71ddfbaadd Merge remote-tracking branch 'isis/bug26267' into maint-0.3.4 2018-06-16 12:43:28 -04:00
Neel Chauhan
9d7f148885 Make frac_nodes_with_descriptors() take and use for_direct_connect 2018-06-16 11:27:28 -04:00
Nick Mathewson
97cc61e947 Merge branch 'maint-0.3.4' 2018-06-16 10:20:27 -04:00
Nick Mathewson
530d67410f Merge remote-tracking branch 'isis/bug26245' into maint-0.3.4 2018-06-16 10:19:26 -04:00
Nick Mathewson
8c1e2d7557 Merge branch 'maint-0.3.4' 2018-06-16 10:15:39 -04:00
Isis Lovecruft
748a0c7d0b
rust: Remove unused N_DIGEST_ALGORITHMS constant from crypto_digest.rs.
In the C code, this constant is only ever used in src/test/bench.c.

 * FIXES part of #26245: https://bugs.torproject.org/26245
2018-06-15 23:22:43 +00:00
Isis Lovecruft
d5a9b77a28
rust: Add comment and pragma on "unused" smartlist_t type.
* FIXES part of #26245: https://bugs.torproject.org/26245
2018-06-15 22:49:39 +00:00
Taylor Yu
468bf58fa2 Make Rust warnings conditionally fatal
Set rustc flags to treat warnings as fatal if configured with
--enable-warnings.
2018-06-15 17:27:19 -05:00
Isis Lovecruft
ac5b1428ea
rust: Expose rand module from crypto crate. 2018-06-15 21:44:22 +00:00
Nick Mathewson
e22822e4ae Bump master to 0.3.5.0-alpha-dev 2018-06-15 17:19:49 -04:00
Taylor Yu
9dd45456fe Set default-features = false for rand_core
Apparently rand and rand_core need to be built with the "std" feature
set consistently, or there will be a compile error in rngs/jitter.rs.
2018-06-15 15:19:16 -05:00
Nick Mathewson
7dbe504f3e Move hsdir_index_t into its own header. 2018-06-15 15:41:27 -04:00
Nick Mathewson
3191ba389d Move extend_info_t into its own header. 2018-06-15 15:37:05 -04:00
Nick Mathewson
fde868ffe3 Extract cell type and their queues into new headers
Since packed_cell and destroy_cell exist only to be queued, they go
in the same headers as the queues.
2018-06-15 15:27:46 -04:00
Nick Mathewson
958df2829a Extract cached_dir_t into a new header. 2018-06-15 15:06:00 -04:00
Nick Mathewson
f85d731e3a Extract download_status_t into its own header. 2018-06-15 14:58:43 -04:00
Nick Mathewson
03fc83ab6d Extract signed_descriptor_t into its own header. 2018-06-15 14:53:07 -04:00
Nick Mathewson
ed0731c7de Extract routerinfo_t into its own header.
I was expecting this to be much worse.
2018-06-15 14:49:46 -04:00
Nick Mathewson
9d6276bca8 Extract microdesc_t into its own header. 2018-06-15 14:38:30 -04:00
Nick Mathewson
def1f20e1f Extract routerstatus_t into its own header. 2018-06-15 14:33:03 -04:00
Nick Mathewson
00f1d1653e Extract extrainfo_t into its own header 2018-06-15 14:21:25 -04:00
Nick Mathewson
1e4e9db815 Extract authority_cert_t into its own header 2018-06-15 14:14:11 -04:00
Nick Mathewson
b8ae4111e3 Extract desc_store_t and routerlist_t into their own headers. 2018-06-15 14:07:17 -04:00
Nick Mathewson
62315dab84 Extract ns_detached_signatures_st into its own header. 2018-06-15 13:49:30 -04:00
Nick Mathewson
50369f8981 Extract networkstatus_t and ..sr_info_t into their own headers 2018-06-15 13:45:15 -04:00
Nick Mathewson
89aefb0319 Extract networkstatus_vote_info_t into its own header. 2018-06-15 13:31:47 -04:00
Nick Mathewson
80c9e1e585 Move document_signature_t into its own header. 2018-06-15 13:27:11 -04:00
Nick Mathewson
f901ca958a fixup! Extract node_t into its own header. 2018-06-15 13:23:44 -04:00
Nick Mathewson
72d2fd83d8 Split vote_{microdesc_hash,routerstatus}_t into their own headers 2018-06-15 13:23:02 -04:00
Nick Mathewson
d2942d127d Extract node_t into its own header. 2018-06-15 13:13:33 -04:00
Nick Mathewson
8b7df72359 Split socks_request_t into its own header. 2018-06-15 13:01:50 -04:00
Nick Mathewson
ad52fe7e88 Move network_liveness_t into circuitstats.h and make it private
This type is only used in one place and never exposed.
2018-06-15 12:56:54 -04:00
Nick Mathewson
e13f59416c Move measured_bw_line_t into dirserv.h 2018-06-15 12:54:55 -04:00
Nick Mathewson
c9e4ebf96a Move fp_pair_t declaration to fp_pair.h. 2018-06-15 12:52:22 -04:00
Nick Mathewson
f8794b0b36 Move vote_schedule into its own header. 2018-06-15 12:50:07 -04:00
Nick Mathewson
5cdc234330 Split rend_authorized_client_t and encoded_.._t into their own headers 2018-06-15 12:36:59 -04:00
Nick Mathewson
990184da49 Extract rend_intro_point_t into its own header. 2018-06-15 12:23:06 -04:00
Nick Mathewson
22e9c64738 Extract rend_service_descriptor_t into its own header. 2018-06-15 12:18:17 -04:00
Nick Mathewson
7d2d131afa Extract tor_version_t into its own header. 2018-06-15 12:12:15 -04:00
Nick Mathewson
d51de77311 Extract cpath_build_state into its own header.
More modules use this than I had expected!
2018-06-15 12:07:20 -04:00
Nick Mathewson
c846b0e486 Extract crypt_path_reference_t into its own header. 2018-06-15 11:57:48 -04:00
Nick Mathewson
b3f2c682b7 Extract crypt_path_t and relay_crypto_t into their own headers 2018-06-15 11:52:32 -04:00
Nick Mathewson
e0830ff7bf Extract circuit_t into its own header 2018-06-15 11:38:36 -04:00
Nick Mathewson
a0bc164af5 Extract {or,origin}_circuit_t into their own headers 2018-06-15 11:34:33 -04:00
Nick Mathewson
bba998af65 Extract connection_t into its own header.
Now the entire connection_t hierarchy is extracted from or.h
2018-06-15 11:05:56 -04:00
Nick Mathewson
bcc283bcc9 Split or_handshake_{certs,state}_t into their own headers. 2018-06-15 10:56:15 -04:00
Nick Mathewson
19c34b4658 Move or_connection_t to its own header. 2018-06-15 10:48:50 -04:00
Nick Mathewson
6c0fe9d07c Split listener_connection_t into its own header
For once, it's a type that is used almost nowhere else besides the
logical place.
2018-06-15 10:37:33 -04:00
Nick Mathewson
1416f54d1e Split dir_connection_t into its own header 2018-06-15 10:31:21 -04:00
Nick Mathewson
3b917b2408 Split control_connection_t into its own header.
This one was actually fairly simple.
2018-06-15 10:17:27 -04:00
Nick Mathewson
5d5c442e6a Split entry and edge_connection_t into their own headers. 2018-06-15 10:10:24 -04:00
Nick Mathewson
2a574d11ac Move dir_server_t into its own header. 2018-06-14 16:58:01 -04:00
Nick Mathewson
df9a3fe86f Make server_port_cfg_t and port_cfg_t into separate headers. 2018-06-14 16:48:15 -04:00
Nick Mathewson
6896ab28b2 Move entry_port_cfg_t into its own header. 2018-06-14 16:19:11 -04:00
Nick Mathewson
945d871da5 Merge branch 'maint-0.3.3' 2018-06-14 12:50:26 -04:00
Nick Mathewson
71065201dd Merge remote-tracking branch 'public/bug26258_033' into maint-0.3.3 2018-06-14 12:47:09 -04:00
Nick Mathewson
ee860b8f37 squash! Make sure that the test_rust.sh script fails when a test fails
Also make sure that we're actually running the test from within the right
cwd, like we do when we're building.  This seems necessary to avoid
an error when running offline.

Amusingly, it appears that we had this bug before: we just weren't
noticing it, because of bug 26258.
2018-06-13 12:21:25 -04:00
Nick Mathewson
ce692332b8 test_entrynodes: fix a GCC warning
Some versions of GCC complain that the bfn_mock_node_get_by_id
function might return NULL, but we're assuming that it won't.
(We're assuming it won't return NULL because we know in the tests
that we're passing it valid IDs.)

To make GCC happy, tt_assert() that each node_t is set before using
it.

Fixes a second case of bug26269; bugfix on 0.3.0.1-alpha.
2018-06-13 10:45:15 -04:00
Nick Mathewson
015fcd0e11 Fix a GCC "potential null dereference" warning.
Fixes bug 26269; bugfix on c30be5a82d in 0.2.8.2-alpha
2018-06-13 10:34:53 -04:00
Nick Mathewson
ed7b135812 Merge remote-tracking branch 'asn-github/bug26358' 2018-06-13 10:00:37 -04:00
Nick Mathewson
049ba66746 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-06-13 09:58:05 -04:00
Nick Mathewson
286d02995f Merge branch 'maint-0.3.3' 2018-06-13 09:58:05 -04:00
Nick Mathewson
6017447e3a Merge branch 'maint-0.3.1' into maint-0.3.2 2018-06-13 09:58:04 -04:00
Nick Mathewson
94f3007627 Merge branch 'bug26158_031' into maint-0.3.1 2018-06-13 09:58:01 -04:00
Nick Mathewson
1c80eb92fa Merge branch 'maint-0.3.2' into maint-0.3.3 2018-06-13 09:57:10 -04:00
Nick Mathewson
76e9de7c6d Merge branch 'maint-0.3.3' 2018-06-13 09:57:10 -04:00
Nick Mathewson
ff70cc84f8 Merge branch 'bug25686_diagnostic_032' into maint-0.3.2 2018-06-13 09:56:17 -04:00
Nick Mathewson
8c8ed91aae Merge remote-tracking branch 'rl1987/bug24891' 2018-06-13 09:46:50 -04:00
George Kadianakis
99974d4c1e Silence warning of relaycell/circbw tst.
Shouldn't send RELAY_COMMAND_DATA cell with 0 stream id.
2018-06-13 14:14:17 +03:00
George Kadianakis
2520ee34c6 Require live consensus to compute responsible HSDirs.
Here is how this changes the HSv3 client-side and service-side:

For service side we already required live consensus to upload descriptors (see
9e900d1db7) so we should never get there without
a live consensus.

For the client-side we now require a live consensus to attempt to connect to
HS.  While this changes the client behavior in principle, it doesn't really
change it, because we always required live consensus to set HSDir indices, so
before this patch a client with no live consensus would try to compute
responsible HSDirs without any HSDir indices and bug out. This makes the client
behavior more consistent, by requiring a live consensus (and hence a
semi-synced clock) for the client to connect to an HS entirely.

The alternative would have been to allow setting HSDir indices with a non-live
consensus, but this would cause the various problems outlined by commit
b89d2fa1db.
2018-06-13 13:42:34 +03:00
Nick Mathewson
bbbb5f39be bump to 0.3.3.7-dev 2018-06-12 12:05:09 -04:00
Nick Mathewson
ccf2d65610 bump to 0.3.4.2-alpha-dev 2018-06-12 12:04:58 -04:00
Nick Mathewson
16381b579e Merge branch 'maint-0.2.9' into maint-0.3.1 2018-06-12 09:44:17 -04:00
Nick Mathewson
53513e4bfe Merge branch 'maint-0.3.1' into maint-0.3.2 2018-06-12 09:44:17 -04:00
Nick Mathewson
eaa359650c Merge branch 'maint-0.3.2' into maint-0.3.3 2018-06-12 09:44:17 -04:00
Nick Mathewson
03f3ee6d74 Merge branch 'maint-0.3.3' 2018-06-12 09:44:17 -04:00
Linus Nordberg
6cf9288518 Add IPv6 orport address for dannenberg. 2018-06-12 09:44:01 -04:00
Nick Mathewson
f2e7570c75 Bump to 0.3.3.7 2018-06-12 08:57:09 -04:00
Nick Mathewson
6230dfaf14 Merge branch 'maint-0.3.3' 2018-06-12 08:18:57 -04:00
Nick Mathewson
5d8a927aa3 Merge branch 'maint-0.3.1' into maint-0.3.2 2018-06-12 08:18:56 -04:00
Nick Mathewson
7fff99110b Merge branch 'maint-0.3.2' into maint-0.3.3 2018-06-12 08:18:56 -04:00
Nick Mathewson
d84581a3e6 Merge remote-tracking branch 'teor/bug26272-031' into maint-0.3.1 2018-06-12 08:18:53 -04:00
Nick Mathewson
f4e51990b9 Merge remote-tracking branch 'rl1987/bug26283' 2018-06-12 08:17:48 -04:00
Nick Mathewson
74ac463e7f Merge branch 'maint-0.3.1' into maint-0.3.2 2018-06-12 08:11:20 -04:00
Nick Mathewson
6dca180ae9 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-06-12 08:11:20 -04:00
Nick Mathewson
b2470f5140 Merge branch 'maint-0.3.3' 2018-06-12 08:11:20 -04:00
Nick Mathewson
19f3868523 Merge branch 'maint-0.2.9' into maint-0.3.1 2018-06-12 08:11:19 -04:00
Nick Mathewson
fa195626bd bump to 0.3.4.2-alpha 2018-06-11 16:49:17 -04:00
Nick Mathewson
faf4580061 Several attempts to diagnose ticket 25686
There are a few reasons that relays might be uploading desciptors
without saying X-Desc-Gen-Reason:
  1. They are running an old version of our software, before 0.3.2.stable.
  2. They are not running our software, but they are claiming they
     are.
  3. They are uploading through a proxy that strips X-Desc-Gen-Reason.
  4. They somehow had a bug in their software.

According to the 25686 data, 1 is the most common reason.  This
ticket is an attempt to diagnose case 4, or prove that case 4
doesn't actually happen.
2018-06-11 16:24:00 -04:00
Karsten Loesing
ae540569ce Update geoip and geoip6 to the June 7 2018 database. 2018-06-11 21:58:55 +02:00
Nick Mathewson
f399887cfe Merge remote-tracking branch 'mikeperry-github/bug26259' 2018-06-08 10:17:00 -04:00
Nick Mathewson
a141127435 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-06-08 10:12:57 -04:00
Nick Mathewson
dd63033fcb Merge branch 'maint-0.3.1' into maint-0.3.2 2018-06-08 10:11:57 -04:00
Nick Mathewson
1ef8023e00 Merge branch 'maint-0.2.9' into maint-0.3.1 2018-06-08 10:11:57 -04:00
Nick Mathewson
aef0607f38 Merge branch 'maint-0.3.3' 2018-06-08 10:11:57 -04:00
Nick Mathewson
c27bb4072c Merge branch 'maint-0.3.2' into maint-0.3.3 2018-06-08 10:11:57 -04:00
rl1987
719b5c1d27 Avoid out-of-bounds smartlist access in protover_compute_vote()
and contract_protocol_list()
2018-06-08 10:11:32 -04:00
rl1987
25341245ae Implement GETINFO md/all 2018-06-08 13:25:25 +03:00
rl1987
39bbb8d9cf Avoid casting smartlist index implicitly 2018-06-04 11:56:37 +03:00
juga0
7d70f67dea Check bandwidth changes only if small uptime
to upload a new descriptor.
2018-06-03 18:24:27 +00:00
rl1987
9876575d2c Silence -Wbad-function-cast warning (when DEBUG_SMARTLIST is on) 2018-06-03 16:45:09 +03:00
teor
8366be3b51
Silence unused-const-variable warnings in zstd.h on some gcc versions
Fixes bug 26272; bugfix on 0.3.1.1-alpha.
2018-06-02 14:11:04 -07:00
Nick Mathewson
3716ddf1b4 Merge remote-tracking branch 'rl1987/doc25237' 2018-06-02 11:35:06 -07:00
Nick Mathewson
9f884a38e3 Merge branch 'maint-0.3.3' 2018-06-02 10:36:49 -07:00
Nick Mathewson
f15f90e2ca Merge branch 'bug26121-033-squashed' into maint-0.3.3 2018-06-02 10:36:44 -07:00
Mike Perry
fe5764012a Bug 26121: Improve BUILDTIMEOUT_SET accuracy.
We were miscounting the total number of circuits for the TIMEOUT_RATE and
CLOSE_RATE fields of this event.
2018-06-02 10:36:36 -07:00
Nick Mathewson
00e150a0e4 Merge branch 'bug25939_034_01_squashed' 2018-06-02 10:33:33 -07:00
David Goulet
66e76066e0 hs-v3: Build onion address before registering ephemeral service
With the work on #25500 (reducing CPU client usage), the HS service main loop
callback is enabled as soon as the HS service map changes which happens when
registering a new service.

Unfortunately, for an ephemeral service, we were building the onion address
*after* the registration leading to the "service->onion_address` to be an
empty string.

This broke the "HS_DESC CREATED" event which had no onion address in it. And
also, we were logging an empty onion address for that service.

Fixes #25939

Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-06-02 10:33:20 -07:00
rl1987
b7fae0f48c Heed --disable-unittests properly 2018-06-02 12:53:04 +03:00
rl1987
f8d549db7b Point reader to a section in tor-spec.txt 2018-06-02 11:15:10 +03:00
Mike Perry
93ee227e18 Bug 26259: Don't count 0-length RELAY_COMMAND_DATA in CIRC_BW OVERHEAD
This cell should be treated as invalid for purposes of CIRC_BW.
2018-06-01 00:23:08 +00:00
Nick Mathewson
9d06c41c6e Make sure that the test_rust.sh script fails when a test fails
Exit codes from find(1) seem not to be so reliable as we had hoped.

Closes ticket 26258; bugfix on 0.3.3.4-alpha when we fixed #25560
2018-05-31 17:15:57 -07:00
rl1987
eb7a3fae08 Refrain from mentioning old bug in a warning 2018-05-30 19:44:20 +02:00
Nick Mathewson
d7bbfd0f62 Fix various typos 2018-05-30 07:57:22 -07:00
Nick Mathewson
fa1890e97f Merge remote-tracking branch 'public/bug25691_033_again_squashed' into maint-0.3.3 2018-05-27 10:03:11 -04:00
Nick Mathewson
3f3739c6e0 Merge branch 'maint-0.3.1' into maint-0.3.2 2018-05-24 09:40:06 -04:00
Nick Mathewson
f48fb8a720 Merge branch 'maint-0.2.9' into maint-0.3.1 2018-05-24 09:40:06 -04:00
Nick Mathewson
f42739e746 Merge branch 'maint-0.3.3' 2018-05-24 09:40:06 -04:00
Nick Mathewson
0ef432d457 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-05-24 09:40:06 -04:00
Nick Mathewson
c000763f1e Merge branch 'bug26116_033' into maint-0.3.3 2018-05-24 09:40:00 -04:00
Nick Mathewson
c380562aed Merge branch 'bug26116_029' into maint-0.2.9 2018-05-24 09:39:46 -04:00
Nick Mathewson
aeb4be1d5a Add a unit test for PEM-encrypted documents. 2018-05-24 09:36:33 -04:00
Nick Mathewson
36a107855b Merge branch 'bug26156_034' 2018-05-23 09:08:57 -04:00
Nick Mathewson
ff27b7ce60 Update version to 0.3.3.6-dev 2018-05-22 18:05:28 -04:00
Nick Mathewson
38f8b3c63d Merge branch 'maint-0.3.3' 2018-05-22 14:13:28 -04:00
Nick Mathewson
80d673ccea Merge branch 'trove-2018-005_032' into maint-0.3.3 2018-05-22 14:13:23 -04:00
Nick Mathewson
7483aef896 avoid a signed/unsigned comparison. 2018-05-22 14:12:44 -04:00
Nick Mathewson
cde5c9d0c3 Merge branch 'maint-0.3.3' 2018-05-22 13:35:33 -04:00
Nick Mathewson
a5d4ce2b39 Make the TROVE-2018-005 fix work with rust. 2018-05-22 13:35:20 -04:00
Nick Mathewson
b858f576c3 Merge branch 'maint-0.3.3' 2018-05-22 12:54:31 -04:00
Nick Mathewson
6e8e005b53 Merge branch 'trove-2018-005_032' into maint-0.3.3 2018-05-22 12:54:26 -04:00
Nick Mathewson
240bb17714 uint breaks compilation on windows 2018-05-22 12:54:05 -04:00
Nick Mathewson
074b182baa version bump to 0.3.3.6 2018-05-22 12:40:18 -04:00
Nick Mathewson
6442417fde fix wide lines 2018-05-22 12:32:00 -04:00
Isis Lovecruft
3283619acf vote: TROVE-2018-005 Make DirAuths omit misbehaving routers from their vote. 2018-05-22 12:28:33 -04:00
Isis Lovecruft
701c2b69f5 rust: Mirror TROVE-2018-005 fix in Rust protover implementation.
* REFACTORS `UnvalidatedProtoEntry::from_str` to place the bulk of the
   splitting/parsing logic in to a new
   `UnvalidatedProtoEntry::parse_protocol_and_version_str()` method (so that
   both `from_str()` and `from_str_any_len()` can call it.)
 * ADD a new `UnvalidatedProtoEntry::from_str_any_len()` method in order to
   maintain compatibility with consensus methods older than 29.
 * ADD a limit on the number of characters in a protocol name.
 * FIXES part of #25517: https://bugs.torproject.org/25517
2018-05-22 12:28:33 -04:00
Isis Lovecruft
056be68b1b protover: TROVE-2018-005 Fix potential DoS in protover protocol parsing.
In protover.c, the `expand_protocol_list()` function expands a `smartlist_t` of
`proto_entry_t`s to their protocol name concatenated with each version number.
For example, given a `proto_entry_t` like so:

    proto_entry_t *proto = tor_malloc(sizeof(proto_entry_t));
    proto_range_t *range = tor_malloc_zero(sizeof(proto_range_t));

    proto->name = tor_strdup("DoSaaaaaaaaaaaaaaaaaaaaaa[19KB]aaa");
    proto->ranges = smartlist_new();

    range->low = 1;
    range->high = 65536;

    smartlist_add(proto->ranges, range);

(Where `[19KB]` is roughly 19KB of `"a"` bytes.)  This would expand in
`expand_protocol_list()` to a `smartlist_t` containing 65536 copies of the
string, e.g.:

    "DoSaaaaaaaaaaaaaaaaaaaaaa[19KB]aaa=1"
    "DoSaaaaaaaaaaaaaaaaaaaaaa[19KB]aaa=2"
    […]
    "DoSaaaaaaaaaaaaaaaaaaaaaa[19KB]aaa=65535"

Thus constituting a potential resource exhaustion attack.

The Rust implementation is not subject to this attack, because it instead
expands the above string into a `HashMap<String, HashSet<u32>` prior to #24031,
and a `HashMap<UnvalidatedProtocol, ProtoSet>` after).  Neither Rust version is
subject to this attack, because it only stores the `String` once per protocol.
(Although a related, but apparently of too minor impact to be usable, DoS bug
has been fixed in #24031. [0])

[0]: https://bugs.torproject.org/24031

 * ADDS hard limit on protocol name lengths in protover.c and checks in
   parse_single_entry() and expand_protocol_list().
 * ADDS tests to ensure the bug is caught.
 * FIXES #25517: https://bugs.torproject.org/25517
2018-05-22 12:28:33 -04:00
Isis Lovecruft
569b4e57e2 rust: Mirror TROVE-2018-005 fix in Rust protover implementation.
* REFACTORS `UnvalidatedProtoEntry::from_str` to place the bulk of the
   splitting/parsing logic in to a new
   `UnvalidatedProtoEntry::parse_protocol_and_version_str()` method (so that
   both `from_str()` and `from_str_any_len()` can call it.)
 * ADD a new `UnvalidatedProtoEntry::from_str_any_len()` method in order to
   maintain compatibility with consensus methods older than 29.
 * ADD a limit on the number of characters in a protocol name.
 * FIXES part of #25517: https://bugs.torproject.org/25517
2018-05-22 12:27:25 -04:00
Nick Mathewson
a3a8d80beb Merge branch 'trove-2018-005_032' into trove-2018-005_033 2018-05-22 12:27:15 -04:00
Nick Mathewson
bc2d6876b3 Add stdbool to protover.h. Only needed for the 032 backport 2018-05-22 12:15:52 -04:00
Isis Lovecruft
b681438daf vote: TROVE-2018-005 Make DirAuths omit misbehaving routers from their vote. 2018-05-22 12:13:41 -04:00
Isis Lovecruft
eb96692842 protover: TROVE-2018-005 Fix potential DoS in protover protocol parsing.
In protover.c, the `expand_protocol_list()` function expands a `smartlist_t` of
`proto_entry_t`s to their protocol name concatenated with each version number.
For example, given a `proto_entry_t` like so:

    proto_entry_t *proto = tor_malloc(sizeof(proto_entry_t));
    proto_range_t *range = tor_malloc_zero(sizeof(proto_range_t));

    proto->name = tor_strdup("DoSaaaaaaaaaaaaaaaaaaaaaa[19KB]aaa");
    proto->ranges = smartlist_new();

    range->low = 1;
    range->high = 65536;

    smartlist_add(proto->ranges, range);

(Where `[19KB]` is roughly 19KB of `"a"` bytes.)  This would expand in
`expand_protocol_list()` to a `smartlist_t` containing 65536 copies of the
string, e.g.:

    "DoSaaaaaaaaaaaaaaaaaaaaaa[19KB]aaa=1"
    "DoSaaaaaaaaaaaaaaaaaaaaaa[19KB]aaa=2"
    […]
    "DoSaaaaaaaaaaaaaaaaaaaaaa[19KB]aaa=65535"

Thus constituting a potential resource exhaustion attack.

The Rust implementation is not subject to this attack, because it instead
expands the above string into a `HashMap<String, HashSet<u32>` prior to #24031,
and a `HashMap<UnvalidatedProtocol, ProtoSet>` after).  Neither Rust version is
subject to this attack, because it only stores the `String` once per protocol.
(Although a related, but apparently of too minor impact to be usable, DoS bug
has been fixed in #24031. [0])

[0]: https://bugs.torproject.org/24031

 * ADDS hard limit on protocol name lengths in protover.c and checks in
   parse_single_entry() and expand_protocol_list().
 * ADDS tests to ensure the bug is caught.
 * FIXES #25517: https://bugs.torproject.org/25517
2018-05-22 12:12:01 -04:00
Nick Mathewson
48d752407b Add a missing include to get the declaration of OPENSSL_1_1_API
Apparently, even though I had tested on OpenSSL 1.1.1 with
no-deprecated, OpenSSL 1.1.0 is different enough that I should have
tested with that as well.

Fixes bug 26156; bugfix on 0.3.4.1-alpha where we first declared
support for this configuration.
2018-05-22 10:05:27 -04:00
Nick Mathewson
6c35ad08cf Add a missing "return -1" when checking for Ed25519 ID loops
Fixes bug 26158; bugfix on 0.3.0.1-alpha.
2018-05-22 08:54:17 -04:00
Nick Mathewson
3d12663243 Fix a crash bug when testing reachability
Fixes bug 25415; bugfix on 0.3.3.2-alpha.
2018-05-22 08:35:37 -04:00
Nick Mathewson
8483241b4e Improve openssl_version tests with better messages
These tests would report errors, but wouldn't report the offending
strings.
2018-05-21 15:16:07 -04:00
Fernando Fernandez Mancera
d38e7ddf5b Refactor crypto.[ch] into smaller HKDF module.
Add two new files (crypto_hkdf.c, crypto_hkdf.h) as new module of crypto.[ch].
This new module includes all functions and dependencies related to HKDF
operations.  Those have been removed from crypto.[ch].

Follows #24658.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2018-05-18 11:04:31 +02:00
Nick Mathewson
3b42b14979 bump to 0.3.4.1-alpha-dev 2018-05-17 09:44:31 -04:00
Nick Mathewson
5dbf70f903 Bump version to 0.3.4.1-alpha; contemplate a release 2018-05-16 14:40:28 -04:00
Nick Mathewson
2b0aab7a6e Add comments explaining when a connected cell has an UNSPEC addr
Should prevent other bugs like 26117.
2018-05-16 14:12:50 -04:00
Nick Mathewson
3c4353179f Merge branch 'maint-0.3.2' into maint-0.3.3 2018-05-16 12:11:45 -04:00
Nick Mathewson
8340f641c3 Merge branch 'maint-0.3.1' into maint-0.3.2 2018-05-16 12:11:45 -04:00
Nick Mathewson
d3a972561a Merge branch 'maint-0.2.9' into maint-0.3.1 2018-05-16 12:11:45 -04:00
Nick Mathewson
d1e4ffc710 Merge branch 'bug26072_029' into maint-0.2.9 2018-05-16 12:11:40 -04:00
Nick Mathewson
ddc3eb20b7 Merge branch 'bug26116_029' into bug26116_033 2018-05-16 11:43:53 -04:00
Nick Mathewson
881f7157f6 Return -1 from our PEM password callback
Apparently, contrary to its documentation, this is how OpenSSL now
wants us to report an error.

Fixes bug 26116; bugfix on 0.2.5.16.
2018-05-16 11:39:42 -04:00
Mike Perry
d0b1157fc1 Bug 26117: Move CIRC_BW field accounting.
Previously, we used the AF_UNSPEC check to represent valid connected cell
data as a result of the lack of return. This was incorrect.
2018-05-15 18:58:24 +00:00
Nick Mathewson
fcfa22d80a Merge branch 'maint-0.3.3' 2018-05-16 12:11:46 -04:00
Nick Mathewson
4a5c1584fe update tor-rust-dependencies submodule 2018-05-16 09:16:47 -04:00
Nick Mathewson
1442e818b6 Merge remote-tracking branch 'isis-github/bug26106' 2018-05-16 09:16:04 -04:00
Nick Mathewson
e5974e5158 Merge remote-tracking branch 'isis-github/bug26108' 2018-05-16 09:14:13 -04:00
Nick Mathewson
2d2cfbcd81 Merge remote-tracking branch 'isis-github/bug26109' 2018-05-16 09:13:27 -04:00
Isis Lovecruft
4d349c6a61
rust: Update rand_core dependency to 0.2.0-pre.0. 2018-05-15 19:33:20 +00:00
Isis Lovecruft
760cf8e28f
rust: Update rand dev-dependency to 0.5.0-pre.2. 2018-05-15 19:31:29 +00:00
Isis Lovecruft
4c21d41407
rust: Export digests subcrate from our crypto crate. 2018-05-15 18:05:52 +00:00
Isis Lovecruft
d9c877a6e5
rust: Export crypto_rand::* functions from our external crate. 2018-05-15 18:03:18 +00:00
Isis Lovecruft
9988882c63
rust: Move rand crate into crypto parent crate. 2018-05-15 17:48:57 +00:00
Isis Lovecruft
2ac849da36
rust: Make Rng::new() methods public. 2018-05-15 17:45:09 +00:00
Nick Mathewson
98aff146d3 Merge branch 'maint-0.3.3' 2018-05-15 09:32:45 -04:00
Nick Mathewson
6acbd4c112 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-05-15 09:32:44 -04:00
Nick Mathewson
4aa3d511b2 Merge branch 'maint-0.3.1' into maint-0.3.2 2018-05-15 09:32:44 -04:00
Nick Mathewson
502d2c0062 Merge branch 'maint-0.2.9' into maint-0.3.1 2018-05-15 09:32:44 -04:00
Karsten Loesing
033e4723f3 Update geoip and geoip6 to the May 1 2018 database. 2018-05-15 15:20:09 +02:00
Nick Mathewson
5eb2d58880 Add a missing return after marking a stream for bad connected cell
Fixes bug 26072; bugfix on 0.2.4.7-alpha.
2018-05-14 15:54:48 -04:00
Nick Mathewson
a394a2dd86 Merge branch 'bug25903_v5_squashed' 2018-05-14 14:25:07 -04:00
Mike Perry
fd504587d5 Bug 25903: Tests 2018-05-14 14:24:58 -04:00
Nick Mathewson
a9ef335c1b Use router_get_my_routerinfo_with_err to implement the old version
Having one function implemented in terms of the other should keep
them from diverging.

follow-up on #25852
2018-05-14 14:12:36 -04:00
Nick Mathewson
d27fd7ff6b Merge remote-tracking branch 'rl1987/bug25852_take2' 2018-05-14 14:05:50 -04:00
Nick Mathewson
aab626405c Merge remote-tracking branch 'catalyst-github/bug25756' 2018-05-11 18:15:43 -04:00
Nick Mathewson
f6c96fd0ca Merge remote-tracking branch 'public/bug25994' 2018-05-11 17:57:59 -04:00
Roger Dingledine
962c2f8776 get rid of whitespace before #ifdef's
i don't know if whitespace is ok to have before preprocessing
directives on all platforms, but anyway we almost never have it,
so now things are more uniform.
2018-05-11 16:27:55 -04:00
David Goulet
51f65c185e control: Mask the event(s) before using ANY_EVENT_IS_INTERESTING()
Before this commit, the control events were never triggered. It was introduced
with commit 0c19ce7bde.

Fixes #26082

Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-05-11 08:58:11 -04:00
Nick Mathewson
9800f4769f Merge remote-tracking branch 'asn-github/bug26078' 2018-05-11 08:20:49 -04:00
George Kadianakis
efe8f17a4d Properly ignore retval of event_del().
Fixes #26078: CID 1435546.
2018-05-11 15:17:52 +03:00
Nick Mathewson
3799f3116b Merge remote-tracking branch 'saper-github/x509_cert_free_crash' 2018-05-11 08:09:26 -04:00
Marcin Cieślak
308eec7532 testing: X509 certificate structure needs to be initialized
We alloc/free X.509 structures in three ways:

1) X509 structure allocated with X509_new() and X509_free()

2) Fake X509 structure allocated with fake_x509_malloc() and fake_x509_free()
   May contain valid pointers inside.

3) Empty X509 structure shell allocated with tor_malloc_zero() and
   freed with tor_free()
2018-05-11 01:44:09 +00:00
Nick Mathewson
75e5b778e1 Merge remote-tracking branch 'public/bug25981' 2018-05-10 19:31:11 -04:00
rl1987
036df13a03 Tweak error handling for #25852 2018-05-10 16:45:57 +03:00
rl1987
8ad97b7dcf Avoid confusion with errno from libc 2018-05-10 16:33:08 +03:00
Nick Mathewson
b343ba9060 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-05-10 09:22:32 -04:00
Nick Mathewson
7ee67c47fa Merge branch 'maint-0.3.1' into maint-0.3.2 2018-05-10 09:22:32 -04:00
Nick Mathewson
382beb93cb Merge branch 'maint-0.3.3' 2018-05-10 09:22:32 -04:00
Nick Mathewson
2d61a83513 Merge remote-tracking branch 'dgoulet/bug26069_031_01' into maint-0.3.1 2018-05-10 09:22:14 -04:00
Nick Mathewson
f64fa6b19e Merge branch 'maint-0.3.2' into maint-0.3.3 2018-05-10 09:19:28 -04:00
Nick Mathewson
15b8c860d3 Merge branch 'maint-0.3.1' into maint-0.3.2 2018-05-10 09:19:28 -04:00
Nick Mathewson
2eff709edb Merge branch 'maint-0.3.3' 2018-05-10 09:19:28 -04:00
Nick Mathewson
ba70439210 Merge branch 'maint-0.2.9' into maint-0.3.1 2018-05-10 09:19:28 -04:00
Nick Mathewson
edb6acf9ce Merge remote-tracking branch 'juga/ticket26007_029_02' into maint-0.2.9 2018-05-10 09:19:09 -04:00
David Goulet
6e99286d45 hs-v3: Add an extra white-space when parsing descriptor
The specification describes the signature token to be right after a newline
(\n) then the token "signature" and then a white-space followed by the encoded
signature.

This commit makes sure that when we parse the signature from the descriptor,
we are always looking for that extra white-space at the end of the token.

It will allow us also to support future fields that might start with
"signature".

Fixes #26069

Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-05-10 09:16:50 -04:00
Nick Mathewson
1eede00a4b Merge branch 'ticket26063_squashed' 2018-05-10 09:13:28 -04:00
rl1987
36f7d0a940 Make _with_err return routerinfo, like old function does 2018-05-10 16:13:16 +03:00
Nick Mathewson
beca6a585c Merge branch 'ticket26064' 2018-05-10 09:05:15 -04:00
Nick Mathewson
8b4cf7771e Enable/disable per-second callback as needed.
There are three cases where this can happen: changes in our
controller events, changes in our DisableNetwork setting, and
changes in our hibernation state.

Closes ticket 26063.
2018-05-10 09:02:44 -04:00
Nick Mathewson
e722bba263 Add a new function to enable/disable the per-second timer as needed
We're about to use this to turn off the per-second timer when the
network is disabled and there aren't any per-second controller
events enabled.
2018-05-10 09:01:56 -04:00
Nick Mathewson
4218511ecd Remove a workaround for ancient libevent versions.
Libevent has accepted a const timeval argument to event_add() for a
very long time now.
2018-05-10 09:01:50 -04:00
Nick Mathewson
80f582ae18 Add functions to enable/disable periodic_event_t objects. 2018-05-10 09:01:27 -04:00
Nick Mathewson
a4a7939ae1 Merge remote-tracking branch 'dgoulet/ticket26062_034_01' 2018-05-10 08:04:03 -04:00
Nick Mathewson
59812789f7 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-05-10 08:03:04 -04:00
Nick Mathewson
e5acbbd16d Merge branch 'maint-0.3.1' into maint-0.3.2 2018-05-10 08:02:10 -04:00
Nick Mathewson
aa08c19703 Merge branch 'maint-0.2.9' into maint-0.3.1 2018-05-10 08:00:35 -04:00
Mike Perry
1268baee9e Bug 25903: Report new CIRC_BW fields to control port. 2018-05-09 21:23:11 +00:00
Mike Perry
e07e95edd3 Bug 25903: Perform accounting for new CIRC_BW fields.
Two new values in each direction. DELIVERED counts valid end-to-end circuit
data that is accepted by our end and OVERHEAD counts the slack unused data in
each of the relay command cells for those accepted cells.

Control port changes are in the next commit.
2018-05-09 21:23:06 +00:00
Nick Mathewson
d972a8a944 Merge branch 'ticket26016' 2018-05-09 14:04:30 -04:00
Nick Mathewson
f684b48b5b Merge branch 'ticket26009' 2018-05-09 14:01:08 -04:00
Nick Mathewson
0abf09b2ce spelling fix 2018-05-09 14:01:00 -04:00
Nick Mathewson
15ce5a3e5a Fix some clang warnings 2018-05-09 14:01:00 -04:00
Nick Mathewson
c9f07f36bf Mark the 1-per-sec update_current_time() call as redundant.
We still do this time update here, since we do it from all
callbacks, but it is no longer a reason to keep the once-per-second
callback enabled.

Closes ticket 26009.
2018-05-09 14:01:00 -04:00
Nick Mathewson
285e7c98fd Distinguish true clock jumps from idleness
Since we're going to be disabling the second-elapsed callback, we're
going to sometimes have long periods when no events file, and so the
current second is not updated.  Handle that by having a better means
to detect "clock jumps" as opposed to "being idle for a while".
Tolerate far more of the latter.

Part of #26009.
2018-05-09 14:01:00 -04:00
Nick Mathewson
a1a7ebfb8d Give responsibility for waking up from DORMANT to a mainloop event
Closes ticket 26064.
2018-05-09 13:57:00 -04:00
David Goulet
bca8a104b2 Having a ControlPort open doesn't mean we are a client
The any_client_port_set() returns true if the ControlPort is set which is
wrong because we can have that port open but still not behave as a tor client
(like many relays for instance).

Fixes #26062

Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-05-09 12:50:53 -04:00
David Goulet
67a41b6306 Having a ControlPort open doesn't mean we are a client
The options_any_client_port_set() returns true if the ControlPort is set which
is wrong because we can have that port open but still not behave as a tor
client (like many relays for instance).

Fixes #26062

Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-05-09 12:49:34 -04:00
David Goulet
01ffe8e2f4 config: Move any_client_port_set() to config.c
This functions is now used outside of networkstatus.c and makes more sense to
be in config.c.

It is also renamed to options_any_client_port_set() for the config.c
namespace.

No code behavior change.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-05-09 12:36:39 -04:00
Nick Mathewson
fa7847e450 Use net_is_completely_disabled() in connection.c
This fixes the XXXX case that we had before, and also enforces the
rule that we won't open connections when we're in hard hibernation.
2018-05-09 12:26:50 -04:00
Nick Mathewson
7595eae52a Add a new net_is_completely_disabled() function 2018-05-09 12:21:08 -04:00
Nick Mathewson
c0feb698a0 Comment-only fix: annotate we_are_hibernating() usage
Everywhere we use we_are_hibernating(), remind the reader what it
means.

(Also, add an XXXX to note a DisableNetwork usage to change later.)
2018-05-09 12:18:39 -04:00
Nick Mathewson
50328533e3 Add we_are_fully_hibernating() to distinguish hibernation states
We want to tell "shut down" from "shutting down".
2018-05-09 12:11:14 -04:00
Nick Mathewson
0c19ce7bde Give control.c responsibility for its own once-a-second events
Now it has a function that can tell the rest of Tor whether any
once-a-second controller item should fire, and a function to fire
all the once-a-second events.
2018-05-09 12:06:52 -04:00
Nick Mathewson
79b38081e9 Add a macro to simplify control_update_global_event_mask(). 2018-05-09 12:02:19 -04:00
juga0
dbdde76f56 Test read bandwidth measurements with empty file 2018-05-09 15:58:25 +00:00
Nick Mathewson
abde29824c Merge branch 'maint-0.3.2' into maint-0.3.3 2018-05-09 11:53:18 -04:00
Nick Mathewson
61d5ce83a1 Merge branch 'maint-0.3.3' 2018-05-09 11:53:18 -04:00
Nick Mathewson
394f102ea6 Merge remote-tracking branch 'asn-github/bug25761_032' into maint-0.3.2 2018-05-09 11:53:15 -04:00
teor
867fe40f91 Stop logging stack contents when reading a zero-length bandwidth file
When directory authorities read a zero-byte bandwidth file, they log
a warning with the contents of an uninitialised buffer. Log a warning
about the empty file instead.

Fixes bug 26007; bugfix on 0.2.2.1-alpha.
2018-05-09 15:19:28 +00:00
Nick Mathewson
9df20f6076 Merge branch 'maint-0.3.3' 2018-05-09 08:25:52 -04:00
Nick Mathewson
a639a67844 Merge branch 'libressl_201805_033' into maint-0.3.3 2018-05-09 08:25:32 -04:00
Nick Mathewson
e6d6347690 Merge remote-tracking branch 'public/bug26005_034' 2018-05-09 08:23:27 -04:00
George Kadianakis
7e8c5e3662 Detect when v3 services get disabled after HUP.
Remove v3 optimization which made Tor not detect disabling services.

This optimization is not so needed because we only call that function after HUP
anyway.

Fixes bug #25761.
2018-05-09 11:25:00 +03:00
George Kadianakis
5dc00c0661 Detect when v2 services get disabled after HUP.
During service configuration, rend_service_prune_list_impl_() sets
rend_service_staging_list to NULL, which blocked pruning after a HUP.

This patch initializes rend_service_staging_list when needed, so that HUP can
detect disabled onion services.

Fixes bug #25761.
2018-05-09 11:25:00 +03:00
Nick Mathewson
01d729cbfe Fix compilation of test_addr.c
This needs to include crypto_rand.h (which it didn't before it was
merged).
2018-05-08 20:20:54 -04:00
Nick Mathewson
a0f051137d Merge branch 'ticket25993_squashed' 2018-05-08 20:09:42 -04:00
Nick Mathewson
24ba5fd748 More unit tests for addressmap_get_virtual_address().
Previously the coverage on this function was mostly accidental,
coming as it did from test_entryconn.c.  These new tests use mocking
to ensure that we actually hit the different failure and retry cases
of addressmap_get_virtual_address(), and make our test coverage a
bit more deterministic.

Closes ticket 25993.
2018-05-08 20:09:33 -04:00
Taylor Yu
de343b4e42 Improve tolerance for dirauths with skewed clocks
Previously, an authority with a clock more than 60 seconds ahead could
cause a client with a correct clock to warn that the client's clock
was behind.  Now the clocks of a majority of directory authorities
have to be ahead of the client before this warning will occur.

Relax the early-consensus check so that a client's clock must be 60
seconds behind the earliest time that a given sufficiently-signed
consensus could possibly be available.

Add a new unit test that calls warn_early_consensus() directly.

Fixes bug 25756; bugfix on 0.2.2.25-alpha.
2018-05-08 17:59:03 -05:00
Taylor Yu
d6948bc776 Deindent warn_early_consensus()
Remove one level of indentation by returning early from the function.
2018-05-08 17:59:03 -05:00
Taylor Yu
0b80a0e500 Factor out warn_early_consensus()
Factor out the early consensus warning code from
networkstatus_set_current_consensus() into a new function
warn_early_consensus().
2018-05-08 17:59:03 -05:00
Taylor Yu
4921670a8c Test early-consensus clock skew warnings 2018-05-08 17:59:03 -05:00
Taylor Yu
be8306c1fb Add expect_no_log_msg_containing() 2018-05-08 17:59:03 -05:00
Taylor Yu
c223377ce6 Make clock_skew_warning() mockable 2018-05-08 17:59:03 -05:00
Taylor Yu
5bd2060054 tests: Add "now" param to construct_consensus()
construct_consensus() in test_routerlist.c created votes using a
timestamp from time().  Tests that called construct_consensus() might
have nondeterministic results if they rely on time() not changing too
much on two successive calls.

Neither existing of the two existing tests that calls
construct_consensus is likely to have a failure due to this problem.
2018-05-08 17:59:03 -05:00
Nick Mathewson
6bfa87d3aa Update rust submodule. 2018-05-08 18:51:31 -04:00
Isis Lovecruft
af182d4ab5
rust: Add crypto crate and implement Rust wrappers for SHA2 code.
* FIXES #24659: https://bugs.torproject.org/24659
2018-05-08 21:03:37 +00:00
Nick Mathewson
3df37d7b6b Merge branch 'bug26004_029_squashed' 2018-05-08 14:26:05 -04:00
Nick Mathewson
a17dc0875a Avoid unsigned integer underflow on empty input. 2018-05-08 14:24:29 -04:00
juga0
dbc80ad19b Allow bandwidth-file lines to have node_id in the last position
Closes ticket 26004.
2018-05-08 14:24:29 -04:00
Nick Mathewson
5edc72a45b Merge remote-tracking branch 'mikeperry/bug25870_rebase' 2018-05-08 14:12:29 -04:00
Nick Mathewson
2a4439adf3 Merge branch 'ticket26008' 2018-05-08 14:09:38 -04:00
Roger Dingledine
c3ae14549d minor cleanups on commit 17daab76
better punctuation and clearer wording
2018-05-08 12:21:24 -04:00
Fernando Fernandez Mancera
827b85e907 Make dh_param_* stuff static again.
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2018-05-08 16:25:40 +02:00
Fernando Fernandez Mancera
ffbf8673b5 Include crypto_dh.h in order to solve dependency issues.
Included crypto_dh.h in some files in order to solve DH module dependency
issues.

Follows #24658.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2018-05-08 15:57:31 +02:00
Fernando Fernandez Mancera
f91469c165 Refactor crypto.[ch] into smaller DH module.
Add two new files (crypto_dh.c, crypto_dh.h) as new module of crypto.[ch]. This
new module includes all functions and dependencies related to DH operations.
Those have been removed from crypto.[ch].

Follows #24658.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2018-05-08 15:51:39 +02:00
Fernando Fernandez Mancera
5b7a12d58a Add crypto_log_errors() to crypto_util.[ch]
crypto_log_errors() has been moved to crypto_util.[ch]. It was duplicated in
some files so they have been removed too.

Follows #24658.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2018-05-08 15:40:11 +02:00
Nick Mathewson
5ad72bc1f5 Merge remote-tracking branch 'catalyst-github/bug26036' 2018-05-07 14:38:26 -04:00
Nick Mathewson
8b1380cbd0 Don't crash when closing a connection before initializing libevent
Fixes bug 25981; bugfix on 96c5ac338a.  Bug not in any released
version of Tor.
2018-05-07 14:30:30 -04:00
Taylor Yu
9326abe16a Restore sys/random.h inclusion for getentropy()
Code movement for the refactoring for ticket 24658 didn't copy the
inclusion of sys/random.h, which is needed to get a prototype for
getentropy() on macOS 10.12 Sierra.  It also didn't copy the inclusion
of sys/syscall.h, which might prevent the getrandom() syscall from
being properly detected.  Move these inclusions.  Bug not in any
released Tor.
2018-05-07 12:56:12 -05:00
Nick Mathewson
17236a5842 Merge branch 'maint-0.3.3' 2018-05-07 13:33:19 -04:00
Nick Mathewson
46002aa691 Merge remote-tracking branch 'mikeperry/bug25733_029' into maint-0.3.3 2018-05-07 13:33:12 -04:00
Nick Mathewson
2c5841a8b8 Merge remote-tracking branch 'saper/default_nickname' 2018-05-07 13:31:03 -04:00
Nick Mathewson
a1a32b4834 Merge branch 'ticket26014' 2018-05-07 12:07:53 -04:00
Nick Mathewson
fd1d0a7d2e Merge remote-tracking branch 'mikeperry/bug25705_v3_033' 2018-05-07 11:09:25 -04:00
Nick Mathewson
6e3e96d2ff Fix the selection of events to cancel in test_workqueue.c
Our previous algorithm had a nonzero probability of picking no
events to cancel, which is of course incorrect.  The new code uses
Vitter's good old reservoir sampling "algorithm R" from 1985.

Fixes bug 26008; bugfix on 0.2.6.3-alpha.
2018-05-06 21:03:26 -04:00
Nick Mathewson
d14c245a0f Add unit test for ..get_start_of_next_voting_interval().
This functionality was covered only accidentally by our voting-test
code, and as such wasn't actually tested at all.  The tests that
called it made its coverage nondeterministic, depending on what time
of day you ran the tests.

Closes ticket 26014.
2018-05-06 20:42:18 -04:00
rl1987
b00d17aa9e Improve GETCONF exit-policy/* error handling
This will yield different error codes for transient and permament
errors. Furthermore, Tor will give human readable error
messages to controller.
2018-05-05 16:12:00 +02:00
Isis Lovecruft
f36656cada
build: Fix missing include for src/rust/external/crypto_rand.rs file.
* FIXES #26025: https://bugs.torproject.org/26025
2018-05-04 22:23:17 +00:00
Isis Lovecruft
f1864ff4a1
rust: Update Cargo.lock file with changes from #26024. 2018-05-04 20:41:25 +00:00
Isis Lovecruft
36dd2a467f
rust: Update submodule commit for src/ext/rust directory.
* FIXES part of #26024: https://bugs.torproject.org/26024
2018-05-04 20:37:16 +00:00
Isis Lovecruft
b5bd19ea05
Update rand dependency from 0.5.0-pre.0 to 0.5.0-pre.1. 2018-05-04 19:16:42 +00:00
Nick Mathewson
6f8b961a65 I should have tested before I pushed. 2018-05-03 20:16:53 -04:00
Nick Mathewson
08e525c198 Merge remote-tracking branch 'github/ticket25995' 2018-05-03 16:52:09 -04:00
Nick Mathewson
80b9a589bb Merge remote-tracking branch 'dgoulet/ticket25914_034_01' 2018-05-03 16:48:03 -04:00
Nick Mathewson
2f269bfaf1 Add src/rust/rand to include.am 2018-05-03 16:16:09 -04:00
Nick Mathewson
2d07aef3cc Move some includes around to try to fix windows builds 2018-05-03 16:14:38 -04:00
Nick Mathewson
bd153e4640 Update rust dependencies to latest version. 2018-05-03 13:55:55 -04:00
Nick Mathewson
c3b7258370 Merge remote-tracking branch 'isis/bug24660_r1' 2018-05-03 13:50:18 -04:00
Nick Mathewson
48d8fe533e Merge remote-tracking branch 'dgoulet/ticket25990_034_01' 2018-05-03 13:40:10 -04:00
Nick Mathewson
89cafc4afa Use OPENSSL_1_1_API in place of raw OPENSSL_VERSION_NUMBER checks
This is needed for libressl-2.6.4 compatibility, which we broke when
we merged a15b2c57e1 to fix bug 19981.  Fixes bug 26005; bug
not in any released Tor.
2018-05-03 13:33:14 -04:00
Nick Mathewson
b0e5757710 Refactor to remove n_libevent_errors
We cleared this value in second_elapsed_callback.  But what were we
using it for?  For detecting if Libevent returned EINVAL too often!
We already have a way to detect too-frequent events, and that's with
a ratelim_t.  Refactor the code to use that instead.  Closes ticket
26016.
2018-05-03 12:44:00 -04:00
Nick Mathewson
83137275a7 Add update_current_time() calls to periodic and event-driven callbacks
This is part of 26009, where we're going to keep track of the
current time and its jumps without having to do so in
second_elapsed_callback.
2018-05-03 12:02:10 -04:00
Nick Mathewson
1d16b7124f Basic unit tests for update_current_time().
This function is about to get more complicated, so we should track
how it's working.
2018-05-03 12:02:10 -04:00
Nick Mathewson
b0598f2a12 Move the "update the current second" code from second_elapsed_callback
This now happens in a new function, with the intent of having it
invoked from our callbacks.  This is one step on the way to 26009.
2018-05-03 12:02:10 -04:00
Nick Mathewson
5e0316142f Merge remote-tracking branch 'github/ticket25952' 2018-05-03 11:59:53 -04:00
Nick Mathewson
ed636de4cc Merge remote-tracking branch 'github/ticket25951' 2018-05-03 11:59:31 -04:00