110 Commits

Author SHA1 Message Date
Nick Mathewson
621aafd27a Export sockaddr comparison functionality.
svn:r1400
2009-07-30 22:11:23 +00:00
Nick Mathewson
7c20a6ae52 Export an ev_socklen_t.
svn:r1391
2009-07-30 17:01:21 +00:00
Nick Mathewson
72ea534f8e Export evutil_str[n]casecmp as evutil_ascii_str[n]casecmp.
svn:r1387
2009-07-28 19:41:57 +00:00
Nick Mathewson
5b5b880be7 Various MSVC cleanups from Brodie Thiesfield.
svn:r1385
2009-07-28 19:41:39 +00:00
Nick Mathewson
12199fa7a5 Fix segfault during failed allocatino of locked evdns base.
We need to comb the rest of the code to make sure that we don't blindly wrap
functions in LOCK(x), UNLOCK(x) when those functions might contain a FREE(x)
in the middle.

Rocco Carbone found and reported this bug.

svn:r1384
2009-07-28 17:11:03 +00:00
Nick Mathewson
b06b2649b4 Make "deferred callback queue" independent of event_base.
This way, we can more easily have an IOCP bufferevent implementation
that does not need an event_base at all.  Woot.

svn:r1381
2009-07-26 01:29:39 +00:00
Nick Mathewson
670658ebd7 Correct the signatures for evdns_configure_windows_nameservers(), now that it is exposed.
svn:r1369
2009-07-21 18:32:57 +00:00
Nick Mathewson
e83a32dfe1 Do not define _FORTIFY_SOURCE if the platform GCC already defined it for us.
svn:r1346
2009-07-14 19:31:20 +00:00
Nick Mathewson
342ad3550b The truncated bit is in the 3rd byte of a dns reply, not the 4th. [fwd-port]
svn:r1332
2009-06-30 14:23:18 +00:00
Nick Mathewson
f901f9867c When our IP address changes, do not break all existing dns server sockets. Patch from Christopher Davis
svn:r1329
2009-06-24 22:40:15 +00:00
Nick Mathewson
7289d7f800 Fix a potentially very annoying evdns bug that we found in Tor.
Generally speaking, it way better to event_assign() an event when you
allocate it than to assign it before every time you event_add it: if
it is already event_add()ed, the assign will mess it up so that it
doesn't _look_ added, and event_add() will insert a second copy.
Later, event_del() will only delete the second copy.  Eventually, the
event_base will have a dangling pointer to freed memory.  Ouch!

svn:r1307
2009-05-22 18:20:59 +00:00
Nick Mathewson
f11dff2c7a Add and use locale-independent strcasecmp functions.
svn:r1280
2009-05-07 03:45:51 +00:00
Nick Mathewson
7b24d72ad6 Remove some duplicated includes in evdns.c
svn:r1265
2009-05-02 16:22:55 +00:00
Nick Mathewson
e865eb938c More msvc build tweaks.
svn:r1262
2009-05-01 00:54:14 +00:00
Nick Mathewson
1ad0326440 Fix win32 compilation issues.
svn:r1234
2009-04-23 18:04:50 +00:00
Nick Mathewson
9516df0e2e Fix c89 bugs reported by Cory Stup.
Others may remain.  I wasn't able to get gcc --std=c89 to build libevent
at all, so I don't know what compiler the original reporter is using here.

Note that this change requires us to disable the part of our rpc code
that uses variadic macros when using a non-gcc compiler.  This is a
problem if we want our rpc api to be portable.

svn:r1231
2009-04-23 05:40:06 +00:00
Nick Mathewson
2d9619d78f Make dns callbacks run deferred
svn:r1205
2009-04-19 01:59:09 +00:00
Nick Mathewson
327165b339 Add locks to evdns.
svn:r1204
2009-04-19 01:58:54 +00:00
Nick Mathewson
ac3fc9913a Use new-style headers in evdns.c
svn:r1203
2009-04-19 01:58:41 +00:00
Nick Mathewson
684c022a21 Avoid a double event_del() in evdns.c.
The bug could occur when a nameserver was marked as up, but then an
outstanding probe sent to the nameserver failed.  Now, evdns_up() cancels
any outstanding probe.

svn:r1140
2009-04-06 20:38:42 +00:00
Nick Mathewson
d2e9caa6fc Fix evdns_cancel to alert callback and free associated RAM.
Also, we add a test to make sure evdns_cancel is working properly.

svn:r1139
2009-04-06 20:38:19 +00:00
Nick Mathewson
0f3c0983c0 Fix a double-delete on the request timeout event. Port from Tor.
svn:r1138
2009-04-05 17:50:18 +00:00
Nick Mathewson
d0a9c90e93 Fix some of the crazier indentation and tabbing choices in evdns.c
svn:r1120
2009-02-11 17:29:17 +00:00
Nick Mathewson
77c80b8dcf New bind-to option to allow DNS clients to bind to arbitrary ports for their outgoing addresses.
svn:r1119
2009-02-11 17:24:11 +00:00
Nick Mathewson
acaf65c359 Make evutil_parse_sockaddr_port give a useful socket-length output.
svn:r1118
2009-02-11 17:23:32 +00:00
Nick Mathewson
f2a24d6e58 Better comments for some confusing-to-me code.
svn:r1117
2009-02-11 17:22:40 +00:00
Nick Mathewson
c6f4dc987c Port some evdns changes over from Tor.
svn:r1116
2009-02-11 17:21:48 +00:00
Nick Mathewson
cd731b77d7 Do not use ctypes functions in cases when we need the "net" locale.
This patch adds a new set of EVUTIL_IS* functions to replace use of
the ctypes is* functions in all cases where we care about characters'
interpretations in net ascii rather than in the locale.  For example,
when we're working with DNS hostnames, we don't want to do the 0x20
hack on non-ascii characters, even if the host thinks they should be
isalpha.

svn:r1114
2009-02-10 21:40:12 +00:00
Nick Mathewson
1ed27048e4 Stop rolling our own offsetof twice.
svn:r1113
2009-02-10 21:39:56 +00:00
Nick Mathewson
f04b90e5b3 Make a couple of newer evdns functions more bulletproof.
svn:r1112
2009-02-10 19:43:19 +00:00
Nick Mathewson
4d92e4261b forward-port: Make evdns_resolve_reverse args const.
svn:r1096
2009-02-02 19:22:27 +00:00
Nick Mathewson
52eb495130 Build with the -fno-strict-aliasing flag on GCC.
You do not want to know about the 2 hours I just spent tracking down
an evdns bug that only affected me on some platforms to the way we
were using sockaddr* and sockaddr_in*.  Suffice it to say that I do
not think this is the only C99-aliasing-dubiousness in our code, nor
that I am smart enough to keep my code correct with the GCC's strict
aliasing optimizations in place.

svn:r1079
2009-01-31 07:31:47 +00:00
Nick Mathewson
2546ea665e Do not attempt to pass a va_args to regular snprintf. Hilarity will ensue. Fortunately, 1.4 does not have this bug.
svn:r1078
2009-01-31 05:45:26 +00:00
Nick Mathewson
e3e696c822 Use size_t for name length in DNS requests. Not that it matters much.
svn:r1066
2009-01-28 20:24:12 +00:00
Nick Mathewson
8889a77039 Replace all use of config.h with event-config.h.
svn:r1064
2009-01-27 22:30:46 +00:00
Nick Mathewson
9993137cbb Remove all trailing whitespace in all the source files.
svn:r1063
2009-01-27 21:10:31 +00:00
Nick Mathewson
2b1d535e0d Accept evutil_socket_t for evdns_server_ports.
svn:r1053
2009-01-26 17:29:27 +00:00
Nick Mathewson
9935d5b01e Fix win32 compilation. Surprisingly, unit tests pass too.
svn:r1002
2009-01-13 21:39:32 +00:00
Nick Mathewson
169321c9e6 Rename four internal headers to follow the -internal.h convention.
svn:r1000
2009-01-13 20:26:37 +00:00
Nick Mathewson
81ab45add5 Use new EVUTIL_ERR_*_RETRIABLE macros when we're testing an errno for blocking.
Previously, we used inconsistent and incompletely ported ifdefs.
(We don't use these macros in platform-specific files like evpoll.c, since
they don't need to work on win32.)

svn:r995
2009-01-13 19:20:04 +00:00
Nick Mathewson
980bcd68f7 Work better with platforms that do not have ipv6 structures, or that do not have sin_len fields, etc.
svn:r986
2009-01-02 21:21:58 +00:00
Nick Mathewson
135591aeab Change the type of nameserver.address from u32 to sockaddr_storage, so that we can handle nameservers at IPv6 addresses.
svn:r985
2009-01-02 20:46:35 +00:00
Niels Provos
87be18daa1 implement evdns_cancel_request; test one of the new evdns_base functions
svn:r980
2008-12-25 16:25:37 +00:00
Nick Mathewson
dd73168556 Implement increased DSN-poisoning resistance via the 0x20 hack.
svn:r958
2008-12-03 20:09:13 +00:00
Niels Provos
1eeb96aa88 move cirular queue removal into its own function
svn:r957
2008-11-29 01:12:41 +00:00
Nick Mathewson
de069b9977 On win32, errno is not the last socket error. Worse, WSAGetLastError() is not the last socket error sometimes (i.e., EWOULDBLOCK). Also, strerror() does not handle winsock errors. Therefore, event_err() and event_warn() are completely wrong for windows socket errors. Fix that.
svn:r936
2008-09-05 16:29:56 +00:00
Niels Provos
a710d817ad Match the query in DNS replies to the query in the request; from Vsevolod Stakhov
svn:r930
2008-08-30 23:19:49 +00:00
Niels Provos
12077b4e2e support setting of AA or RD in dns server response
svn:r910
2008-07-16 03:47:47 +00:00
Niels Provos
506f3d0c8d fix cname replies
svn:r907
2008-07-13 20:18:41 +00:00
Niels Provos
409236a77d detect CLOCK_MONOTONIC at runtime for evdns
svn:r896
2008-07-02 04:39:09 +00:00