Commit Graph

207 Commits

Author SHA1 Message Date
Nick Mathewson
dfc689bda2 r14652@tombo: nickm | 2007-11-02 12:02:13 -0400
If setting our rlimit to rlim_max or cap fails, fall back to OPEN_FILES if defiled.  This makes Tor run on OSX 10.5, while allowing OSX to mend its ways in the future.


svn:r12341
2007-11-02 16:02:26 +00:00
Nick Mathewson
e76581f97e r14647@tombo: nickm | 2007-11-02 10:48:37 -0400
Use rlim_t instead of unsigned long to manipulate rlimit values.


svn:r12339
2007-11-02 14:50:37 +00:00
Nick Mathewson
4750c46aea r16128@catbus: nickm | 2007-10-24 22:52:16 -0400
Fix windows mmap changes.


svn:r12171
2007-10-25 02:53:24 +00:00
Nick Mathewson
99d72f7295 r16100@catbus: nickm | 2007-10-24 11:33:52 -0400
Make tor_mmap_file() set and preserve errno in a useful way.


svn:r12153
2007-10-24 15:45:42 +00:00
Nick Mathewson
1f244d3943 r14639@catbus: nickm | 2007-08-17 17:45:28 -0400
Compile without warnings on MinGW, even with --enable-gcc-warnings enabled.


svn:r11157
2007-08-17 21:46:34 +00:00
Nick Mathewson
181ba71a90 r14051@Kushana: nickm | 2007-08-15 15:55:36 -0400
Fix an XXXX020 and a few DOCDOCs.


svn:r11127
2007-08-15 19:56:01 +00:00
Nick Mathewson
652d4e0248 r13926@Kushana: nickm | 2007-08-03 00:55:23 -0700
Fix compilation with HAVE_GETADDRINFO unset


svn:r11042
2007-08-03 07:57:31 +00:00
Nick Mathewson
23a345b3c2 r14015@catbus: nickm | 2007-07-30 13:18:05 -0400
Add missing code documentation in src/common


svn:r10991
2007-07-30 17:46:12 +00:00
Nick Mathewson
a5477c7bb9 r13944@catbus: nickm | 2007-07-27 15:52:35 -0400
Fix warnings on platforms where rlim values can be signed.
 Add an 8k buffer freelist.
 


svn:r10948
2007-07-27 19:53:29 +00:00
Nick Mathewson
8e50aa7341 r13856@catbus: nickm | 2007-07-20 14:30:44 -0400
slightly smarter heuristic about when to use obsolete ::a.b.c.d format.


svn:r10893
2007-07-20 18:30:47 +00:00
Nick Mathewson
8ba42a3bde r13850@catbus: nickm | 2007-07-20 12:25:24 -0400
Fix some bugs in ntop/pton.


svn:r10891
2007-07-20 16:25:27 +00:00
Nick Mathewson
6223160ab7 r13848@catbus: nickm | 2007-07-19 16:47:16 -0400
Use our own version of inet_ntop and inet_pton everywhere, to avoid partitioning attacks.


svn:r10888
2007-07-19 20:47:18 +00:00
Nick Mathewson
bbbf504281 r13827@catbus: nickm | 2007-07-19 14:42:25 -0400
Merge in some generic address manipulation code from croup.  Needs some work.


svn:r10880
2007-07-19 18:46:09 +00:00
Nick Mathewson
ad45ddfb07 r13788@catbus: nickm | 2007-07-16 14:26:25 -0400
Patch from croup: rewrite the logic of get_next_token() to do the right thing with input that ends at weird places, or aligns with block boundaries after mmap.  should fix bug 455.  Needs fuzzing.


svn:r10847
2007-07-16 18:26:31 +00:00
Nick Mathewson
73b4428a8b r13631@catbus: nickm | 2007-07-06 10:17:22 -0400
Try to fix win32 build again.


svn:r10750
2007-07-06 14:17:30 +00:00
Nick Mathewson
bbc7cf86d5 r13600@Kushana: nickm | 2007-07-05 23:49:47 -0400
try to fix mingw compile


svn:r10743
2007-07-06 03:49:57 +00:00
Nick Mathewson
a9469098ca r13596@kushana: nickm | 2007-07-05 10:53:22 -0400
Argh, re-enable CRITICAL_SECTION code in win32.


svn:r10741
2007-07-05 14:53:27 +00:00
Nick Mathewson
5c9c420111 svn:r10740 2007-07-05 14:51:10 +00:00
Nick Mathewson
1bdcfd9203 r13570@catbus: nickm | 2007-06-30 20:41:05 -0400
Implement conditions in compat.c; switch windows to use "critical sections" instead of mutexes.  Apparently, mutexes are for IPC and critical sections are for multithreaded.


svn:r10716
2007-07-01 16:22:45 +00:00
Roger Dingledine
b1ee20f0e8 trivial changes from my sandbox
svn:r10429
2007-05-31 23:57:46 +00:00
Nick Mathewson
534c55f531 r13111@catbus: nickm | 2007-05-31 15:03:41 -0400
Cleanup whitespace.


svn:r10425
2007-05-31 19:03:49 +00:00
Nick Mathewson
4061b2cbd1 r13101@catbus: nickm | 2007-05-31 12:57:42 -0400
Unit tests [and debugging] for tor_inet_ntop() and tor_inet_pton()


svn:r10420
2007-05-31 18:48:25 +00:00
Nick Mathewson
f89a3b1448 r13050@catbus: nickm | 2007-05-29 13:31:11 -0400
Resolve all but 3 DOCDOCs.


svn:r10393
2007-05-29 17:31:13 +00:00
Nick Mathewson
916e98d3fa r13042@catbus: nickm | 2007-05-29 10:41:10 -0400
oops; use tor_inet_aton rather than inet_aton in tor_inet_ntop.  Spotted by Li-Hui Zhou.


svn:r10389
2007-05-29 14:41:24 +00:00
Nick Mathewson
bb524e99c9 r12955@catbus: nickm | 2007-05-25 13:17:30 -0400
First bare stubs of ipv6 work: commit some (untested, hence doublessly broken) implementations of inet_ntop/pton for systems that lack them.


svn:r10326
2007-05-25 18:22:37 +00:00
Nick Mathewson
a7696a936d r12700@catbus: nickm | 2007-05-09 17:22:53 -0400
[Backport candidate] On windows, open cached-routers with the sharing mode "FILE_SHARE_READ so that other processes can read it while Tor is running. (Reported by Janbar). 


svn:r10148
2007-05-09 21:22:56 +00:00
Nick Mathewson
105d782109 r12546@catbus: nickm | 2007-04-29 21:27:43 -0400
Correctly report win98se and win95osr2 versions.


svn:r10047
2007-04-30 01:27:47 +00:00
Nick Mathewson
227b2e0226 r12759@Kushana: nickm | 2007-04-20 08:47:20 -0400
Track the number of connection_t separately from the number of open sockets.  It is already possible to have connections that do not count: resolving conns, for one.  Once we move from socketpairs to linked conns, and once we do dns proxying, there will be lots of such connections.


svn:r9994
2007-04-21 17:24:18 +00:00
Nick Mathewson
f8f5ea10de r12191@catbus: nickm | 2007-03-15 15:33:37 -0400
Check return values from pthread_mutex functions.


svn:r9862
2007-03-17 21:09:49 +00:00
Roger Dingledine
d374616301 clean up some minor typos and log confusions
svn:r9832
2007-03-15 22:47:21 +00:00
Nick Mathewson
f38240435a r12001@catbus: nickm | 2007-02-28 15:24:12 -0500
Try to build without warnings on mingw with verbose warnings on.  First attempt.


svn:r9688
2007-02-28 20:24:27 +00:00
Roger Dingledine
522a97098b more cleanups; getting closer
svn:r9655
2007-02-26 05:36:02 +00:00
Roger Dingledine
50f22e858a doc pedant
svn:r9634
2007-02-24 07:50:38 +00:00
Nick Mathewson
275ce1d2a4 r11852@catbus: nickm | 2007-02-20 17:25:17 -0500
Reverse arguments in memset() call in no-mmap version of tor_munmap_file().  Resolves bug 392.  Spotted by "fookoowa"--thanks!


svn:r9604
2007-02-20 22:25:20 +00:00
Nick Mathewson
b6e6b7101b r11850@catbus: nickm | 2007-02-20 13:34:13 -0500
Apply patch from coderman: have posix subthreads mask out signals.  This could prevent some kinds of crashes when subthreads try to handle SIGPIPEs and die in the attempt.  Backport candidate.


svn:r9603
2007-02-20 18:34:18 +00:00
Nick Mathewson
11e5656ab7 r11826@catbus: nickm | 2007-02-16 14:58:38 -0500
Resolve 56 DOCDOC comments.


svn:r9594
2007-02-16 20:01:02 +00:00
Nick Mathewson
d4aaffc6e7 r11824@catbus: nickm | 2007-02-16 13:16:47 -0500
Move all struct-offset-manipulation macros into util.h, and use them consistently.  Because there are days when "SUBTYPE_P(handle, subtype, _base)" is just easier to read and write than "(basetp*)(((handle) - STRUCT_OFFSET(subtype, _base))".


svn:r9592
2007-02-16 20:00:43 +00:00
Nick Mathewson
1c8a9d37b6 r11791@catbus: nickm | 2007-02-13 11:36:07 -0500
Try to fix mingw compile error reported by Li-Hui Zhou.


svn:r9578
2007-02-13 16:36:14 +00:00
Nick Mathewson
759c58151e r11775@catbus: nickm | 2007-02-12 16:39:09 -0500
Update copyright dates.


svn:r9570
2007-02-12 21:39:53 +00:00
Nick Mathewson
30e7c05075 r11774@catbus: nickm | 2007-02-12 16:31:47 -0500
Handle errors on opening cached-routers* more uniformly and sanely: log not-found errors at level INFO, and all other errors at level WARN.  Needs testing on win32.


svn:r9569
2007-02-12 21:39:44 +00:00
Nick Mathewson
fefba95363 r11629@catbus: nickm | 2007-02-02 15:06:17 -0500
Removing the last DOCDOC comment hurt so much that I had to use Doxygen to identify undocumented macros and comments, and add 150 more DOCDOCs to point out where they were.  Oops.  Hey, kids!  Fixing some of these could be your first Tor patch!


svn:r9477
2007-02-02 20:06:43 +00:00
Nick Mathewson
5cb99857bc r11620@catbus: nickm | 2007-02-01 13:06:27 -0500
Call stat() slightly less often; use fstat() when possible.


svn:r9472
2007-02-01 18:09:27 +00:00
Nick Mathewson
76f896e714 r11607@catbus: nickm | 2007-01-30 17:19:27 -0500
Audit non-const char arguments; make a lot more of them const.


svn:r9466
2007-01-30 22:19:41 +00:00
Roger Dingledine
8cf8b8087a when we decide not to mmap, because the file is empty or isn't
there at all, don't yell so loud.


svn:r9065
2006-12-11 04:21:10 +00:00
Nick Mathewson
e8dc71ade4 r11444@Kushana: nickm | 2006-12-07 09:38:52 -0500
Fix a couple of obvious bugs in tor_mmap_file on Windows: first, fix a boolean error when checking the return value of CreateFileMapping.  Second, CreateFileMapping is documented to return NULL on failure.


svn:r9035
2006-12-07 14:39:42 +00:00
Roger Dingledine
c5b90daf86 cleanups, bump to 0.1.2.4-alpha
svn:r9015
2006-12-02 22:47:46 +00:00
Nick Mathewson
facc49cf6f r9371@totoro: nickm | 2006-11-21 10:59:28 -0500
Fix a trivial comment.


svn:r8979
2006-11-21 23:50:21 +00:00
Nick Mathewson
9243e54177 r9313@totoro: nickm | 2006-11-13 20:07:41 -0500
Try to compile with fewer warnings on irix64's MIPSpro compiler /
 environment, which apparently believes that:
   - off_t can be bigger than size_t.
   - only mean kids assign things they do not subsequently inspect.
 
 I don't try to fix the "error" that makes it say:
 
 cc-3970 cc: WARNING File = main.c, Line = 1277
   conversion from pointer to same-sized integral type (potential portability
           problem)
 
     uintptr_t sig = (uintptr_t)arg;
 
 Because really, what can you do about a compiler that claims to be c99
 but doesn't understand that void* x = NULL; uintptr_t y = (uintptr_t) x;
 is safe?
 


svn:r8948
2006-11-14 01:07:52 +00:00
Roger Dingledine
3d6b97399f Avoid assert failure when our cached-routers file is empty on startup.
(reported by revstray)


svn:r8928
2006-11-12 07:09:22 +00:00
Roger Dingledine
0459db2c0d checkpoint some changes as i read diffs
svn:r8780
2006-10-20 19:11:12 +00:00
Nick Mathewson
7551c44a53 r9274@Kushana: nickm | 2006-10-19 16:16:58 -0400
Add unit tests for tor_mmap_file(); make tor_mmap_t.size always be the size of the file (not the size of the mapping); add an extra argument to read_file_to_str() so it can return the size of the result string.


svn:r8762
2006-10-19 23:05:02 +00:00
Nick Mathewson
7d366f61cb r9025@Kushana: nickm | 2006-09-29 18:33:13 -0400
Differentiate more duplicated log entries


svn:r8542
2006-09-29 22:33:40 +00:00
Nick Mathewson
95132f836a r8750@totoro: nickm | 2006-09-27 20:52:01 -0400
Fix some warnings on mingw; hopefully this should let us build on mingw without warnings.


svn:r8509
2006-09-28 00:53:02 +00:00
Nick Mathewson
93beeac01d Merge in some bsockets calls, all wrapped inside #if defined(USE_BSOCKETS)
svn:r8427
2006-09-19 20:41:31 +00:00
Peter Palfrader
28cac25d7e r9749@danube: weasel | 2006-09-14 06:53:12 +0200
Do not graciously increase the size to be mmaped if the current size already is
 at a page_size boundary.  This is important since if a file has a size of zero
 and we mmap() it with length > 0, then accessing the mmaped memory area causes
 a bus error.  However, if we pass a length of 0 to mmap() it will return with -1
 and things work from there.


svn:r8387
2006-09-14 04:53:42 +00:00
Nick Mathewson
365ccf0742 r8725@Kushana: nickm | 2006-09-06 04:39:29 -0400
spawn_func fixes: have cpuworker_main and dnsworker_main confirm to the right interfaces [casting func to void* is icky].  Also, make pthread_create() build without warnings.


svn:r8327
2006-09-06 08:42:20 +00:00
Nick Mathewson
000b7b287c r8724@Kushana: nickm | 2006-09-06 04:32:28 -0400
Fix spaces; restore support for mapping files over 4GB on win32 (?)


svn:r8326
2006-09-06 08:42:16 +00:00
Mike Chiussi
6ec9c1092a - made configure check if we are building for win32
- made configure link to required system dll's if building for win32
- added diffs for libevent 1.1b
- forced user to turn off eventdns if win32 is set 
- cleaned up tor_mmap_file()_win32 (not sure if it's stable)
- cleaned up some warnings and typos




svn:r8322
2006-09-06 01:49:55 +00:00
Roger Dingledine
9f5856c03d stop three memory leaks. nick, fix these if i'm wrong.
svn:r8235
2006-08-27 02:07:54 +00:00
Nick Mathewson
b050ecf86c r7404@Kushana: nickm | 2006-08-16 09:32:19 -0400
Pass hints to getaddrinfo; fix bug 280 (?)


svn:r7069
2006-08-16 18:47:19 +00:00
Nick Mathewson
1b7ad5aed3 r7030@Kushana: nickm | 2006-08-04 14:46:52 -0700
Close an fd leak on failed mmap()


svn:r6988
2006-08-05 17:53:32 +00:00
Nick Mathewson
7c596c166b r7029@Kushana: nickm | 2006-08-04 14:08:41 -0700
Remove now-spurious size and data arguments from tor_mmap_file


svn:r6987
2006-08-05 17:53:21 +00:00
Nick Mathewson
dbac3fb481 r7028@Kushana: nickm | 2006-08-04 13:10:16 -0700
Make data and size fields visible in tor_mmap_t; hide win magic differently.


svn:r6986
2006-08-05 17:53:08 +00:00
Nick Mathewson
db72fb9cdc r7025@Kushana: nickm | 2006-08-04 12:03:22 -0700
Finish (I hope) windows mmap impl.


svn:r6981
2006-08-04 19:03:40 +00:00
Nick Mathewson
bf72878cad r7012@Kushana: nickm | 2006-08-03 19:21:25 -0700
Add an "mmap handle" type to encapsulate bookkeeping elements of mmap issues; add prelim win32 impl


svn:r6980
2006-08-04 18:32:43 +00:00
Nick Mathewson
28a7c8a64c Make compilation work on old MSVCs without GetVertsionEx magic. Patch from Frediano Ziglio.
svn:r6749
2006-07-09 22:29:12 +00:00
Nick Mathewson
1cd04abf1a Actually enable mmap. That should improve matters.
svn:r6694
2006-06-28 08:54:32 +00:00
Roger Dingledine
45065f1466 simplify code now that libevent considers all sockets pollable.
what we really mean now is ">= 0", which is clearer to test for.


svn:r6543
2006-06-05 09:08:10 +00:00
Nick Mathewson
853e2d99b6 Add a new warning to our "warn a lot" list: unused parameters. This means we have to explicitly "use" unuseds, but it can catch bugs. (It caught two coding mistakes so far.)
svn:r6532
2006-06-04 22:42:13 +00:00
Nick Mathewson
c660a0f6a2 More DNS fixes. Send meaningful TTLs back to the client when
possible.  Cache at the server side independently from the TTL, to
prevent attackers from probing the server to see who has been asking
for what hostnames.  (Hi, Dan Kaminski!)

Also, clean some whitespace.


svn:r6526
2006-06-03 21:41:14 +00:00
Nick Mathewson
64d487a2d6 Add a basic mmap function, with a "fake-it" wrapper to do read_file_from_str instead. Based on code from Michael Mohr.
svn:r6510
2006-05-28 16:54:39 +00:00
Nick Mathewson
89a8411ace Throw out this UNALIGNED_INT_ACCESS_OK nonsense. Even where it works, it is often way way slower than doing the right thing. Backport candidate.
svn:r6473
2006-05-23 08:23:03 +00:00
Roger Dingledine
7871ad9116 failing in a support function is a warn, not an err.
svn:r6239
2006-03-26 06:47:08 +00:00
Nick Mathewson
6d9632ba23 Check return value from GetVersionEx (even though the MSDN example doesnt) and zero out the LPOSVERSIONINFOEX struct before getting the version. This may fix the "johnboy" [major=-858993460,minor=-858993460] problem.
svn:r6233
2006-03-24 05:26:33 +00:00
Roger Dingledine
6ce36ead42 Start the process of converting warn to log_warn and so on.
This is needed because Windows already has an err() that we
can't clobber. And we need to be able to make the log functions
a macro so we can print the function's name in the log entry.


svn:r6000
2006-02-13 08:01:59 +00:00
Roger Dingledine
5f051574d5 Happy new year!
svn:r5949
2006-02-09 05:46:49 +00:00
Roger Dingledine
28f3765b5a and maybe some function documentation will help too
svn:r5935
2006-02-09 02:59:37 +00:00
Roger Dingledine
f1864dfff3 On systems that don't have getrlimit (like windows), we were artificially
constraining ourselves to a max of 1024 connections. Now if there is no
getrlimit, just assume that we can handle the whole 15000 connections.

The better answer is to find a getrlimit equivalent on Windows, but hey,
one step at a time.


svn:r5854
2006-01-23 23:39:13 +00:00
Nick Mathewson
1af630d32c Bite the bullet and limit all our source lines to 80 characters, the way IBM intended.
svn:r5582
2005-12-14 20:40:40 +00:00
Roger Dingledine
9b0a40ec78 crank the max line limit down to 150 chars.
svn:r5550
2005-12-10 08:27:01 +00:00
Nick Mathewson
9b432311c4 Make new logging stuff work on windows; fix a couple of windows typos.
svn:r5375
2005-11-15 03:05:23 +00:00
Nick Mathewson
932106f54c Efficiency hack: call tor_fix_source_file late, not early. Add "BUG" domain. Domains are now bitmasks... just in case. Make some err msgs non-general.
svn:r5309
2005-10-25 07:05:03 +00:00
Nick Mathewson
a20835ac92 Check for even more windows version flags, and note any we do not recognize.
svn:r5297
2005-10-24 18:37:09 +00:00
Nick Mathewson
edf5698474 Start dividing log messages into logging domains. No, LD_ is not the best of identifiers. src/or has not been converted yet. Domains dont do anything yet.
svn:r5284
2005-10-18 21:58:19 +00:00
Nick Mathewson
010bcfa9df Win32 compilation/correctness fixes.
svn:r5218
2005-10-07 19:33:47 +00:00
Nick Mathewson
ba24193ab5 Make doxygen marginally happier
svn:r5208
2005-10-06 04:33:40 +00:00
Nick Mathewson
92abf1b653 Make windows platform detection smarter. {Untested.}
svn:r5198
2005-10-05 22:04:45 +00:00
Nick Mathewson
92451f74a8 Reformat inconsistent function declarations.
svn:r5160
2005-09-30 01:09:52 +00:00
Nick Mathewson
5c53545d81 Add a bunch more warnings to out warning suite; resolve them; pack structs a little better.
svn:r5150
2005-09-29 22:59:17 +00:00
Nick Mathewson
6973ef9be4 Add a touch_file() function to compat so we can update cache mtimes.
svn:r5067
2005-09-14 23:27:52 +00:00
Nick Mathewson
922cee3d0c Clean up a few warnings that make gcc twig out a bit.
svn:r5062
2005-09-14 20:59:25 +00:00
Roger Dingledine
fa507c63e8 put quotes around user-supplied strings so they are more likely to
realize if they add bad characters (like quotes) to the torrc


svn:r4844
2005-08-26 18:40:44 +00:00
Roger Dingledine
d5e426ab51 add a tor_dup_addr() function to simplify malloc()+tor_inet_ntoa()
svn:r4838
2005-08-26 07:37:07 +00:00
Nick Mathewson
9321db8c29 Fix bug with tor_memmem finding a match at the end of the string.
svn:r4803
2005-08-22 00:34:23 +00:00
Nick Mathewson
98f1265309 Fix compile failures on tor_gettimeofday() fix for windows
svn:r4685
2005-08-03 17:16:48 +00:00
Nick Mathewson
176e9055cc Probably broken attempt to improve tor_gettimeofday granularity on windows.
svn:r4683
2005-08-03 16:28:39 +00:00
Nick Mathewson
18c11eb3bc Be consistent about preferring foo* to struct foo*
svn:r4637
2005-07-22 21:12:10 +00:00
Nick Mathewson
97c58f066a whitespace fixes
svn:r4544
2005-07-13 17:24:55 +00:00
Nick Mathewson
278bac421f Fix windows compilation
svn:r4543
2005-07-13 15:24:33 +00:00
Nick Mathewson
d85bfe83bf Make errors retrievable from tor_socketpair; resolve bug 163.
svn:r4509
2005-06-30 07:17:38 +00:00