Commit Graph

226 Commits

Author SHA1 Message Date
Nick Mathewson
496e414e52 Basic RAM poisoning and magic-checking to notice connection and circuit
corruption faster; also, check for corruption in dns.c so we can fail fast
for the bug that's nailing Lucky and moria3.


svn:r1123
2004-02-25 07:31:46 +00:00
Nick Mathewson
67a273962a On OSX, decline to use the built-in select-baed poll wrapper, since it seems to sometimes not work.
svn:r1114
2004-02-20 23:41:45 +00:00
Roger Dingledine
67c0c64aa4 go back to a single exitpolicy parameter
if your exitpolicy includes " *:*" then it is final,
else we append the default exit policy.
(thanks weasel)


svn:r1105
2004-02-18 07:23:38 +00:00
Roger Dingledine
7562a62ef0 Get rid of the notion of a separate default default exit policy.
Create ExitPolicyPrepend config parameter, to customize the default
exit policy.


svn:r1103
2004-02-18 03:56:12 +00:00
Roger Dingledine
3456adec31 adding the reattach-after-timeout feature wasn't so easy after all.
maybe it works now.


svn:r1101
2004-02-18 01:21:20 +00:00
Nick Mathewson
61756b5893 Fix router_compare_addr_to_exit_policy, and name its return codes. The bug was: "maybe reject,accept" should be "maybe", not "accept".
svn:r1093
2004-02-17 07:56:33 +00:00
Roger Dingledine
3516ae1a26 add an ap_conn connecting state; report connecting delay
svn:r1011
2004-01-20 09:21:46 +00:00
Roger Dingledine
585c2efe87 add TOR_PERF macro options
svn:r1008
2004-01-20 02:14:30 +00:00
Roger Dingledine
5086300815 split the token bucket into 'rate' and 'burst' params
we're not entirely migrated to burst yet, for backward compatibility

note some win32 probable-bugs

clean up routerlist.c


svn:r982
2004-01-10 23:40:38 +00:00
Roger Dingledine
c485725c5a Fix the dns bug: children weren't dying
We were telling a child to die by closing the parent's file descriptor
to him. But newer children were inheriting the open file descriptor from
the parent, and since they weren't closing them, the socket never closed,
so the child never read eof, so he never knew to exit.

As a side effect to this bug, we were probably failing to properly close
connections to remote hosts, ORs, and OPs, after a dns child was born.

I'm surprised Tor worked at all.


svn:r974
2004-01-06 07:53:40 +00:00
Roger Dingledine
d6ce65afd6 the onionskin challenge length was 30 bytes longer than necessary
(i think ;)


svn:r971
2004-01-05 05:23:03 +00:00
Roger Dingledine
53061b3778 fix endian issue: rh.integrity was getting sent wrong
now it's a char[4] rather than an int


svn:r966
2004-01-02 09:03:38 +00:00
Roger Dingledine
43fcb70bad checkpoint: revamp relay cell packaging and handling
include the infrastructure for inserting padding cells when there's
a relay-recognized conflict, but it does not work currently.


svn:r958
2003-12-23 07:45:31 +00:00
Roger Dingledine
ad93c0a2bd make sure there's no conflict when generating stream_ids
svn:r955
2003-12-19 21:25:44 +00:00
Roger Dingledine
a5e6ec244f rename circ_id_t to uint16_t for code clarity
change message when using non-recommended tor version


svn:r954
2003-12-19 19:55:02 +00:00
Roger Dingledine
45a66c6955 make a relay_header_t struct and pack/unpack funcs
split 7-byte stream_id string into 2-byte recognized and 2-byte stream_id
fix two seg faults in fetch_from_buf_http
fix several lurking seg faults in handling unexpected relay cells

still need to
 * clean up relay_crypt
 * use relay dummies if there's going to be a conflict with rh.recognized
 * check for a conflict when generating stream_ids


svn:r953
2003-12-19 05:09:51 +00:00
Roger Dingledine
6a19e64066 remove trailing whitespace
svn:r951
2003-12-17 21:09:31 +00:00
Roger Dingledine
5ecd6b6bad make fetch_from_buf_http malloc its strings rather
than use fixed-size strings

reorganize directory_handle_command so it'll be easier to do more with
our directory servers


svn:r950
2003-12-17 09:42:28 +00:00
Roger Dingledine
21cc01299b infrastructure for integrity-checks in relay cells
make circuit_consider_sending_sendme use connection_edge_send_command
fix endian bug in relay length handling (maybe)


svn:r946
2003-12-16 22:56:50 +00:00
Roger Dingledine
8712a30e91 move cell size to 512 bytes
move length to 2 bytes, put it in the relay header
remove 4 reserved bytes in cell
add 4 bytes to relay header for the integrity check


svn:r942
2003-12-16 09:48:17 +00:00
Roger Dingledine
961ecf7abf add H(K|1) to the onionskin reply
verify it at the client end
abstract the onionskin handshake lengths

breaks backward compatibility (again)


svn:r941
2003-12-16 08:21:58 +00:00
Roger Dingledine
08534a6271 start tracking the 'It appears I've already sent the end' warning
svn:r932
2003-12-14 08:32:14 +00:00
Roger Dingledine
7d58bfbd50 change dns notation from question/answer to address/addr
svn:r929
2003-12-14 07:40:47 +00:00
Roger Dingledine
1096eae543 add options.ExcludedNodes -- nodes that are never picked in path building
svn:r924
2003-12-14 05:08:28 +00:00
Roger Dingledine
9e6f4a3029 revamp circuit node selection to use smartlists:
* now we know for sure if an acceptable node is available; we
    don't have to keep guessing and checking
  * we try options.EntryNodes first for picking the first node


svn:r904
2003-12-13 07:01:46 +00:00
Nick Mathewson
f37f7daa2f Add port ranges to exit policies
svn:r899
2003-12-13 02:44:02 +00:00
Roger Dingledine
9c66e2bf9a if >=2 circs are being built that handle a given stream,
no need to have new circs handle it too.


svn:r896
2003-12-12 23:03:25 +00:00
Nick Mathewson
ac552573dd Make router/directory parsing nondestructive and more const-friendly
svn:r890
2003-12-08 23:45:37 +00:00
Roger Dingledine
6a968495b1 declare the prototypes better
svn:r888
2003-12-06 06:01:42 +00:00
Roger Dingledine
c25fbd2676 break routers.c into router.c for stuff the router does,
and routerlist.c for handling routerlist.


svn:r887
2003-12-06 05:54:04 +00:00
Roger Dingledine
e0952d0773 terminology shift:
directory is the string that dirserv.c and directory.c deal with
routerlist is routerinfo's that are bundled together in routers.c

rename some of the get_routerlist functions to set_routerlist

preparing to break into router.c for stuff the router does,
and routerlist.c for handling routerlist.


svn:r886
2003-12-05 09:51:49 +00:00
Roger Dingledine
63f81bddae pick nodes for a circuit only from those the directory says are up
svn:r880
2003-12-03 10:28:51 +00:00
Roger Dingledine
f65e871bfd bugfix in exit node choice: we used to find the perfect exit node but then use the wrong one.
bugfix in connection_ap_can_use_exit: it was using the wrong port
bugfix: the OP now handles a port of '*' correctly when the IP is not
  yet known and it's trying to guess whether a router's exit policy
  might accept it.
we now don't ever pick exit routers which will reject *:*
attach_circuit now fails a new stream outright if it will never work.
when you get an 'end' cell that resolves an IP, now it will fail the                             circuit outright if no safe exit nodes exist for that IP.
don't try building a new circuit after an 'end' if a suitable one is
  already on the way.


svn:r874
2003-12-03 08:06:55 +00:00
Roger Dingledine
975bb68010 simplify: options.OnionRouter==1 iff options.ORPort>0
svn:r857
2003-11-20 17:49:45 +00:00
Nick Mathewson
fd07872a72 Separate failure-count tracking from circuit-launching.
Increment failure counts only when circuits close without having been built.
Reset failure counts only on the second, and when circuits are done building.


svn:r847
2003-11-19 02:22:52 +00:00
Roger Dingledine
f0cccc567e bugfix: don't ask for ->next of an expired circuit
bugfix: keep going when a circ fails in circuit_n_conn_open
        (make circuit_enumerate_by_naddr_nport obsolete)
bugfix: make circuit_n_conn_open only look at circ's that start at us
bugfix: only try circuit_n_conn_open if we're an OP. Otherwise we
        expect connections to always already be up.
bugfix: when choosing path length, pay attention to whether the directory
        says a router is down.
bugfix: when picking good exit, skip routers which are known to be down
        (more work needs to be done on this one)


svn:r838
2003-11-18 09:53:03 +00:00
Roger Dingledine
a3e39b0ceb don't build too many circs at once
expire circs that have been building for too long


svn:r835
2003-11-18 07:48:00 +00:00
Roger Dingledine
4aede010b9 recognize in-progress circs and don't start redundant ones
quickly notice streams that don't have a circ on the way, and start one


svn:r819
2003-11-17 00:57:56 +00:00
Roger Dingledine
5e81e4748e bugfixes
svn:r818
2003-11-16 23:43:08 +00:00
Roger Dingledine
6d0e611fde change when circuits are built and expired
not quite happy with it yet


svn:r817
2003-11-16 21:49:52 +00:00
Roger Dingledine
fe856406be initial patches on patches
svn:r814
2003-11-16 17:00:02 +00:00
Nick Mathewson
8a17d9e5d3 Finish implementing the rest of the exitpolicy stuff, except for automatically starting circuit builds.
svn:r813
2003-11-16 05:33:45 +00:00
Nick Mathewson
a8eaa79e03 Improved exit policy syntax; basic client-side DNS caching.
- Exit policies now support bitmasks (18.0.0.0/255.0.0.0) and bitcounts
  18.0.0.0/8.  Policies are parsed on startup, not when comparing to them.

- desired_path_len is now part of an opaque cpath_build_state_t structure.

- END_REASON_EXITPOLICY cells no longer include a port.

- RELAY_COMMAND_CONNECTED cells now include the IP address we've connected
  to.

- connection_edge now has a client_dns cache to remember resolved addresses.
  It gets populated by RELAY_COMMAND_CONNECTED cells and END_REASON_EXITPOLICY
  cells.  It gets used by connection_ap_handshake_send_begin.  We don't
  compare it to exit policies yet.


svn:r812
2003-11-14 20:45:47 +00:00
Roger Dingledine
c8639b2bbc bump default pathlen to 3; clean up surrounding code
svn:r810
2003-11-13 23:01:56 +00:00
Roger Dingledine
56cd147eb9 let getconfig survive repeated calls. now we call it again when we hup.
change RecommendedVersions into a config option, so dirservers can hup
  for a new one


svn:r809
2003-11-13 06:49:25 +00:00
Roger Dingledine
f5829aa723 lay groundwork for EntryNodes and ExitNodes
svn:r805
2003-11-12 19:34:34 +00:00
Nick Mathewson
2e05b9ccf9 Remove dead code
svn:r794
2003-11-12 02:58:45 +00:00
Nick Mathewson
7d441ec6b4 Compute paths as we build them.
svn:r793
2003-11-12 02:55:38 +00:00
Nick Mathewson
e6296a4e2f Refactor onion_generate_cpath to build cpaths one hop at a time. This
is a the first step in computing hops one step at a time.  Next, we move
the responsibility for calling onion_extend_cpath into circuit.c

(Later, we may want to special-case onion_extend_cpath to treat entry
and exit routers differently.)


svn:r792
2003-11-12 02:32:20 +00:00
Roger Dingledine
84884a79c0 conn->socks_version is obsolete
svn:r787
2003-11-11 04:13:37 +00:00