aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection_or.c
AgeCommit message (Collapse)Author
2017-06-27Merge branch 'maint-0.2.5' into maint-0.2.6Nick Mathewson
2017-06-27Merge branch 'maint-0.2.4' into maint-0.2.5Nick Mathewson
2017-06-27Fix an errant memset() into the middle of a struct in cell_pack().Nick Mathewson
This mistake causes two possible bugs. I believe they are both harmless IRL. BUG 1: memory stomping When we call the memset, we are overwriting two 0 bytes past the end of packed_cell_t.body. But I think that's harmless in practice, because the definition of packed_cell_t is: // ... typedef struct packed_cell_t { TOR_SIMPLEQ_ENTRY(packed_cell_t) next; char body[CELL_MAX_NETWORK_SIZE]; uint32_t inserted_time; } packed_cell_t; So we will overwrite either two bytes of inserted_time, or two bytes of padding, depending on how the platform handles alignment. If we're overwriting padding, that's safe. If we are overwriting the inserted_time field, that's also safe: In every case where we call cell_pack() from connection_or.c, we ignore the inserted_time field. When we call cell_pack() from relay.c, we don't set or use inserted_time until right after we have called cell_pack(). SO I believe we're safe in that case too. BUG 2: memory exposure The original reason for this memset was to avoid the possibility of accidentally leaking uninitialized ram to the network. Now remember, if wide_circ_ids is false on a connection, we shouldn't actually be sending more than 512 bytes of packed_cell_t.body, so these two bytes can only leak to the network if there is another bug somewhere else in the code that sends more data than is correct. Fortunately, in relay.c, where we allocate packed_cell_t in packed_cell_new() , we allocate it with tor_malloc_zero(), which clears the RAM, right before we call cell_pack. So those packed_cell_t.body bytes can't leak any information. That leaves the two calls to cell_pack() in connection_or.c, which use stack-alocated packed_cell_t instances. In or_handshake_state_record_cell(), we pass the cell's contents to crypto_digest_add_bytes(). When we do so, we get the number of bytes to pass using the same setting of wide_circ_ids as we passed to cell_pack(). So I believe that's safe. In connection_or_write_cell_to_buf(), we also use the same setting of wide_circ_ids in both calls. So I believe that's safe too. I introduced this bug with 1c0e87f6d8c7a0abdadf1b5cd9082c10abc7f4e2 back in 0.2.4.11-alpha; it is bug 22737 and CID 1401591
2015-03-10Add link protocol version counts to the heartbeat messageNick Mathewson
Closes ticket 15212
2015-01-02Bump copyright dates to 2015, in case someday this matters.Nick Mathewson
2014-12-21Merge branch 'ticket7356_squashed'Nick Mathewson
2014-12-21Using channel state lookup macros in connection_or.c.rl1987
2014-11-27Merge remote-tracking branch 'andrea/cmux_refactor_configurable_threshold'Nick Mathewson
Conflicts: src/or/or.h src/test/Makefile.nmake
2014-10-28Add another year to our copyright dates.Nick Mathewson
Because in 95 years, we or our successors will surely care about enforcing the BSD license terms on this code. Right?
2014-09-30Make connection_or_connect() mockableAndrea Shepard
2014-09-30Track total queue size per channel, with overhead estimates, and global ↵Andrea Shepard
queue total
2014-09-30Actually call channel_flush_some_cells() from the schedulerAndrea Shepard
2014-09-30Provide generic mechanism for scheduler to query writeable cells on a channelAndrea Shepard
2014-09-30Implement scheduler mechanism to track lists of channels wanting cells or ↵Andrea Shepard
writes; doesn't actually drive the cell flow from it yet
2014-09-09Merge branch 'bug12899_squashed'Nick Mathewson
2014-09-09Remove support for naming directory authoritiesSebastian Hahn
This implements the meat of #12899. This commit should simply remove the parts of Tor dirauths used to check whether a relay was supposed to be named or not, it doesn't yet convert to a new mechanism for reject/invalid/baddir/badexiting relays.
2014-09-05Correctly update channel local mark when address of incoming connection ↵Andrea Shepard
changes after handshake; fixes bug #12160
2014-06-11Merge remote-tracking branch 'public/ticket6799_024_v2_squashed'Nick Mathewson
Conflicts: src/or/channel.c src/or/circuitlist.c src/or/connection.c Conflicts involved removal of next_circ_id and addition of unusable-circid tracking.
2014-06-11Replace last_added_nonpadding with last_had_circuitsNick Mathewson
The point of the "idle timeout" for connections is to kill the connection a while after it has no more circuits. But using "last added a non-padding cell" as a proxy for that is wrong, since if the last circuit is closed from the other side of the connection, we will not have sent anything on that connection since well before the last circuit closed. This is part of fixing 6799. When applied to 0.2.5, it is also a fix for 12023.
2014-06-11Give each or_connection_t a slightly randomized idle_timeoutNick Mathewson
Instead of killing an or_connection_t that has had no circuits for the last 3 minutes, give every or_connection_t a randomized timeout, so that an observer can't so easily infer from the connection close time the time at which its last circuit closed. Also, increase the base timeout for canonical connections from 3 minutes to 15 minutes. Fix for ticket 6799.
2014-04-07For missing transport, say "PT_MISSING" not "NO_ROUTE"Nick Mathewson
2014-04-07Forward-port bug9665 fix to work with our fix for 11069Nick Mathewson
2014-04-07Fix bug9665Fábio J. Bertinatto
2014-03-25Fix warnings from doxygenNick Mathewson
Most of these are simple. The only nontrivial part is that our pattern for using ENUM_BF was confusing doxygen by making declarations that didn't look like declarations.
2014-03-18Take out remaining V1 directory code.Karsten Loesing
2014-03-10Throw control port warning if we failed to connect to all our bridges.George Kadianakis
2014-02-07Merge remote-tracking branch 'origin/maint-0.2.4'Nick Mathewson
2014-02-06NULL out conns on tlschans when freeing in case channel_run_cleanup() is ↵Andrea Shepard
late; fixes bug 9602
2013-09-24Merge remote-tracking branch 'origin/maint-0.2.4'Nick Mathewson
2013-09-24Always call circuit_n_chan_done(chan, 0) from channel_closed()Andrea Shepard
2013-09-21Merge remote-tracking branch 'origin/maint-0.2.4'Nick Mathewson
2013-09-21Relays should send timestamp in NETINFO.Nick Mathewson
This avoids skew warnings as authorities test reachability. Fix 9798; fix not on any released Tor.
2013-09-21Merge branch 'maint-0.2.4'Roger Dingledine
2013-09-21back out most of 1d0ba9aRoger Dingledine
this was causing directory authorities to send a time of 0 on all connections they generated themselves, which means everybody reachability test caused a time skew warning in the log for that relay. (i didn't just revert, because the changes file has been modified by other later commits.)
2013-09-20Merge remote-tracking branch 'origin/maint-0.2.4'Nick Mathewson
2013-09-20Remove the timestamp from AUTHENTICATE cells; replace with random bytesNick Mathewson
This isn't actually much of an issue, since only relays send AUTHENTICATE cells, but while we're removing timestamps, we might as well do this too. Part of proposal 222. I didn't take the approach in the proposal of using a time-based HMAC, since that was a bad-prng-mitigation hack from SSL3, and in real life, if you don't have a good RNG, you're hopeless as a Tor server.
2013-09-20Stop sending the current time in client NETINFO handshakes.Nick Mathewson
Implements part of proposal 222.
2013-08-25Merge remote-tracking branch 'origin/maint-0.2.4'Nick Mathewson
2013-08-22Separate mutable/const accessors for circuit_build_timesNick Mathewson
(These have proved invaluable for other global accessors.)
2013-08-22Make circ_times static and add accessor functions.vagrant
Change the global circ_times to a static variable and use accessor functions throughout the code, instead of accessing it directly.
2013-08-21Make bridges send AUTH_CHALLENGE cellsNick Mathewson
The spec requires them to do so, and not doing so creates a situation where they can't send-test because relays won't extend to them because of the other part of bug 9546. Fixes bug 9546; bugfix on 0.2.3.6-alpha.
2013-08-20Send NETINFO on receiving a NETINFO if we have not yet sent one.Nick Mathewson
Relays previously, when initiating a connection, would only send a NETINFO after sending an AUTHENTICATE. But bridges, when receiving a connection, would never send AUTH_CHALLENGE. So relays wouldn't AUTHENTICATE, and wouldn't NETINFO, and then bridges would be surprised to be receiving CREATE cells on a non-open circuit. Fixes bug 9546.
2013-08-15White-box tests for the succeeding case of ext_or_port handshake.Nick Mathewson
(Okay, white-box plus mocking enough other functions so they don't crash.)
2013-08-15Unit tests for ext_or_id_map.Nick Mathewson
2013-07-18Fix logging severities and remove some trivial XXXs.George Kadianakis
2013-07-18Move Extended ORPort code to its own module.George Kadianakis
Move the code from the connection_or module to ext_orport. This commit only moves code: it shouldn't modify anything.
2013-07-18Satisfy check-spaces.George Kadianakis
2013-07-18Various Extended ORPort code improvements.George Kadianakis
* Add documentation. * Free ext_or_auth_correct_client_hash. * Use VPORT(ExtORPort) instead of V(ExtORPOrt). See dfe03d36c8749eb07e9bb2ea47e88ff05e9e3127 for details.
2013-07-18Move USERADDR handling to a dedicated function.George Kadianakis
2013-07-18Implement Extended ORPort authentication.George Kadianakis