]> granicus.if.org Git - libevent/log
libevent
3 years agoMerge branch 'ssl-nagle'
Azat Khuzhin [Sat, 31 Oct 2020 20:04:55 +0000 (23:04 +0300)]
Merge branch 'ssl-nagle'

* ssl-nagle:
  Introduce new BUFFEREVENT_SSL_BATCH_WRITE flag to avoid Nagle effect in SSL
  Introduce new API for flags of the SSL bufferevent

3 years agoIntroduce new BUFFEREVENT_SSL_BATCH_WRITE flag to avoid Nagle effect in SSL
Azat Khuzhin [Sat, 31 Oct 2020 19:53:31 +0000 (22:53 +0300)]
Introduce new BUFFEREVENT_SSL_BATCH_WRITE flag to avoid Nagle effect in SSL

3 years agoIntroduce new API for flags of the SSL bufferevent
Azat Khuzhin [Sat, 31 Oct 2020 18:45:22 +0000 (21:45 +0300)]
Introduce new API for flags of the SSL bufferevent

Introduce more generic API (like for evbuffer):
- bufferevent_ssl_set_flags()
- bufferevent_ssl_clear_flags()
- bufferevent_ssl_get_flags()

And deprecate existing:
- bufferevent_openssl_get_allow_dirty_shutdown()
- bufferevent_openssl_set_allow_dirty_shutdown()
- bufferevent_mbedtls_get_allow_dirty_shutdown()
- bufferevent_mbedtls_set_allow_dirty_shutdown()

3 years agoMerge branch 'ssl-fixes-after-mbedtls'
Azat Khuzhin [Sat, 31 Oct 2020 19:50:11 +0000 (22:50 +0300)]
Merge branch 'ssl-fixes-after-mbedtls'

* ssl-fixes-after-mbedtls:
  Fix BEV_IS_SSL() macro
  Fix preprocessor condition for BEV_IS_SSL()
  Remove reduntant BEV_IS_MBEDTLS

Refs: #1028

3 years agoFix BEV_IS_SSL() macro
Azat Khuzhin [Sat, 31 Oct 2020 19:48:37 +0000 (22:48 +0300)]
Fix BEV_IS_SSL() macro

We cannot use the same trick with external declaration,
since there are copy of bufferevent_ops_ssl in each library:
- openssl
- mbedlts

However we can just compare the name of the bufferevent type for now.
(It is totally fine to use memcmp() here since it will be optimized by the compiler).

3 years agoFix preprocessor condition for BEV_IS_SSL()
Azat Khuzhin [Sat, 31 Oct 2020 19:41:16 +0000 (22:41 +0300)]
Fix preprocessor condition for BEV_IS_SSL()

3 years agoRemove reduntant BEV_IS_MBEDTLS
Azat Khuzhin [Sat, 31 Oct 2020 19:27:18 +0000 (22:27 +0300)]
Remove reduntant BEV_IS_MBEDTLS

3 years agohttp: eliminate redundant bev fd manipulating and caching [WIP]
Azat Khuzhin [Tue, 3 Sep 2019 21:56:20 +0000 (00:56 +0300)]
http: eliminate redundant bev fd manipulating and caching [WIP]

At the very beginning we reset the bufferevent fd (if bev has it), which
is not a good idea, since if user passes bufferevent with existing fd he
has some intention.

So we need to:
- use BEV_OPT_CLOSE_ON_FREE for default bufferevent_socket_new() (to
  avoid manual shutdown/closee)
- drop getsockopt(SOL_SOCKET, SO_ERROR), since bufferevent already has
  evutil_socket_finished_connecting_()
- drop supperior bufferevent_setfd(bev, -1) in
  evhttp_connection_connect_()

Closes: #795
Refs: #875

3 years agoMerge branch 'ipv6-tiny-improvements'
Azat Khuzhin [Mon, 26 Oct 2020 23:15:38 +0000 (02:15 +0300)]
Merge branch 'ipv6-tiny-improvements'

* ipv6-tiny-improvements:
  http: add EVHTTP_URI_HOST_STRIP_BRACKETS
  http-server: add -H option to change listen address
  https-client: add newline into error messages
  https-client: add -4/-6 switches

3 years agohttp: add EVHTTP_URI_HOST_STRIP_BRACKETS
Azat Khuzhin [Mon, 26 Oct 2020 22:40:34 +0000 (01:40 +0300)]
http: add EVHTTP_URI_HOST_STRIP_BRACKETS

Refs: #1115

3 years agohttp-server: add -H option to change listen address
Azat Khuzhin [Mon, 26 Oct 2020 22:22:59 +0000 (01:22 +0300)]
http-server: add -H option to change listen address

3 years agohttps-client: add newline into error messages
Azat Khuzhin [Mon, 26 Oct 2020 22:19:40 +0000 (01:19 +0300)]
https-client: add newline into error messages

3 years agohttps-client: add -4/-6 switches
Azat Khuzhin [Mon, 26 Oct 2020 22:17:44 +0000 (01:17 +0300)]
https-client: add -4/-6 switches

3 years agobecat: add timeout (client/server) and verbosity (event_enable_debug_logging())
Azat Khuzhin [Thu, 15 Oct 2020 20:23:15 +0000 (23:23 +0300)]
becat: add timeout (client/server) and verbosity (event_enable_debug_logging())

3 years agoChange log message in evutil_make_socket_nonblocking in win32
guoxiang1996 [Sat, 10 Oct 2020 19:23:14 +0000 (03:23 +0800)]
Change log message in evutil_make_socket_nonblocking in win32

Co-authored-by: guoxiang2 <guoxiang2@yy.com>
3 years agoChange prefix for man pages from "le_" to "libevent_"
Azat Khuzhin [Sun, 4 Oct 2020 19:56:30 +0000 (22:56 +0300)]
Change prefix for man pages from "le_" to "libevent_"

As pointed by @kloczek:
  "With only two characters it would be harder to guess under what kind of name are libevent lvl 3 man pages.
   Longer name with bash/fix/zsh tab competition should not be a problem :)"

Refs: #1099

3 years agoAdd prefix (le_) for man pages
Azat Khuzhin [Sun, 4 Oct 2020 16:55:52 +0000 (19:55 +0300)]
Add prefix (le_) for man pages

This will:
- avoid overlapping (since there is util.h.3 page)
- group everything under some prefix (man le_<TAB><TAB> will show everything)

Fixes: #1099
3 years agoDrop DOXYGEN_MAN_LINKS unsupported cmake flag
Azat Khuzhin [Sun, 4 Oct 2020 16:48:34 +0000 (19:48 +0300)]
Drop DOXYGEN_MAN_LINKS unsupported cmake flag

MAN_LINKS is not a variable in Doxyfile anyway.

3 years agohttp-server: add cli argument for max body size
Azat Khuzhin [Sun, 4 Oct 2020 14:44:34 +0000 (17:44 +0300)]
http-server: add cli argument for max body size

4 years agoRemove dead code from bufferevent_socket_connect
Nikita Gorskikh [Fri, 18 Sep 2020 13:34:34 +0000 (16:34 +0300)]
Remove dead code from bufferevent_socket_connect

4 years agoGenerate only real man pages with doxygen (MAN_LINKS=NO)
Azat Khuzhin [Wed, 16 Sep 2020 05:10:11 +0000 (08:10 +0300)]
Generate only real man pages with doxygen (MAN_LINKS=NO)

WIth MAN_LINKS=YES doxygen will generate ton's of man pages for each
field, function and so on, but it will not contain anything useful
except for link to another man page (header).

So to avoid man pages clashing, disable MAN_LINKS, and this will
generate man pages only for explicitly documented parts.

But even after this we have pretty non-unique man pages names:

    $ find install/ -name '*.3'
    install/share/man/man3/util.h.3
    ...

Looks like we should add prefix for each of them...
But let's see if there will be a problem.

Fixes: #1097
4 years agoRemove man pages from repo (they can be generated via doxygen)
Azat Khuzhin [Wed, 16 Sep 2020 05:25:20 +0000 (08:25 +0300)]
Remove man pages from repo (they can be generated via doxygen)

The problem with this man pages are:
- they are likely outdated
- they don't have install target
- and besides quality of man pages generated by doxygen not worse

4 years agosample: add https-client-mbedtls
okhowang(王沛文) [Wed, 16 Sep 2020 03:31:33 +0000 (11:31 +0800)]
sample: add https-client-mbedtls

4 years agotest: fix windows error when mbedtls https
okhowang(王沛文) [Tue, 15 Sep 2020 10:15:24 +0000 (18:15 +0800)]
test: fix windows error when mbedtls https

4 years agoMerge #1087 - tests for https with mbedtls
Azat Khuzhin [Mon, 14 Sep 2020 18:37:50 +0000 (21:37 +0300)]
Merge #1087 - tests for https with mbedtls

* upstream/pr/1087:
  test: add https with mbedtls
  bufferevent_openssl: fix -Wcast-function-type for SSL_pending

4 years agoAdd build w/o any SSL support (i.e. w/o openssl and mbedtls)
Azat Khuzhin [Mon, 14 Sep 2020 18:30:02 +0000 (21:30 +0300)]
Add build w/o any SSL support (i.e. w/o openssl and mbedtls)

This pure build w/o SSL has been removed in mbedtls PR - #1028

4 years agotest: add https with mbedtls
okhowang(王沛文) [Sun, 6 Sep 2020 07:33:32 +0000 (15:33 +0800)]
test: add https with mbedtls

4 years agobufferevent_openssl: fix -Wcast-function-type for SSL_pending
okhowang(王沛文) [Sat, 25 Jul 2020 09:17:46 +0000 (17:17 +0800)]
bufferevent_openssl: fix -Wcast-function-type for SSL_pending

Introduced-in: #1028

4 years agohttp: const out address param to evcon_get_peer
Leon M. George [Tue, 8 Sep 2020 13:38:16 +0000 (15:38 +0200)]
http: const out address param to evcon_get_peer

4 years agobuild: fix building under windows with thread support
Azat Khuzhin [Mon, 31 Aug 2020 22:08:16 +0000 (01:08 +0300)]
build: fix building under windows with thread support

Fixes: 972289f3 ("Detect existence of pthread_mutexattr_setprotocol()")
4 years agoFix: long -> enum evhttp_cmd_type type
Berbe [Sat, 29 Aug 2020 16:41:39 +0000 (18:41 +0200)]
Fix: long -> enum evhttp_cmd_type type

4 years agotest/regress_dns: fix -Wmaybe-uninitialized
Azat Khuzhin [Fri, 28 Aug 2020 22:15:20 +0000 (01:15 +0300)]
test/regress_dns: fix -Wmaybe-uninitialized

Was not noticed since it is reported only with optimization enabled, as
stated in gcc(1):

   The effectiveness of some warnings depends on optimizations also
   being enabled. For example -Wsuggest-final-types is more effective with
   link-time optimization and -Wmaybe-uninitialized does not warn at all
   unless optimization is enabled.

And interesting thing is that it is reported only for -O2, not for -O3,
that's why I did not catched it in both cmake env that I had:
- debug (it has -O0)
- release (it has -O3)

While autoconf has -O2.

4 years agoDetect existence of pthread_mutexattr_setprotocol()
Azat Khuzhin [Fri, 28 Aug 2020 22:15:20 +0000 (01:15 +0300)]
Detect existence of pthread_mutexattr_setprotocol()

Fixes: #1084
4 years agobuild: add doxygen to all
Azat Khuzhin [Mon, 10 Aug 2020 23:12:23 +0000 (02:12 +0300)]
build: add doxygen to all

Fixes: 7e6c5fb4 ("build: do not try install doxygen man pages if they were not requested")
Fixes: #1075
Fixes: #886
4 years agobuild: do not try install doxygen man pages if they were not requested
Azat Khuzhin [Thu, 6 Aug 2020 07:24:55 +0000 (10:24 +0300)]
build: do not try install doxygen man pages if they were not requested

Fixes: #1075
4 years agoMerge #1074
Azat Khuzhin [Thu, 6 Aug 2020 07:12:07 +0000 (10:12 +0300)]
Merge #1074

yuangongji:
  "Fix CI failures #1071
  - Install vcpkg through the source code to temporarily solve the windows CI problem.
  - Update cache version and replace setup-msys2."

* upstream/pr/1074:
  fix CI:Update cache version and replace setup-msys2
  fix CI: Install vcpkg through the source code to temporarily solve the windows CI problem

4 years agofix CI:Update cache version and replace setup-msys2
yuangongji [Wed, 5 Aug 2020 04:12:08 +0000 (12:12 +0800)]
fix CI:Update cache version and replace setup-msys2

4 years agofix CI: Install vcpkg through the source code to temporarily solve the windows CI...
yuangongji [Wed, 5 Aug 2020 02:14:53 +0000 (10:14 +0800)]
fix CI: Install vcpkg through the source code to temporarily solve the windows CI problem

4 years agoConvert from WinCrypt to Windows BCrypt
Gerry Garvey [Sat, 1 Aug 2020 15:10:48 +0000 (16:10 +0100)]
Convert from WinCrypt to Windows BCrypt

Fixes: #1069
4 years agoHandle return value from getrandom()
Gerry Garvey [Sat, 1 Aug 2020 13:05:39 +0000 (14:05 +0100)]
Handle return value from getrandom()

4 years agoRemove reduntant variables in workflows with deploy
Azat Khuzhin [Tue, 28 Jul 2020 08:03:46 +0000 (11:03 +0300)]
Remove reduntant variables in workflows with deploy

Fixes: bfbbc882 ("Change user.name/user.email to robot for deploy via github actions")
4 years agoChange user.name/user.email to robot for deploy via github actions
Azat Khuzhin [Tue, 28 Jul 2020 08:02:15 +0000 (11:02 +0300)]
Change user.name/user.email to robot for deploy via github actions

4 years agotest/dns: fix initialize_nameservers when there is ipv6 in /etc/resolv.conf
Azat Khuzhin [Mon, 27 Jul 2020 22:19:28 +0000 (01:19 +0300)]
test/dns: fix initialize_nameservers when there is ipv6 in /etc/resolv.conf

Fixes: #1060
4 years agowindows socketpair tmpfile: use random prefix
Pierce Lopez [Sun, 26 Jul 2020 01:17:21 +0000 (21:17 -0400)]
windows socketpair tmpfile: use random prefix

fixes #1058

GetTempFileNameA() takes an optional prefix, and a "unique" long value
which can optionally be zero, which causes it to automatically
increment until a not-yet-existing filename is found.

When libevent creates many AF_UNIX socketpairs on windows,
it slows down dramatically, due to always using the same blank prefix,
and GetTempFileNameA() needing to iterate through all the existing
socketpair filenames. With a present and varying prefix, it will have
much less need to iterate.

It was also possible for a race with other processes also using
blank-prefix tmpfile names to result in both trying to start using
the same name at the same time (because libevent deletes the file
and then re-creates it as a unix socket), which should now be
much less likely.

Unfortuantely, "much" is just a factor of 32k, because the prefix
is only 3 characters, and windows filesystems are case-insensitive,
so doing better would require more sophisticated windows API usage
and charset trickyness.

4 years agofix: compat mbedtls < 2.4
okhowang(王沛文) [Fri, 24 Jul 2020 09:19:14 +0000 (17:19 +0800)]
fix: compat mbedtls < 2.4

4 years agoFix bufferevent_get_{openssl,mbedtls}_error()
Azat Khuzhin [Thu, 23 Jul 2020 20:38:53 +0000 (23:38 +0300)]
Fix bufferevent_get_{openssl,mbedtls}_error()

The bufferevent_get_openssl_error() returns unsigned long, so returning
-1 on error in unclear. Let's use 0.

Fixes: #1028
4 years agoci/doxygen: install missing libmbedtls-dev
Azat Khuzhin [Wed, 22 Jul 2020 23:01:02 +0000 (02:01 +0300)]
ci/doxygen: install missing libmbedtls-dev

4 years agoci/coverage: add missing libmbedtls-dev
Azat Khuzhin [Wed, 22 Jul 2020 22:08:22 +0000 (01:08 +0300)]
ci/coverage: add missing libmbedtls-dev

4 years agole-proxy: ignore SIGPIPE
Azat Khuzhin [Wed, 22 Jul 2020 21:28:09 +0000 (00:28 +0300)]
le-proxy: ignore SIGPIPE

Fixes: #1057
4 years agotest/regress_buffer.c: fix -Wbad-function-cast (in some specific env)
Azat Khuzhin [Wed, 22 Jul 2020 21:22:45 +0000 (00:22 +0300)]
test/regress_buffer.c: fix -Wbad-function-cast (in some specific env)

Fixes: #1054
4 years agoMerge branch 'mbedtls'
Azat Khuzhin [Wed, 22 Jul 2020 21:14:34 +0000 (00:14 +0300)]
Merge branch 'mbedtls'

This patch set provides mbed TLS support.

The interface part (include/event2/bufferevent_ssl.h) LGTM, so this can
be safely merged (although there are some bits left).

Includes:
- bufferevent_mbedtls_*
- regress_mbedtls tests

Left:
- regress_http https_mbedtls support
- ChangeLog entry

* mbedtls:
  test: rename ssl/* -> openssl/*
  Join le_ssl_ops.post_init with le_ssl_ops.init
  Update LICENSE for ssl-client-mbedtls.c
  Merge ssl implementations (openssl and mbedtls)
  add mbedtls to CI
  fix build system and add test and cleanup code
  mbed TLS cmake support
  simple https client example using mbedtls
  mbedtls based SSL implementation

4 years agotest: rename ssl/* -> openssl/*
Azat Khuzhin [Wed, 22 Jul 2020 20:10:17 +0000 (23:10 +0300)]
test: rename ssl/* -> openssl/*

4 years agoJoin le_ssl_ops.post_init with le_ssl_ops.init
Azat Khuzhin [Wed, 22 Jul 2020 20:08:50 +0000 (23:08 +0300)]
Join le_ssl_ops.post_init with le_ssl_ops.init

4 years agoUpdate LICENSE for ssl-client-mbedtls.c
Azat Khuzhin [Wed, 22 Jul 2020 20:02:31 +0000 (23:02 +0300)]
Update LICENSE for ssl-client-mbedtls.c

4 years agoMerge ssl implementations (openssl and mbedtls)
okhowang(王沛文) [Tue, 7 Jul 2020 09:26:46 +0000 (17:26 +0800)]
Merge ssl implementations (openssl and mbedtls)

This patch splits common part out to avoid copy-paste from the
- bufferevent_openssl.c
- bufferevent_mbedtls.c

It uses VFS/bufferevent-like approach, i.e. structure of callbacks.

4 years agoadd mbedtls to CI
okhowang(王沛文) [Wed, 27 May 2020 07:29:42 +0000 (15:29 +0800)]
add mbedtls to CI

4 years agofix build system and add test and cleanup code
okhowang(王沛文) [Thu, 28 May 2020 09:14:46 +0000 (17:14 +0800)]
fix build system and add test and cleanup code

4 years agombed TLS cmake support
Jesse Fang [Tue, 14 Jan 2020 04:18:27 +0000 (12:18 +0800)]
mbed TLS cmake support

FindMbedTLS.cmake is come from https://github.com/AVSystem/avs_commons/blob/master/cmake/FindMbedTLS.cmake, which is licensed under Apache 2.0

alternatives:
  https://github.com/curl/curl/blob/master/CMake/FindMbedTLS.cmake   without variable MBEDTLS_ROOT_DIR
  https://github.com/libgit2/libgit2/blob/master/cmake/Modules/FindmbedTLS.cmake  GPLv2 with a special Linking Exception

4 years agosimple https client example using mbedtls
Jesse Fang [Mon, 13 Jan 2020 15:08:26 +0000 (23:08 +0800)]
simple https client example using mbedtls

Based on mbedtls's source code programs/ssl/ssl_client1.c

4 years agombedtls based SSL implementation
Jesse Fang [Mon, 13 Jan 2020 15:04:29 +0000 (23:04 +0800)]
mbedtls based SSL implementation

prototype is libevent-2.1.11-stable libevent_openssl.c

4 years agodoc: fix typo in thread.h
fanquake [Mon, 20 Jul 2020 13:59:10 +0000 (21:59 +0800)]
doc: fix typo in thread.h

s/evthred_use_pthreads_with_flags/evthread_use_pthreads_with_flags/

4 years agoMerge #1048 -- append warning flags only if they are available (autotools)
Azat Khuzhin [Fri, 10 Jul 2020 19:18:59 +0000 (22:18 +0300)]
Merge #1048 -- append warning flags only if they are available (autotools)

* upstream/pr/1048:
  build: remove -Wstrict-aliasing as strict-aliasing is disabled
  build: move automake options into AM_INIT_AUTOMAKE call
  build: remove commented code from configure.ac
  build: use feature detection when adding compile flags
  build: add ax_check_compile_flag macro

4 years agobuild: remove -Wstrict-aliasing as strict-aliasing is disabled
fanquake [Tue, 7 Jul 2020 05:58:47 +0000 (13:58 +0800)]
build: remove -Wstrict-aliasing as strict-aliasing is disabled

Note that -Wstrict-aliasing is also include in -Wall.

4 years agobuild: move automake options into AM_INIT_AUTOMAKE call
fanquake [Fri, 3 Jul 2020 08:02:09 +0000 (16:02 +0800)]
build: move automake options into AM_INIT_AUTOMAKE call

4 years agobuild: remove commented code from configure.ac
fanquake [Fri, 3 Jul 2020 07:47:10 +0000 (15:47 +0800)]
build: remove commented code from configure.ac

4 years agobuild: use feature detection when adding compile flags
fanquake [Fri, 26 Jun 2020 06:33:43 +0000 (14:33 +0800)]
build: use feature detection when adding compile flags

Rather than trying to detect (potentially very old) GCC versions, just
test whether the flag works with the compiler, and add it to CLFAGS if
so.

-Werror is used to convert unknown flag warnings into errors, and
prevent their addition to CLFAGS.

4 years agobuild: add ax_check_compile_flag macro
fanquake [Fri, 26 Jun 2020 06:04:26 +0000 (14:04 +0800)]
build: add ax_check_compile_flag macro

4 years agoci/linux: create dist artifact only if dist archive was built
Azat Khuzhin [Sun, 5 Jul 2020 10:55:53 +0000 (13:55 +0300)]
ci/linux: create dist artifact only if dist archive was built

Fixes: 512c88ce ("ci/linux: add dist check")
4 years agoMerge branch 'fix-signal-leak'
Azat Khuzhin [Sun, 5 Jul 2020 10:16:52 +0000 (13:16 +0300)]
Merge branch 'fix-signal-leak'

Fixes main/fork under ASAN (LSAN if to be precise)

* fix-signal-leak:
  select: requires reinit (otherwise it leaks signal handlers)
  poll: requires reinit (otherwise it leaks signal handlers)

4 years agoselect: requires reinit (otherwise it leaks signal handlers)
Azat Khuzhin [Sun, 5 Jul 2020 10:16:03 +0000 (13:16 +0300)]
select: requires reinit (otherwise it leaks signal handlers)

Fixes: main/fork under SELECT with ASAN
4 years agopoll: requires reinit (otherwise it leaks signal handlers)
Azat Khuzhin [Sun, 5 Jul 2020 10:14:36 +0000 (13:14 +0300)]
poll: requires reinit (otherwise it leaks signal handlers)

Fixes: main/fork under POLL with ASAN
4 years agotest: fix leak in dns/getaddrinfo_cancel_stress
Azat Khuzhin [Sun, 5 Jul 2020 08:59:32 +0000 (11:59 +0300)]
test: fix leak in dns/getaddrinfo_cancel_stress

Some requests may get response (evutil_addrinfo) from gaic_server_cb,
in case of cancel_event (10000ms) will not be fast enough.

4 years agotest: fix UB in evbuffer/empty_reference_prepend_buffer
Azat Khuzhin [Sun, 5 Jul 2020 08:45:56 +0000 (11:45 +0300)]
test: fix UB in evbuffer/empty_reference_prepend_buffer

UBSAN reports:
  test/regress_buffer.c:2360:2: runtime error: null pointer passed as argument 1, which is declared to never be null
  /usr/include/string.h:140:33: note: nonnull attribute specified here

4 years agoci: set build type to debug with sanitizers
Azat Khuzhin [Sun, 5 Jul 2020 08:21:04 +0000 (11:21 +0300)]
ci: set build type to debug with sanitizers

4 years agotest: really disable bufferevent_pair_release_lock under ASAN (and fix gcc)
Azat Khuzhin [Sun, 5 Jul 2020 08:14:18 +0000 (11:14 +0300)]
test: really disable bufferevent_pair_release_lock under ASAN (and fix gcc)

4 years agotest-closed: fix leak
Azat Khuzhin [Sun, 5 Jul 2020 08:08:05 +0000 (11:08 +0300)]
test-closed: fix leak

4 years agobuild: do not disable deprecation warnings on macOS
Pierce Lopez [Sat, 4 Jul 2020 19:55:22 +0000 (15:55 -0400)]
build: do not disable deprecation warnings on macOS

this was for using openssl-0.9.8 included in macOS 10.7 - 10.12,
but it is long since time you really should not use that openssl

4 years agoMerge #1046 -- build: misc configure changes
Azat Khuzhin [Fri, 3 Jul 2020 06:27:20 +0000 (09:27 +0300)]
Merge #1046 -- build: misc configure changes

* upstream/pr/1046:
  build: consolidate darwin compile flag additions in configure
  build: consistently use dnl for comments in configure.ac

4 years agoAdd abi-check report into artifacts
Azat Khuzhin [Sun, 28 Jun 2020 14:10:03 +0000 (17:10 +0300)]
Add abi-check report into artifacts

4 years agobuild: consolidate darwin compile flag additions in configure
fanquake [Sun, 28 Jun 2020 10:40:26 +0000 (18:40 +0800)]
build: consolidate darwin compile flag additions in configure

This is mostly move-only, apart from some changes to comments.

4 years agobuild: consistently use dnl for comments in configure.ac
fanquake [Sun, 28 Jun 2020 10:30:54 +0000 (18:30 +0800)]
build: consistently use dnl for comments in configure.ac

4 years agotest: add getaddrinfo(AI_ADDRCONFIG) test (off by default)
Azat Khuzhin [Fri, 26 Jun 2020 07:35:44 +0000 (10:35 +0300)]
test: add getaddrinfo(AI_ADDRCONFIG) test (off by default)

4 years agobuild: remove duplicate -Wredundant-decls
fanquake [Fri, 26 Jun 2020 06:35:41 +0000 (14:35 +0800)]
build: remove duplicate -Wredundant-decls

4 years agoMerge branch 'tests-under-sanitizers'
Azat Khuzhin [Thu, 25 Jun 2020 20:16:16 +0000 (23:16 +0300)]
Merge branch 'tests-under-sanitizers'

* tests-under-sanitizers:
  test: fix memory leaks for https (add BEV_OPT_CLOSE_ON_FREE)
  test: "fix" (with a quirk) leak in ssl/bufferevent_wm (w/o defer callbacks)
  test: disable bufferevent/bufferevent_pair_release_lock under ASAN (too tricky)
  test: detect test failures if atexit handler calls _exit(!0) (sanitizers)
  Add LSAN suppressions (for OpenSSL temporary quirk)
  Add TSAN suppressions
  ci: run tests under sanitizers

Fixes: #955
4 years agotest: fix memory leaks for https (add BEV_OPT_CLOSE_ON_FREE)
Azat Khuzhin [Thu, 25 Jun 2020 18:56:31 +0000 (21:56 +0300)]
test: fix memory leaks for https (add BEV_OPT_CLOSE_ON_FREE)

- http/https_filter_basic
- http/https_filter_chunk_out

4 years agotest: "fix" (with a quirk) leak in ssl/bufferevent_wm (w/o defer callbacks)
Azat Khuzhin [Thu, 25 Jun 2020 18:40:40 +0000 (21:40 +0300)]
test: "fix" (with a quirk) leak in ssl/bufferevent_wm (w/o defer callbacks)

4 years agotest: disable bufferevent/bufferevent_pair_release_lock under ASAN (too tricky)
Azat Khuzhin [Thu, 25 Jun 2020 18:25:51 +0000 (21:25 +0300)]
test: disable bufferevent/bufferevent_pair_release_lock under ASAN (too tricky)

And cannot be suppressed with suppressions due to setup routines.

4 years agotest: detect test failures if atexit handler calls _exit(!0) (sanitizers)
Azat Khuzhin [Thu, 25 Jun 2020 18:01:53 +0000 (21:01 +0300)]
test: detect test failures if atexit handler calls _exit(!0) (sanitizers)

tinytest uses another way of detecting test failures, it uses pipe
between child and parent, and if the test function in child returns OK
it writes OK flag into pipe, and reads it in parent.

However sanitizers uses atexit handlers to detect leaks, and this will
not detect failures in case of exit() will be called from the atexit
handlers, fix this by checking status after waitpid().

4 years agoAdd LSAN suppressions (for OpenSSL temporary quirk)
Azat Khuzhin [Thu, 25 Jun 2020 18:34:02 +0000 (21:34 +0300)]
Add LSAN suppressions (for OpenSSL temporary quirk)

4 years agoAdd TSAN suppressions
Azat Khuzhin [Thu, 25 Jun 2020 18:01:53 +0000 (21:01 +0300)]
Add TSAN suppressions

4 years agoci: run tests under sanitizers
Azat Khuzhin [Thu, 25 Jun 2020 18:01:53 +0000 (21:01 +0300)]
ci: run tests under sanitizers

Added:
- ASAN
- TSAN
- UBSAN

And disable some tests that are know to have leaks.

4 years agoMake all classes Entry, Struct, etc) new-style classes
Enji Cooper [Thu, 25 Jun 2020 15:08:10 +0000 (08:08 -0700)]
Make all classes Entry, Struct, etc) new-style classes

This allows the object methods to be properly inherited and called via
`super(..)`, addressing breakage with python 2.x, introduced in
cfcc093606e747a5d250787012bac0b149c60d6d.

Fixes #1042.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoevdns: do not pass NULL to memcpy() in evdns_server_request_format_response()
Azat Khuzhin [Thu, 25 Jun 2020 07:18:43 +0000 (10:18 +0300)]
evdns: do not pass NULL to memcpy() in evdns_server_request_format_response()

In case of OPT pseudo-RR `class` field is treated as a requestor's UDP
payload size, and class will have 512 (DNS_MAX_UDP_SIZE), and data is
NULL:

  (gdb) p *item
  $4 = {
    next = 0x0,
    name = 0x602000000130 "",
    type = 41,
    class = 512,
    ttl = 0,
    is_name = 0 '\000',
    datalen = 0,
    data = 0x0
  }

And UBSAN will reports:

  ../evdns.c:2493:5: runtime error: null pointer passed as argument 2, which is declared to never be null
      #0 0x7ffff70b65bb in evdns_server_request_format_response ../evdns.c:2493
      #1 0x7ffff70b706b in evdns_server_request_respond ../evdns.c:2529
      #2 0x5555557975ab in regress_dns_server_cb ../test/regress_testutils.c:263
      #3 0x7ffff70a8489 in request_parse ../evdns.c:1576
      #4 0x7ffff70aa445 in server_udp_port_read ../evdns.c:1726
      #5 0x7ffff70ac5cc in server_port_ready_callback ../evdns.c:1849
      #6 0x7ffff6d3054c in event_persist_closure ../event.c:1645
      #7 0x7ffff6d311cd in event_process_active_single_queue ../event.c:1704
      #8 0x7ffff6d33258 in event_process_active ../event.c:1805
      #9 0x7ffff6d361b5 in event_base_loop ../event.c:2047
      #10 0x7ffff6d334ac in event_base_dispatch ../event.c:1839
      #11 0x555555739df2 in test_edns ../test/regress_dns.c:2639
      #12 0x5555557b9e96 in testcase_run_bare_ ../test/tinytest.c:173
      #13 0x5555557ba8f0 in testcase_run_one ../test/tinytest.c:333
      #14 0x5555557bc9a0 in tinytest_main ../test/tinytest.c:527
      #15 0x555555787faa in main ../test/regress_main.c:528
      #16 0x7ffff606c001 in __libc_start_main (/usr/lib/libc.so.6+0x27001)
      #17 0x55555569436d in _start (/src/le/libevent/.cmake-debug/bin/regress+0x14036d)

4 years agobuffer: do not pass NULL to memcpy() from evbuffer_pullup()
Azat Khuzhin [Thu, 25 Jun 2020 07:15:01 +0000 (10:15 +0300)]
buffer: do not pass NULL to memcpy() from evbuffer_pullup()

UBSAN reports:

  evbuffer/remove_buffer_with_empty3: ../buffer.c:1443:3: runtime error: null pointer passed as argument 2, which is declared to never be null
      #0 0x7ffff6cd0410 in evbuffer_pullup ../buffer.c:1443
      #1 0x5555556d68b9 in test_evbuffer_remove_buffer_with_empty3 ../test/regress_buffer.c:408
      #2 0x5555557b95ee in testcase_run_bare_ ../test/tinytest.c:173
      #3 0x5555557ba048 in testcase_run_one ../test/tinytest.c:333
      #4 0x5555557bc0f8 in tinytest_main ../test/tinytest.c:527
      #5 0x555555787702 in main ../test/regress_main.c:528
      #6 0x7ffff606c001 in __libc_start_main (/usr/lib/libc.so.6+0x27001)
      #7 0x55555569436d in _start (/src/le/libevent/.cmake-debug/bin/regress+0x14036d)

4 years agotest: do not pass NULL to memcmp() in evbuffer_datacmp() helper
Azat Khuzhin [Thu, 25 Jun 2020 06:59:35 +0000 (09:59 +0300)]
test: do not pass NULL to memcmp() in evbuffer_datacmp() helper

Fixes:
  runtime error: null pointer passed as argument 2, which is declared to never be null

4 years agohttp: fix undefined-shift in EVUTIL_IS*_ helpers
Azat Khuzhin [Thu, 25 Jun 2020 05:45:34 +0000 (08:45 +0300)]
http: fix undefined-shift in EVUTIL_IS*_ helpers

evutil.c:2559:1: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
    #0 0x4f2be0 in EVUTIL_ISXDIGIT_ libevent/evutil.c:2559:1
    #1 0x4bd689 in regname_ok libevent/http.c:4838:7
    #2 0x4bc16b in parse_authority libevent/http.c:4958:9
    #3 0x4bb8b5 in evhttp_uri_parse_with_flags libevent/http.c:5103:7
    #4 0x4bb762 in evhttp_uri_parse libevent/http.c:5050:9
    #5 0x4b8f41 in evhttp_parse_query_impl libevent/http.c:3505:9
    #6 0x4b8ed7 in evhttp_parse_query libevent/http.c:3569:9

Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=23291
Report: https://oss-fuzz.com/testcase-detail/5670743106125824

4 years agoCheck error code of evhttp_add_header_internal() in evhttp_parse_query_impl()
Azat Khuzhin [Thu, 25 Jun 2020 06:08:31 +0000 (09:08 +0300)]
Check error code of evhttp_add_header_internal() in evhttp_parse_query_impl()

4 years agowepoll: use lower-cased windows headers
fanquake [Mon, 22 Jun 2020 11:40:06 +0000 (19:40 +0800)]
wepoll: use lower-cased windows headers

This matches their use throughout the rest of the project, and fixes the
build when you are cross-compiling on Linux using mingw-w64. i.e:

  CC       epoll.lo
  CC       wepoll.lo
  CC       signal.lo
wepoll.c:138:10: fatal error: WS2tcpip.h: No such file or directory
 #include <WS2tcpip.h>
          ^~~~~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:1918: wepoll.lo] Error 1

4 years agocmake: avoid problems from use of CMAKE_USE_PTHREADS_INIT
Paul Osborne [Thu, 18 Jun 2020 15:47:14 +0000 (15:47 +0000)]
cmake: avoid problems from use of CMAKE_USE_PTHREADS_INIT

In some CMake integrations, portions of the toolchain may end up
defining CMAKE_USE_PTHREADS_INIT even when EVENT__DISABLE_THREAD_SUPPORT
is set for libevent.  Modify the build to not rely on this side effect
of find_package(Threads, ...) [which could be done elsewhere] but instead
to use EVENT__HAVE_PTHREADS which is defined only on the desired codepath.

Without this change, affected builds fail as a result of event_pthreads source
files being built but with build defines which cause the build to fail.

Signed-off-by: Paul Osborne <paul.osborne@smartthings.com>
4 years agorecreate socket when udp failed
okhowang(王沛文) [Thu, 28 May 2020 09:32:05 +0000 (17:32 +0800)]
recreate socket when udp failed