Commit Graph

11397 Commits

Author SHA1 Message Date
Nick Mathewson
a96c0affcb Better policy support for IPv6
Now, "accept *:80" means "accept all addresses on port 80", and not
just IPv4.  For just v4, say "accept *4:80"; for just v6 say "accept
*6:80".

We can parse these policies from torrc just fine, and we should be
successfully keeping them out of descriptors for now.

We also now include appropriate IPv6 addresses in "reject private:*"
2012-11-14 23:16:21 -05:00
Nick Mathewson
2eb7eafc9d Add a new family-specific syntax for tor_addr_parse_mask_ports
By default, "*" means "All IPv4 addresses" with
tor_addr_parse_mask_ports, so I won't break anything.  But if the new
EXTENDED_STAR flag is provided, then * means "any address", *4 means
"any IPv4 address" (that is, 0.0.0.0/0), and "*6" means "any IPv6
address" (that is, [::]/0).

This is going to let us have a syntax for specifying exit policies in
torrc that won't drive people mad.

Also, add a bunch of unit tests for tor_addr_parse_mask_ports to test
these new features, and to increase coverage.
2012-11-14 23:16:21 -05:00
Nick Mathewson
462ebb270a Refactor begin cell parsing into its own function, with tests.
Add 'flags' argument to begin cells, per proposal 208.
2012-11-14 23:16:21 -05:00
Nick Mathewson
ca8843df0a Refactor client_dns_set_{reverse_,}addressmap() to take a circ
We'd like these functions to be circuit-relative so that we can
implement a per-circuit DNS cache and per-circuit DNS cache rules for
proposal 205 or its successors.  I'm doing this now, as a part of the
IPv6 exits code, since there are about to be a few more instances
of code using this.
2012-11-14 23:16:21 -05:00
Nick Mathewson
7908ab2093 Move address map into its own file. 2012-11-14 23:16:20 -05:00
Andrea Shepard
2cb82c33bc Merge branch 'bug7267' of ssh://git-rw.torproject.org/user/andrea/tor 2012-11-13 18:54:24 -08:00
Andrea Shepard
3db3daa663 Add comment explaining different channel close functions 2012-11-13 18:50:37 -08:00
Nick Mathewson
02a43e5eb6 Merge remote-tracking branch 'public/bug7059' 2012-11-13 21:50:07 -05:00
Nick Mathewson
b17aa28e46 Actually distribute the geoip6 file.
Fixes a bug (with no ticket) on 0.2.4.6-alpha.
2012-11-13 21:24:28 -05:00
Andrea Shepard
7ab3004223 Call channel_mark_for_close() properly in hibernate_go_dormant() 2012-11-13 13:45:00 -08:00
Roger Dingledine
83b1a50cc0 bump to 0.2.4.6-alpha-dev 2012-11-13 01:46:59 -05:00
Roger Dingledine
b13c6becc8 bump to 0.2.4.6-alpha 2012-11-13 00:00:33 -05:00
Roger Dingledine
a90affa84b Merge branch 'maint-0.2.3' 2012-11-12 23:49:37 -05:00
Roger Dingledine
88bb48e785 use a more logical operator
Fix a harmless bug when opting against publishing a relay descriptor
because DisableNetwork is set.

Fixes bug 7464; bugfix on 0.2.3.9-alpha.
2012-11-12 23:47:21 -05:00
Nick Mathewson
f473d83dea Possible fix for bug 7212
This is the simplest possible workaround: make it safe to call
circuit_cell_queue_clear() on a non-attached circuit, and make it
safe-but-a-LD_BUG-warning to call update_circuit_on_cmux() on a
non-attached circuit.

 LocalWords:  unstage src Untracked
2012-11-12 08:28:09 -05:00
Andrea Shepard
0523c8de7d Merge branch 'check_for_orconn_on_close_squashed' of ssh://git-rw.torproject.org/user/andrea/tor 2012-11-10 03:24:41 -08:00
Andrea Shepard
99e82cab30 Make everything in connection.c that uses connection_or_notify_error() also use connection_mark_and_close_internal() to avoid spurious warnings 2012-11-10 02:35:47 -08:00
Andrea Shepard
8124398835 Check for orconns in connection_mark_for_close and connection_mark_and_flush, and pass the call through channel_close_for_error with a warning to avoid asserts 2012-11-10 02:35:47 -08:00
Nick Mathewson
713736a6a7 Fix a memory leak in handling errors on CERTS cells. bug 7422 2012-11-08 23:01:39 -05:00
Nick Mathewson
8b5d95db0d Fix test.c compilation on mingw32.
Looks like windows doesn't have an s6_addr32 in its in6_addr.

Bug not in any released version of Tor; bugfix on abb886014e.
2012-11-08 20:18:34 -05:00
Nick Mathewson
08436b27ff Merge remote-tracking branch 'origin/maint-0.2.3' 2012-11-08 20:00:54 -05:00
Nick Mathewson
e567b4482a Turn a memwipe in tor_process_handle_destroy() back to memset
It broke linking on tor-resolve.c, and it's not actually sanitizing
anything sensitive.  Fix for bug 7420; bug not on ony released Tor.
2012-11-08 19:59:54 -05:00
Nick Mathewson
e1c7d12b1d Turn some memset()s introduced in tor 0.2.4 into memwipe()s 2012-11-08 17:00:36 -05:00
Nick Mathewson
81deddb08c Merge remote-tracking branch 'origin/maint-0.2.3'
Conflicts:
	src/common/crypto.c
	src/or/rendservice.c
2012-11-08 16:48:04 -05:00
Nick Mathewson
49dd5ef3a3 Add and use and unlikely-to-be-eliminated memwipe()
Apparently some compilers like to eliminate memset() operations on
data that's about to go out-of-scope.  I've gone with the safest
possible replacement, which might be a bit slow.  I don't think this
is critical path in any way that will affect performance, but if it
is, we can work on that in 0.2.4.

Fixes bug 7352.
2012-11-08 16:44:50 -05:00
Andrea Shepard
9f3f5372b8 Merge branch 'bug7350' of ssh://git-rw.torproject.org/user/andrea/tor 2012-11-07 11:43:04 -08:00
Andrea Shepard
80eb03ae0a Don't call channel_send_destroy() when closing a circuit on a closing channel 2012-11-06 17:58:59 -08:00
Andrea Shepard
688cea7248 Check for closing channel in channel_send_destroy() 2012-11-06 17:52:14 -08:00
Nick Mathewson
cd054ceada Merge branch 'bug7285' 2012-11-06 18:02:03 -05:00
George Kadianakis
a9f786758d Add warning message when a managed proxy dies during configuration. 2012-11-06 17:53:09 -05:00
Nick Mathewson
11c467f643 Fix a stupid logic-error in warnings about low ports.
Instead of warning about low ports that are advertised, we should have
been warning about low ports that we're listening on.  Bug 7285, fix
on 0.2.3.9-alpha.
2012-11-06 17:15:39 -05:00
Nick Mathewson
0e8be13b9f Allow an optional $ in GETINFO ns/id/<identity>
That's not where I'd want to put a $, but apparently the other
foo/id/<identity> things allow it, as does an arguably valid
interpretation of control-spec.txt.  So let's be consistent.

Fix for a piece of bug 7059.
2012-11-04 22:12:11 -05:00
Nick Mathewson
39a0a2c3ae Merge remote-tracking branch 'asn/bug7292' 2012-11-04 21:54:19 -05:00
Nick Mathewson
2b781613b0 Whitespace fixes 2012-11-04 21:52:28 -05:00
Nick Mathewson
98204729aa Clean up nonsensical calling convention for config_load_geoip_file_
(How many "load a file" functions do you typically see where the
function frees the filename argument?)
2012-11-04 21:51:02 -05:00
Nick Mathewson
626a8b60d7 Merge remote-tracking branch 'linus/bug5053-bug5055'
Conflicts:
	src/or/geoip.c
2012-11-04 21:44:31 -05:00
Nick Mathewson
e5ca5040a5 Add an SLIST_ENTRY definition back on non-win32
Otherwise we break openbsd headers.

Fixes bug 7293; bug not on any released Tor.
2012-11-03 20:18:43 -04:00
George Kadianakis
37f8a2263e Use LOG_WARN instead of LOG_PROTOCOL_WARN when parsing transport lines. 2012-11-02 23:48:53 +02:00
Nick Mathewson
05194cce62 Avoid c99 designated initializers in circuitmux_ewma.c
We still want to build on compilers w/o c99 support, such as
(notoriously, shamefully) MSVC.

So I'm commenting out the designated initializers in
circuitmux_ewma.c.  The alternative would have been to use some kind
of macros to use designated initializers only when they're
supported, but that's error-prone, and can lead to code having
different meanings under different compilers.

Bug 7286; fix on 0.2.4.4-alpha; spotted by Gisle Vanem.
2012-11-02 13:14:39 -04:00
Nick Mathewson
ae99fc1ccb Rename SLIST_ENTRY to TOR_SLIST_ENTRY to fix windows compilation
Apparently winnt.h defines a different SLIST_ENTRY of its own.

Bug not in any version of Tor.
2012-11-01 17:40:27 -04:00
Linus Nordberg
ffddd4de2a Change some comments to reflect the multitude of GeoIP databases. 2012-10-31 16:38:07 +01:00
Nick Mathewson
9327a9f607 Fix whitespace 2012-10-31 11:27:13 -04:00
Linus Nordberg
e7e68b80a7 Don't memcmp struct in6_addr but rather its s6_addr member. 2012-10-31 15:52:56 +01:00
Linus Nordberg
6a241ff3ff Duplicate less code. 2012-10-31 13:58:55 +01:00
Nick Mathewson
965d778b26 Add a copy of the queue(3) manpage to the git repository.
See 7105
2012-10-30 19:16:15 -04:00
Andrea Shepard
be37125030 Merge branch 'bsd_queue' of ssh://git-rw.torproject.org/nickm/tor 2012-10-30 14:39:14 -07:00
Anthony G. Basile
74babcb1ea Fix undefined reference to libm functions linking tor-fw-helper
When configuring tor without upnp support, ie ./configure --disable-upnp,
tor-fw-helper fails to link with undefined references to `ceil' and
`log'.  This if fixed by linking to libm.

X-Gentoo-Bug: 435040
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=435040
Reported-by: Alexandre <alexandre.cortes@outlook.com>
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2012-10-28 10:54:53 -04:00
Nick Mathewson
18f836ee8f Merge remote-tracking branch 'asn/bug6832' 2012-10-27 16:48:05 -04:00
Roger Dingledine
2fd064d28f bump to 0.2.4.5-alpha-dev 2012-10-26 02:32:44 -04:00
Roger Dingledine
4fc866ce7f touch-ups 2012-10-26 00:39:06 -04:00
Nick Mathewson
c331694d06 Bump the version number to 0.2.4.5-alpha
(For real this time.  It turns out that 4 and 5 are different numbers.)
2012-10-25 10:44:14 -04:00
Nick Mathewson
951b5b7e6a Bump version to 0.2.4.5-alpha 2012-10-25 10:33:17 -04:00
Nick Mathewson
48cdcc9d4a Merge branch 'link_negotiation_assert_024' 2012-10-25 10:21:01 -04:00
Nick Mathewson
a1c121e78e Change changes file and comment for 7189, for making it 0.2.4-only for now 2012-10-24 22:11:43 -04:00
Nick Mathewson
4a7962e439 Merge remote-tracking branch 'public/bug7189_tentative' 2012-10-24 22:07:10 -04:00
Nick Mathewson
62a49c0cc8 Only disable TLS tickets when being/acting as a server.
Fix for bug 7189.
2012-10-24 20:13:25 -04:00
Nick Mathewson
c442d85439 Fix a remotely triggerable assertion failure (CVE-2012-2250)
If we completed the handshake for the v2 link protocol but wound up
negotiating the wong protocol version, we'd become so confused about
what part of the handshake we were in that we'd promptly die with an
assertion.

This is a fix for CVE-2012-2250; it's a bugfix on 0.2.3.6-alpha.
All servers running that version or later should really upgrade.

Bug and fix from "some guy from France."  I tweaked his code slightly
to make it log the IP of the offending node, and to forward-port it to
0.2.4.
2012-10-23 23:09:21 -04:00
Nick Mathewson
758428dd32 Fix a remotely triggerable assertion failure (CVE-2012-2250)
If we completed the handshake for the v2 link protocol but wound up
negotiating the wong protocol version, we'd become so confused about
what part of the handshake we were in that we'd promptly die with an
assertion.

This is a fix for CVE-2012-2250; it's a bugfix on 0.2.3.6-alpha.
All servers running that version or later should really upgrade.

Bug and fix from "some guy from France."  I tweaked his code slightly
to make it log the IP of the offending node.
2012-10-23 22:58:38 -04:00
Nick Mathewson
04a509e04b Merge remote-tracking branch 'andrea/bug7191_v2' 2012-10-23 21:51:38 -04:00
Nick Mathewson
b99457d429 Make unit test for bug7191 work with new smartlist_new() name 2012-10-23 21:49:46 -04:00
Nick Mathewson
b0646cc142 Merge remote-tracking branch 'origin/maint-0.2.2' into maint-0.2.3 2012-10-23 21:48:50 -04:00
Andrea Shepard
cb693ef56e Add some unit tests for smartlist_bsearch_idx() on short lists
Conflicts:
	src/test/test_containers.c
2012-10-23 21:35:30 -04:00
Nick Mathewson
8905789170 Fix binary search on lists of 0 or 1 element.
The implementation we added has a tendency to crash with lists of 0 or
one element.  That can happen if we get a consensus vote, v2
consensus, consensus, or geoip file with 0 or 1 element.  There's a
DOS opportunity there that authorities could exploit against one
another, and which an evil v2 authority could exploit against anything
downloading v2 directory information..

This fix is minimalistic: It just adds a special-case for 0- and
1-element lists.  For 0.2.4 (the current alpha series) we'll want a
better patch.

This is bug 7191; it's a fix on 0.2.0.10-alpha.
2012-10-23 21:32:26 -04:00
Andrea Shepard
500ebdb2f3 Add some unit tests for smartlist_bsearch_idx() on short lists 2012-10-23 14:28:19 -07:00
Andrea Shepard
fb97c0214b Rewrite smartlist_bsearch_idx() to not be broken for lists of length zero or one (fixes bug 7191) 2012-10-23 14:27:56 -07:00
Roger Dingledine
4c06a804d9 Merge branch 'maint-0.2.3' 2012-10-23 17:26:07 -04:00
Roger Dingledine
2ecee3fce2 Let 0.2.3 clients exit to internal addresses if they want
Clients now consider the ClientRejectInternalAddresses config option
when using a microdescriptor consensus stanza to decide whether
an exit relay would allow exiting to an internal address. Fixes
bug 7190; bugfix on 0.2.3.1-alpha.
2012-10-23 17:18:01 -04:00
Roger Dingledine
e17fd57782 fix typo 2012-10-23 17:15:28 -04:00
Nick Mathewson
98c24670e7 Merge remote-tracking branch 'origin/maint-0.2.3' 2012-10-23 16:28:34 -04:00
Nick Mathewson
85659d3964 Fix parse_short_policy (bug 7192.)
Our implementation of parse_short_policy was screwed up: it would
ignore the last character of every short policy.  Obviously, that's
broken.

This patch fixes the busted behavior, and adds a bunch of unit tests
to make sure the rest of that function is okay.

Fixes bug 7192; fix on 0.2.3.1-alpha.
2012-10-23 13:49:48 -04:00
Roger Dingledine
4c8b58f900 add a unit test to expose bug 7192 2012-10-22 17:09:43 -04:00
Nick Mathewson
848333c6d6 Fix more madness from the split_circuitbuild merge 2012-10-22 14:36:30 -04:00
Nick Mathewson
fa6a65756f Kill extraneous x from 907db008ab
Looks like clang doesn't complain about this kind of thing.

Spotted by Andrea.  Bug not in any released version.
2012-10-22 14:29:15 -04:00
Nick Mathewson
86258df65d Merge branch 'split_circuitbuild'
Conflicts:
	src/or/circuitbuild.c

There was a huge-looking conflict in circuitbuild.c, but the only
change that had been made to circuitbuild.c since I forked off the
split_circuitbuild branch was 17442560c4.  So I took the
split_circuitbuild version of the conflicting part, and manually
re-applied the change from 17442560c44e8093f9a..
2012-10-22 11:35:32 -04:00
Linus Nordberg
8c9b427425 Name variables more consistently. 2012-10-22 12:36:34 +02:00
Linus Nordberg
9d71d97e9d Document two functions. 2012-10-22 12:24:29 +02:00
Roger Dingledine
a73b275300 bump to 0.2.4.4-alpha-dev 2012-10-21 13:25:35 -04:00
Roger Dingledine
fe3b95f359 bump to 0.2.4.4-alpha 2012-10-20 16:06:05 -04:00
Linus Nordberg
172aac62ed Rename C reserved identifiers missed before. 2012-10-20 20:56:59 +02:00
Linus Nordberg
cb51807236 Add "IPVersions" to control command "status/clients-seen". 2012-10-20 20:56:59 +02:00
Linus Nordberg
af175fa7e4 Duplicate less code. 2012-10-20 20:56:59 +02:00
Linus Nordberg
817ff962f8 Separate IPv4 and IPv6 geoip file loading.
Also add IPv6 geoip file digest to extra info.

Also also, add support for IPv6 addresses in control command
"ip-to-country".
2012-10-20 20:56:59 +02:00
Nick Mathewson
e8f547c181 Merge branch 'block_renegotiate_024' 2012-10-19 14:32:42 -04:00
Nick Mathewson
1cc06bd35e Merge branch 'block_renegotiate_023' into maint-0.2.3 2012-10-19 14:30:31 -04:00
Nick Mathewson
0dac0d8ad6 Merge remote-tracking branch 'origin/maint-0.2.3' 2012-10-19 03:06:15 -04:00
Robert Ransom
d3bfdd6108 Don't serve or accept v2 HS descs over a DirPort
(changes file tweaked by nickm)
2012-10-19 02:56:25 -04:00
Nick Mathewson
9f1b1ef4fb Merge remote-tracking branch 'origin/maint-0.2.3' 2012-10-19 01:01:26 -04:00
Nick Mathewson
a0e9dc9f55 Merge remote-tracking branch 'origin/maint-0.2.2' into maint-0.2.3 2012-10-19 00:58:33 -04:00
Nick Mathewson
8743080a28 Disable TLS Session Tickets, which we were apparently getting for free
OpenSSL 1.0.0 added an implementation of TLS session tickets, a
"feature" that let session resumption occur without server-side state
by giving clients an encrypted "ticket" that the client could present
later to get the session going again with the same keys as before.
OpenSSL was giving the keys to decrypt these tickets the lifetime of
the SSL contexts, which would have been terrible for PFS if we had
long-lived SSL contexts.  Fortunately, we don't.  Still, it's pretty
bad.  We should also drop these, since our use of the extension stands
out with our non-use of session cacheing.

Found by nextgens. Bugfix on all versions of Tor when built with
openssl 1.0.0 or later.  Fixes bug 7139.
2012-10-19 00:54:51 -04:00
Andrea Shepard
981f25a73a Factor out common parts of channel_tls_connect() and channel_tls_handle_incoming(); fixes get_remote_addr problem with incoming connections for bug 7112 2012-10-18 21:53:50 -04:00
Nick Mathewson
3d8b73db55 Discard extraneous renegotiation attempts in the v3 link protocol
Failure to do so left us open to a remotely triggerable assertion
failure. Fixes CVE-2012-2249; bugfix on 0.2.3.6-alpha. Reported by
"some guy from France".

This patch is a forward-port to 0.2.4, to work with the new channel
logic.
2012-10-17 19:19:58 -04:00
Nick Mathewson
f357ef9dcc Discard extraneous renegotiation attempts in the v3 link protocol
Failure to do so left us open to a remotely triggerable assertion
failure. Fixes CVE-2012-2249; bugfix on 0.2.3.6-alpha. Reported by
"some guy from France".
2012-10-17 19:18:16 -04:00
Nick Mathewson
850c990144 Fix a bug in channel_dump_statistics
We were calling channel_get_actual_remote_descr() before we used the
output of a previous channel_get_canonical_remote_descr(), thus
invalidating its output.
2012-10-17 11:29:59 -04:00
Nick Mathewson
cb9d123764 Document lifespan of return values of the _remote_descr() funcs 2012-10-17 11:29:37 -04:00
Nick Mathewson
26946c659b Restore the 'address' value of tunneled connections
When we merged the channel code, we made the 'address' field of linked
directory connections created with begindir (and their associated edge
connections) contain an address:port string, when they should only
have contained the address part.

This patch also tweaks the interface to the get_descr method of
channels so that it takes a set of flags rather than a single flag.
2012-10-17 11:23:26 -04:00
Nick Mathewson
898bd1ae8f Fix for bug 7112 (spewing complaints from tor_addr_is_internal)
In 4768c0efe3 (not in any released
version of Tor), we removed a little block of code that set the addr
field of an exit connection used in making a tunneled directory
request.  Turns out that wasn't right.
2012-10-17 11:15:01 -04:00
Nick Mathewson
f633184af1 Document return value of channel_get_addr_if_possible 2012-10-17 11:12:59 -04:00
Linus Nordberg
e2313d8622 White space. 2012-10-17 14:01:02 +02:00
Andrea Shepard
35f573136d Use LD_PROTOCOL rather than LD_BUG to warn about bogus reason codes that originated remotely in circuit_end_reason_to_control_string() 2012-10-17 03:24:28 -07:00
Andrea Shepard
17442560c4 Fix mal-merge, don't | END_CIRC_REASON_CHANNEL_CLOSED into reason codes in circuit_truncated() 2012-10-17 03:23:35 -07:00