summaryrefslogtreecommitdiff
path: root/src/or/relay.c
AgeCommit message (Collapse)Author
2011-01-15Merge branch 'maint-0.2.2'Roger Dingledine
2011-01-15Sanity-check consensus param valuesSebastian Hahn
We need to make sure that the worst thing that a weird consensus param can do to us is to break our Tor (and only if the other Tors are reliably broken in the same way) so that the majority of directory authorities can't pull any attacks that are worse than the DoS that they can trigger by simply shutting down. One of these worse things was the cbtnummodes parameter, which could lead to heap corruption on some systems if the value was sufficiently large. This commit fixes this particular issue and also introduces sanity checking for all consensus parameters.
2011-01-03Merge remote branch 'origin/maint-0.2.2'Nick Mathewson
2011-01-03Merge remote branch 'origin/maint-0.2.1' into maint-0.2.2Nick Mathewson
Conflicts: src/common/test.h src/or/test.c
2011-01-03Bump copyright statements to 2011Nick Mathewson
2010-12-19Merge branch 'maint-0.2.2'Roger Dingledine
2010-12-15Merge remote branch fix_security_bug_021 into fix_security_bug_022Nick Mathewson
Conflicts: src/common/memarea.c src/or/or.h src/or/rendclient.c
2010-12-15Make payloads into uint8_t.Nick Mathewson
This will avoid some signed/unsigned assignment-related bugs.
2010-11-30Merge remote branch 'origin/maint-0.2.2'Nick Mathewson
Conflicts: src/or/relay.c
2010-11-29Revise comment on 2210 a little; clean up n_streams/num_streams confusionNick Mathewson
Also add a changes file
2010-11-29Add wrappers function for libc random()Nick Mathewson
On windows, it's called something different.
2010-11-29Fix whitespace in patch for 2210 and backport to 0.2.2Nick Mathewson
2010-11-29Improve fairness when activating streams in circuit_resume_edge_reading_helperMashael AlSabah
The reason the "streams problem" occurs is due to the complicated interaction between Tor's congestion control and libevent. At some point during the experiment, the circuit window is exhausted, which blocks all edge streams. When a circuit level sendme is received at Exit, it resumes edge reading by looping over linked list of edge streams, and calling connection_start_reading() to inform libevent to resume reading. When the streams are activated again, Tor gets the chance to service the first three streams activated before the circuit window is exhausted again, which causes all streams to be blocked again. As an experiment, we reversed the order in which the streams are activated, and indeed the first three streams, rather than the last three, got service, while the others starved. Our solution is to change the order in which streams are activated. We choose a random edge connection from the linked list, and then we activate streams starting from that chosen stream. When we reach the end of the list, then we continue from the head of the list until our chosen stream (treating the linked list as a circular linked list). It would probably be better to actually remember which streams have received service recently, but this way is simple and effective.
2010-10-21Merge remote branch 'origin/maint-0.2.2'Nick Mathewson
2010-10-18Send relay_early cells in rend circsSebastian Hahn
There are no relay left that run version 0.2.1.3 through 0.2.1.18, so changing this behaviour should be safe now.
2010-10-15Merge branch 'bug1992_part1'Nick Mathewson
2010-10-13Fix a couple users of buf_datalen that slipped in. Found by SebastianNick Mathewson
2010-10-01refactor all these tor_inet_ntoa idiomsRoger Dingledine
but don't refactor the ones that look messy
2010-10-01Initial conversion to use node_t throughout our codebase.Nick Mathewson
A node_t is an abstraction over routerstatus_t, routerinfo_t, and microdesc_t. It should try to present a consistent interface to all of them. There should be a node_t for a server whenever there is * A routerinfo_t for it in the routerlist * A routerstatus_t in the current_consensus. (note that a microdesc_t alone isn't enough to make a node_t exist, since microdescriptors aren't usable on their own.) There are three ways to get a node_t right now: looking it up by ID, looking it up by nickname, and iterating over the whole list of microdescriptors. All (or nearly all) functions that are supposed to return "a router" -- especially those used in building connections and circuits -- should return a node_t, not a routerinfo_t or a routerstatus_t. A node_t should hold all the *mutable* flags about a node. This patch moves the is_foo flags from routerinfo_t into node_t. The flags in routerstatus_t remain, but they get set from the consensus and should not change. Some other highlights of this patch are: * Looking up routerinfo and routerstatus by nickname is now unified and based on the "look up a node by nickname" function. This tries to look only at the values from current consensus, and not get confused by the routerinfo_t->is_named flag, which could get set for other weird reasons. This changes the behavior of how authorities (when acting as clients) deal with nodes that have been listed by nickname. * I tried not to artificially increase the size of the diff here by moving functions around. As a result, some functions that now operate on nodes are now in the wrong file -- they should get moved to nodelist.c once this refactoring settles down. This moving should happen as part of a patch that moves functions AND NOTHING ELSE. * Some old code is now left around inside #if 0/1 blocks, and should get removed once I've verified that I don't want it sitting around to see how we used to do things. There are still some unimplemented functions: these are flagged with "UNIMPLEMENTED_NODELIST()." I'll work on filling in the implementation here, piece by piece. I wish this patch could have been smaller, but there did not seem to be any piece of it that was independent from the rest. Moving flags forces many functions that once returned routerinfo_t * to return node_t *, which forces their friends to change, and so on.
2010-10-01Try to make most routerinfo_t interfaces constNick Mathewson
2010-09-27Make a function to mark a connection and set hold_open_until_flushed.Nick Mathewson
2010-09-27Refactor users of buf_datalen to bufferevent-friendly version.Nick Mathewson
2010-09-27Teach read_event/write_event manipulators about bufferevents.Nick Mathewson
Add an --enable-bufferevents config switch.
2010-09-16I hear we are close to a release. Clean up the whitespace.Nick Mathewson
2010-09-16Demote a warn when enabling CellStatisticsSebastian Hahn
When the CellStatistics option is off, we don't store cell insertion times. Doing so would also not be very smart, because there seem to still be some performance issues with this type of statistics. Nothing harmful happens when we don't have insertion times, so we don't need to alarm the user.
2010-09-15Merge branch 'bug1184'Nick Mathewson
2010-09-15Never queue a cell on a marked circuitNick Mathewson
2010-09-14Add a simple integer-ceiling-division macro before we get it wrongNick Mathewson
2010-09-13Make circuit_resume_edge_reading_helper treat streams more fairly.Nick Mathewson
Previously[*], the function would start with the first stream on the circuit, and let it package as many cells as it wanted before proceeding to the next stream in turn. If a circuit had many live streams that all wanted to package data, the oldest would get preference, and the newest would get ignored. Now, we figure out how many cells we're willing to send per stream, and try to allocate them fairly. Roger diagnosed this in the comments for bug 1298. [*] This bug has existed since before the first-ever public release of Tor. It was added by r152 of Tor on 26 Jan 2003, which was the first commit to implement streams (then called "topics"). This is not the oldest bug to be fixed in 0.2.2.x: that honor goes to the windowing bug in r54, which got fixed in e50b7768 by Roger with diagnosis by Karsten. This is, however, the most long-lived bug to be fixed in 0.2.2.x: the r54 bug was fixed 2580 days after it was introduced, whereas I am writing this commit message 2787 days after r152.
2010-09-13Add a max_cells arg to connection_edge_process_raw_inbufNick Mathewson
I'm going to use this to implement more fairness in circuit_resume_edge_reading_helper in an attempt to fix bug 1298. (Updated with fixes from arma and Sebastian)
2010-09-13Fix function declaration linebreaks at start of relay.cNick Mathewson
2010-09-08be more consistent in using streamid_tNick Mathewson
2010-09-03Fix a missing stream_id argument; found by "tracktor"Nick Mathewson
2010-09-02Fix behavior of adding a cell to a blocked queue.Nick Mathewson
We frequently add cells to stream-blocked queues for valid reasons that don't mean we need to block streams. The most obvious reason is if the cell arrives over a circuit rather than from an edge: we don't block circuits, no matter how full queues get. The next most obvious reason is that we allow CONNECTED cells from a newly created stream to get delivered just fine. This patch changes the behavior so that we only iterate over the streams on a circuit when the cell in question came from a stream, and we only block the stream that generated the cell, so that other streams can still get their CONNECTEDs in.
2010-08-18Detect if we try to put a cell onto a supposedly blocked cell queue.Nick Mathewson
When this happens, run through the streams on the circuit and make sure they're all blocked. If some aren't, that's a bug: block them all and log it! If they all are, where did the cell come from? Log it! (I suspect that this actually happens pretty frequently, so I'm making these log messages appear at INFO.)
2010-08-18Decide whether to ignore SENDMEs based on streams_blocked, not queue sizeNick Mathewson
2010-08-18Avoid over-filling cell queues when we receive a SENDMEyetonetime
Do not start reading on exit streams when we get a SENDME unless we have space in the appropriate circuit's cell queue. Draft fix for bug 1653. (commit message by nickm)
2010-08-18Backport END_STREAM_REASON_NOROUTE for client use.Sebastian Hahn
(Partial backport of 150ed553dfce9, 161b275028e90, and 4c948ffd6.)
2010-08-16161b2750 didn't really retry the stream. this does.Roger Dingledine
2010-08-15Merge commit 'sebastian/bug1831'Nick Mathewson
2010-08-15Merge commit 'sebastian/misc-reason'Nick Mathewson
2010-08-16Fix misplaced labelsSebastian Hahn
2010-08-04Retry streams that ended with NOROUTE errorSebastian Hahn
Also add the NOROUTE reason to control-spec.
2010-07-30Clear cell queues when marking or truncating a circuit.Nick Mathewson
At best, this patch helps us avoid sending queued relayed cells that would get ignored during the time between when a destroy cell is sent and when the circuit is finally freed. At worst, it lets us release some memory a little earlier than it would otherwise. Fix for bug #1184. Bugfix on 0.2.0.1-alpha.
2010-07-27Create routerparse.hSebastian Hahn
2010-07-27Create relay.hSebastian Hahn
2010-07-27Create reasons.hSebastian Hahn
2010-07-27Create policies.hSebastian Hahn
2010-07-27Create networkstatus.hSebastian Hahn
2010-07-27Create main.hSebastian Hahn