NOTE: This is not the official release until I tag it. If you see
this commit, and you decide that Libevent 2.0.8-rc is now
finalized, you might get something besides 2.0.8-rc.
Apparently, in our configure.in check for a working kqueue, we were
leaving some fields unset that seemed to irritate 64-bit kqueue a lot.
Found by Christopher Layne
Issue 1: autoconf gets accept when a header works properly with cpp
but not with cc. This was true of the sys/sysctl.h header on
openbsd. The fix: include sys/param.h (if present) when testing for
sys/sysctl.h
Issue 2: Somehow, autoconf's macro generation code is messed up on
some versions of openbsd (including mine, and other people's too) so
that instead of SIZEOF_VOID_P, it makes SIZEOF_VOID__.
evutil/util.h now works around that.
It turns out that _REENTRANT isn't only needed to make certain
functions visible; we also need it to make pthreads work properly
some places (like Solaris, where forgetting _REENTRANT basically
means that all threads are sharing the same errno). Fortunately,
our ACX_PTHREAD() configure macro already gives us a PTHREAD_CFLAG
variable, so all we have to do is use it.
For future note, opensolaris doesn't have sys/sysctl.h, doesn't like
comparing iov_buf to a chain_space_ptr without a cast, and is (predictably)
unforgiving of dumb syntax errors.
Also, we had accidentally broken the devpoll backend test in configure.in
Of course, FreeBSD has its own arc4random() implementation, so this should
never actually be needed. Still, it's good to paint the underside of the
wagon.
William Ahern points out that if the user has chrooted, they might not
have a working /dev/urandom. Linux and many of the BSDs, however,
define a sysctl interface to their kernel random number generators.
This patch takes a belt-and-suspenders approach and tries to do use the
sysctl _and_ the /dev/urandom approach if both are present. When using
the sysctl approach, it tries to bulletproof itself by checking to make
sure that the buffers are actually set by the sysctl calls.
On 64-bit windows, configure actually _finds_ select when it tests for
it, and due to the ordering of the io implementations in event.c it is
chosen over the win32select implementation.
This modification skips the test for select on win32 (we don't want
that anyway, because Windows has its own), causing my windows box to
get the win32select implementation.
(edited by Nick)
AC_LIBOBJ is really only meant for defining missing library functions,
not conditional code compilation. Sticking our conditionally compiled
modules in SYS_SRC should make stuff easier to maintain.
We've changed a couple of APIs introduced in 2.0.1-alpha, so it
behooves us to give high-needs apps (like Tor) a way to tell we've
done this.
Sensible apps will just say "is it 2.0.3-alpha or 2.0.4-alpha" and
ignore the existence of 2.0.3-alpha-dev, which is just as it should
be.
Previously, evdns was at the mercy of the user for providing a good
entropy source; without one, it would be vulnerable to various
active attacks.
This patch adds a port of OpenBSD's arc4random() calls to Libevent
[port by Chris Davis], and wraps it up a little bit so we can use it
more safely.
We already emulate most of the other useful bits of stdint.h, and
we seem to have started to use uintptr_t in a few places throughout
the code. Let's make sure we can continue to do so even on backwards
platforms that don't do C99.
Right now it only catches cases where we aren't initializing events,
or where we are re-initializing events without deleting them first.
These are however shockingly common.
Previously, we assumed that we would have setenv/unsetenv everywhere
but WIN32, where we could fake them with putenv. This isn't so: some
other non-windows systems lack setenv/unsetenv, and some of them lack
putenv too.
The first part of the solution, then, is to detect setenv/unsetenv/
putenv from configure.in, and to fake setenv/unsetenv with putenv
whenever we have the latter but not one of the former.
But what should we do when we don't even have putenv? We could do
elaborate tricks to manipulate the environ pointer, but since we're
only doing this for the unit tests, let's just skip the one test in
question that uses setenv/unsetenv.
Apparently some newer versions of mingw provide a fake pthreads api to
let applications work even if they don't know about windows threading.
That's nice, but we aren't one of those.
Note that we've made two subtle mistakes: we are supposed to suffix
any non-released version with "-dev", and we're supposed to use the
last byte of the numeric version to indicate whether we have done this.
For example, when 2.0.4-alpha is released, its numeric versin will be
0x 02 00 04 00. As soon as we tag it, we will change the version in
the git repository to 2.0.4-alpha-dev, whose numeric version will be
0x 02 00 04 01 or something.
The entry points are evutil_getaddrinfo and evdns_getaddrinfo respectively.
There are fairly extensive unit tests.
I believe this code conforms to RFC3493 pretty closely, but there are
probably more issues. It should get tested on more platforms.
This code means we can dump the well-intentioned but weirdly-implemented
bufferevent_evdns and evutil_resolve code.
svn:r1537
This function, bufferevent_socket_connect_hostname() can either use
evdns to do the resolve, or use a new function (evutil_resolve) that
uses getaddrinfo or gethostbyname, like http.c does now.
This function is meant to eventually replace the hostname resolution mess in
http.c.
svn:r1496
This code adds a new Bufferevent type that is only compiled when the
openssl library is present. It supports using an SSL object and an
event alert mechanism, which can either be an fd or an underlying
bufferevent.
There is still more work to do: the unit tests are incomplete, and we
need to support flush and shutdown much better. Sometimes events are
generated needlessly: this will hose performance.
There's a new encrypting proxy in sample/le-proxy.c.
This code has only been tested on OSX, and nowhere else.
svn:r1382
Patch from Zack Weinberg. His message:
This one eliminates all use of AC_CHECK_LIB in the configure script.
AC_CHECK_LIB has a serious flaw: if the library you mention *exists*
but is not *necessary* for the function you want, it adds it to
$(LIBS) anyway. This was fine in the days of static libraries,
because the linker would ignore an .a library that didn't contain
anything you needed. However, ELF shared libraries are different
(let's not get into why): the linker will by default record a
DT_NEEDED entry for every shared object mentioned on the link
command line. Thus, every use of AC_CHECK_LIB is a potential
unnecessary DT_NEEDED, making extra work for the dynamic loader. The
cure is simply to use AC_SEARCH_LIBS instead; it first tries to find
the function you ask for in libc, and only if that doesn't work does
it try to use the extra library you mention.
For the same reasons, pkg-config .pc files should distinguish
between the libraries to use for shared linkage (Libs:) and the
additional libraries needed for static linkage (Libs.private:). I
have also made that correction in this patch. I also took the
opportunity to clean up the substitution variables a little and make
absolutely sure that the core library does not get linked against
zlib.
svn:r1338
This is patch 2673214 from mmadia. It is correct, since we unconditionally
include signal.h in many other places, and only sometimes include sys/signal.h.
It is necessary to compile on Haiku, I'm told.
svn:r1228