Bugfix on r17756:
Avoid trying to print raw memory to the logs when we decide to
give up on downloading a given relay descriptor. Bugfix on
0.2.1.9-alpha.
We were already rejecting relay begin cells with destination port
of 0. Now also reject extend cells with destination port or address
of 0. Suggested by lark.
Nick Mathewson [Tue, 3 Mar 2009 18:02:31 +0000 (18:02 +0000)]
Add a simple locale-independent no-surprises sscanf replacement.
tor_sscanf() only handles %u and %s for now, which will make it
adequate to replace sscanf() for date/time/IP parsing. We want this
to prevent attackers from constructing weirdly formed descriptors,
cells, addresses, HTTP responses, etc, that validate under some
locales but not others.
Nick Mathewson [Mon, 2 Mar 2009 19:15:05 +0000 (19:15 +0000)]
Add and use set/get_uint64 on onion tags. [bug 604; backportable]
It seems that 64-bit Sparc Solaris demands 64-bit-aligned access to
uint64_t, but does not 64-bit-align the stack-allocated char array we
use for cpuworker tags. So this patch adds a set/get_uint64 pair, and
uses them to access the conn_id field in the tag.
Nick Mathewson [Sat, 21 Feb 2009 19:07:05 +0000 (19:07 +0000)]
Patch from lark: if we get two extend cells for the same circuit id, drop the second. Previously, we had leaked an extend_info if the target connection was not open when the second arrived.
Nick Mathewson [Mon, 16 Feb 2009 15:15:06 +0000 (15:15 +0000)]
Possible fix for broken country settings in ExcludeExitNodes.
It turns out that we weren't updating the _ExcludeExitNodesUnion set's
country numbers when we reloaded (or first loaded!) the IP-to-country
file. Spotted by Lark. Bugfix on 0.2.1.6-alpha.
Roger Dingledine [Fri, 13 Feb 2009 04:11:14 +0000 (04:11 +0000)]
If the controller claimed responsibility for a stream, but that
stream never finished making its connection, it would live
forever in circuit_wait state. Now we close it after SocksTimeout
seconds. Bugfix on 0.1.2.7-alpha; reported by Mike Perry.
Nick Mathewson [Wed, 11 Feb 2009 17:22:34 +0000 (17:22 +0000)]
I worry that the CLEAR() macro in eventdns.c is hiding bugs. That is sad, because it was meant to make them more detectable. Change it to change stuff to garbage rather than to 0. If no bugs turn up, we can remove it in 0.2.2.x
Nick Mathewson [Mon, 9 Feb 2009 16:55:48 +0000 (16:55 +0000)]
Retry circuits if the exit node is optional and nonexistant.
Previously, when we had the chosen_exit set but marked optional, and
we failed because we couldn't find an onion key for it, we'd just give
up on the circuit. But what we really want to do is try again, without
the forced exit node.
Spotted by rovv. Another case of bug 752. I think this might be
unreachable in our current code, but proposal 158 could change that.
Peter Palfrader [Wed, 4 Feb 2009 23:42:39 +0000 (23:42 +0000)]
patches/06_add_compile_time_defaults: Only set the User option in the config if
we run as root. Do not set it when run as debian-tor as Tor then always
insists on changing users which will fail. (If we run as any other user we
don't set our debian defaults anyway.)
If we're using bridges and our network goes away, be more willing
to forgive our bridges and try again when we get an application
request. Bugfix on 0.2.0.x.
make a note about a clause in connection_edge.c that is probably
redundant, and is definitely confusing. we should take it out
in 0.2.2.x and see who squeaks.
Nick Mathewson [Sat, 31 Jan 2009 07:51:02 +0000 (07:51 +0000)]
When building with GCC, use -fno-strict-aliasing
GCC's interpretation of the C99 aliasing rules, to be charitable,
creates a dialect of C intended for a better programmers than I am
certain of my ability to be in all times. I just spent 2 hours
tracking down a platform-hyperspecific libevent bug that turned out to
be because of this, and darned if I ever want to do *that* again.
One of Linus's recent rants will give you a picture of why GCC's
behavior here can lead to fun surprises in your binaries:
http://lwn.net/Articles/316126/
Roger Dingledine [Fri, 30 Jan 2009 19:37:59 +0000 (19:37 +0000)]
give torrc.sample its yearly overhaul. the main change is to
merge the 'bridge relay' section into the 'main relay'
section, so people stop getting confused about whether they
should fill out both sections (they shouldn't).
Nick Mathewson [Wed, 28 Jan 2009 18:26:20 +0000 (18:26 +0000)]
Fix a race condition on nameserver reconfiguration.
This resolves bug 526, wherein we would crash if the following
events occurred in this order:
A: We're an OR, and one of our nameservers goes down.
B: We launch a probe to it to see if it's up again. (We do this hourly
in steady-state.)
C: Before the probe finishes, we reconfigure our nameservers,
usually because we got a SIGHUP and the resolve.conf file changed.
D: The probe reply comes back, or times out. (There is a five-second
window for this, after B has happens).
IOW, if one of our nameservers is down and our nameserver
configuration has changed, there were 5 seconds per hour where HUPing
the server was unsafe.
Nick Mathewson [Wed, 28 Jan 2009 17:36:41 +0000 (17:36 +0000)]
Don't obsolete a very-new connection for having no circuits yet.
This fixes the last known case of bug 891, which could happen if two
hosts, A and B, disagree about how long a circuit has been open,
because of clock drift of some kind. Host A would then mark the
connection as is_bad_for_new_circs when it got too old and open a new
connection. In between when B receives a NETINFO cell on the new
conn, and when B receives a conn cell on the new circuit, the new
circuit will seem worse to B than the old one, and so B will mark it
as is_bad_for_new_circs in the second or third loop of
connection_or_group_set_badness().
Bugfix on 0.1.1.13-alpha. Bug found by rovv.
Not a backport candidate: the bug is too obscure and the fix too tricky.
Nick Mathewson [Wed, 28 Jan 2009 16:06:46 +0000 (16:06 +0000)]
Actually send the extra_headers content in write_http_response_header_impl. This make X-Descriptor-Now-New get sent. Bugfix on 0.2.0.10-alpha. Spotted by "multiplication".