]> granicus.if.org Git - libevent/log
libevent
22 months agoSearch library name of Debug for find_event_lib.
Haowei Hsu [Fri, 29 Jul 2022 12:58:27 +0000 (20:58 +0800)]
Search library name of Debug for find_event_lib.

22 months agoAdd postfix for Debug configuration.
Haowei Hsu [Fri, 29 Jul 2022 12:49:35 +0000 (20:49 +0800)]
Add postfix for Debug configuration.

22 months agoAdd more HTTP_ response codes
Dmitry Ilyin [Sat, 6 Aug 2022 11:23:53 +0000 (14:23 +0300)]
Add more HTTP_ response codes

23 months agoci: increase number of attempts to 5
Azat Khuzhin [Tue, 12 Jul 2022 18:57:41 +0000 (21:57 +0300)]
ci: increase number of attempts to 5

23 months agoci: add retries
Azat Khuzhin [Tue, 12 Jul 2022 18:08:00 +0000 (21:08 +0300)]
ci: add retries

Right now it is possible for some tests to fail, because of lack of CPU
time.
And it is better to have green CI even if this will take longer.

23 months agoci: use ubuntu 22.04 with clang 11 for sanitizers build (#1306)
Azat Khuzhin [Tue, 12 Jul 2022 07:07:04 +0000 (10:07 +0300)]
ci: use ubuntu 22.04 with clang 11 for sanitizers build (#1306)

* ci-tsan-recent:
  test: fix unused variable in rand test (catched by newer clang)
  ci: use ubuntu 22.04 with clang 11 for sanitizers build

23 months agotest: fix unused variable in rand test (catched by newer clang)
Azat Khuzhin [Tue, 12 Jul 2022 06:54:14 +0000 (09:54 +0300)]
test: fix unused variable in rand test (catched by newer clang)

23 months agoci: use ubuntu 22.04 with clang 11 for sanitizers build
Azat Khuzhin [Tue, 12 Jul 2022 05:03:36 +0000 (08:03 +0300)]
ci: use ubuntu 22.04 with clang 11 for sanitizers build

There are periodically some heap-use-after-free reported in ratelim
tests by TSan, which I cannot reproduce locally and even on CI it is
flaky.

Let's try to use recent clang, maybe it fixes some issues in sanitizers.

Refs: #1206

23 months agotest: increase timeout significantly in dns/getaddrinfo_cancel_stress (for TSan)
Azat Khuzhin [Mon, 11 Jul 2022 19:52:57 +0000 (22:52 +0300)]
test: increase timeout significantly in dns/getaddrinfo_cancel_stress (for TSan)

Fixes: #1304
23 months agoci: disable broken mingw cmake builds (#1207)
Azat Khuzhin [Mon, 11 Jul 2022 00:45:32 +0000 (03:45 +0300)]
ci: disable broken mingw cmake builds (#1207)

23 months agoSlightly adjust badges markdown in README
Azat Khuzhin [Mon, 11 Jul 2022 00:51:31 +0000 (03:51 +0300)]
Slightly adjust badges markdown in README

23 months agoci: fix master/upstream workflow (syntax error)
Azat Khuzhin [Mon, 11 Jul 2022 00:50:16 +0000 (03:50 +0300)]
ci: fix master/upstream workflow (syntax error)

23 months agoUpdate CI status badge
Azat Khuzhin [Mon, 11 Jul 2022 00:47:45 +0000 (03:47 +0300)]
Update CI status badge

23 months agoRework CI to keep everything in one workflow (by using reusable workflow)
Azat Khuzhin [Sun, 10 Jul 2022 13:49:53 +0000 (16:49 +0300)]
Rework CI to keep everything in one workflow (by using reusable workflow)

Right now because we have separate workflows there is no one page with
all the jobs, instead we have separate page for each workflow (linux,
windows, ...)

This is pretty inconvenient, so let's make it cleaner, and now we will
have only two:

- for pull requests
- for upstream/master

23 months agoevdns: accept domains up to 254 long (previosly only 63 long was accepted)
Azat Khuzhin [Sun, 10 Jul 2022 14:33:15 +0000 (17:33 +0300)]
evdns: accept domains up to 254 long (previosly only 63 long was accepted)

Previously evdns was using HOST_NAME_MAX, and define it to 255 *only* if
it not set, however it does set on linux:

    $ egrep -r define.*HOST_NAME_MAX /usr/include/bits
    /usr/include/bits/local_lim.h:#define HOST_NAME_MAX             64
    /usr/include/bits/posix1_lim.h:#define _POSIX_HOST_NAME_MAX     255
    /usr/include/bits/confname.h:#define _SC_HOST_NAME_MAX          _SC_HOST_NAME_MAX

But 64 should be the limit of the host component, not for the whole
hostname, as also noted by @ploxiln

So use our own EVDNS_NAME_MAX const, which is set to 255.

Fixes: #1280
23 months agotest: make dns/getaddrinfo_cancel_stress more deterministic
Azat Khuzhin [Sun, 10 Jul 2022 13:31:57 +0000 (16:31 +0300)]
test: make dns/getaddrinfo_cancel_stress more deterministic

Fixes: #1271
Follow-up for: 90bcf2d660b9b43cb8e747421d4938f08f935bd7

23 months agoAdd a note that IOCP is experimental feature
Azat Khuzhin [Sun, 10 Jul 2022 13:18:08 +0000 (16:18 +0300)]
Add a note that IOCP is experimental feature

Refs: #1228

23 months agoci: drop processing "ci skip" message in commit in favor of official skip
Azat Khuzhin [Sun, 10 Jul 2022 12:47:00 +0000 (15:47 +0300)]
ci: drop processing "ci skip" message in commit in favor of official skip

Since [1] github actions official support skipping workflows based on
the message.

  [1]: https://github.blog/changelog/2021-02-08-github-actions-skip-pull-request-and-push-workflows-with-skip-ci/

23 months agoci: add ability skip specific workflow
Azat Khuzhin [Sun, 10 Jul 2022 12:10:20 +0000 (15:10 +0300)]
ci: add ability skip specific workflow

Public CI workers has pretty high load, and sometimes you need to test
only specific workflow, i.e. windows.

So let's add ability to limit which workflow should be run.

23 months agoInitial OpenSSL 3.0 support (#1288)
Azat Khuzhin [Sun, 10 Jul 2022 10:55:32 +0000 (13:55 +0300)]
Initial OpenSSL 3.0 support (#1288)

* openssl-3:
  ci: use ubuntu 22.04 with OpenSSl 3.0 instead of building OpenSSL from sources
  ci: set LD_LIBRARY_PATH for openssl 3.0 build
  test: suppress warning for already defined SSL_get_peer_certificate
  autotools: print $OPENSSL_LIBS/$OPENSSL_INCS
  Suppress -Wunused-value for BIO_set_close()
  Use OPENSSL_VERSION_NUMBER over OPENSSL_VERSION_MAJOR (for compatibility)
  Attempt to add OpenSSL 3 to the Linux build matrix
  Initial OpenSSL 3.0 support

23 months agoci: use ubuntu 22.04 with OpenSSl 3.0 instead of building OpenSSL from sources
Azat Khuzhin [Sun, 10 Jul 2022 10:11:13 +0000 (13:11 +0300)]
ci: use ubuntu 22.04 with OpenSSl 3.0 instead of building OpenSSL from sources

23 months agoci: set LD_LIBRARY_PATH for openssl 3.0 build
Azat Khuzhin [Sun, 10 Jul 2022 09:24:42 +0000 (12:24 +0300)]
ci: set LD_LIBRARY_PATH for openssl 3.0 build

Fixes:

    /home/runner/work/libevent/libevent/build/test/.libs/regress: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory

23 months agotest: suppress warning for already defined SSL_get_peer_certificate
Azat Khuzhin [Sun, 10 Jul 2022 06:59:14 +0000 (09:59 +0300)]
test: suppress warning for already defined SSL_get_peer_certificate

build report:

    [1/2] Building C object CMakeFiles/regress.dir/test/regress_mbedtls.c.o
    /src/le/libevent/test/regress_mbedtls.c:50: warning: "SSL_get_peer_certificate" redefined
       50 | #define SSL_get_peer_certificate mbedtls_ssl_get_peer_cert
          |
    In file included from /src/le/libevent/test/regress.h:139,
                     from /src/le/libevent/test/regress_mbedtls.c:35:
    /src/oss/openssl/include/openssl/ssl.h:1799: note: this is the location of the previous definition
     1799 | #   define SSL_get_peer_certificate SSL_get1_peer_certificate
          |
    [2/2] Linking C executable bin/regress

But this should be cleaned up.

23 months agoautotools: print $OPENSSL_LIBS/$OPENSSL_INCS
Azat Khuzhin [Sun, 10 Jul 2022 06:29:21 +0000 (09:29 +0300)]
autotools: print $OPENSSL_LIBS/$OPENSSL_INCS

23 months agoSuppress -Wunused-value for BIO_set_close()
Azat Khuzhin [Sun, 10 Jul 2022 06:26:16 +0000 (09:26 +0300)]
Suppress -Wunused-value for BIO_set_close()

23 months agoUse OPENSSL_VERSION_NUMBER over OPENSSL_VERSION_MAJOR (for compatibility)
Azat Khuzhin [Sat, 9 Jul 2022 20:27:23 +0000 (23:27 +0300)]
Use OPENSSL_VERSION_NUMBER over OPENSSL_VERSION_MAJOR (for compatibility)

Since OpenSSL 3.0 there is new OPENSSL_VERSION_MAJOR, but previous
releases does not have it.

So let's use plain old OPENSSL_VERSION_NUMBER to avoid more preprocessor
macros.

23 months agoAttempt to add OpenSSL 3 to the Linux build matrix
William Marlow [Sun, 19 Jun 2022 09:45:57 +0000 (10:45 +0100)]
Attempt to add OpenSSL 3 to the Linux build matrix

v2: fix echo messages
v3: fix autotools build (wrong path to pkg config)

23 months agoInitial OpenSSL 3.0 support
William Marlow [Sat, 18 Jun 2022 20:43:31 +0000 (21:43 +0100)]
Initial OpenSSL 3.0 support

* Don't use deprecated functions when building against OpenSSL 3.0.
* Recognise that OpenSSL 3.0 can signal a dirty shutdown as a protocol.
  error in addition to the expected IO error produced by OpenSSL 1.1.1
* Update regress_mbedtls.c for compatibility with OpenSSL 3

23 months agoMerge branch 'mbedtls-3'
Azat Khuzhin [Sat, 9 Jul 2022 20:22:00 +0000 (23:22 +0300)]
Merge branch 'mbedtls-3'

* mbedtls-3:
  sample/ssl-client-mbedtls.c: fix for MbedTLS 3
  sample/ssl-client-mbedtls.c: break the loop on EOF
  sample/ssl-client-mbedtls.c: fix printing response in readcb
  Initial Mbed-TLS 3 support to get the GitHub Actions working again
  Support build dir of the MbedTLS

23 months agoci/macos: remove separate openssl 1.1 from build matrix
Azat Khuzhin [Sat, 9 Jul 2022 18:17:06 +0000 (21:17 +0300)]
ci/macos: remove separate openssl 1.1 from build matrix

@ploxiln:

    On current homebrew, openssl@1.1 is the only openssl:

    [pierce@plo-mbp15 libevent]$ brew --prefix openssl
    /usr/local/opt/openssl@1.1
    [pierce@plo-mbp15 libevent]$ brew info openssl
    openssl@1.1: stable 1.1.1g (bottled) [keg-only]
    Cryptography and SSL/TLS Toolkit

@fanquake

    Indeed. OpenSSL 1.0 was removed from homebew in Homebrew/homebrew-core#46876. Related discussion also in Homebrew/homebrew-core#46454.

23 months agoMerge branch 'fix-brew-autodetection'
Azat Khuzhin [Sat, 9 Jul 2022 18:14:16 +0000 (21:14 +0300)]
Merge branch 'fix-brew-autodetection'

* fix-brew-autodetection:
  ci: fix cmake build w/o OPENSSL_ROOT_DIR
  ci: remove separate build for BREW_AUTODETECT_OPENSSL (use it by default)
  autotools: fix autodetection of openssl location via brew

23 months agosample/ssl-client-mbedtls.c: fix for MbedTLS 3
Azat Khuzhin [Sat, 9 Jul 2022 17:05:35 +0000 (20:05 +0300)]
sample/ssl-client-mbedtls.c: fix for MbedTLS 3

- use build_info.h over version.h
- provide own certs

P.S. since it is simpler then adding detection of the library version
into autotools.

23 months agosample/ssl-client-mbedtls.c: break the loop on EOF
Azat Khuzhin [Sat, 9 Jul 2022 18:07:36 +0000 (21:07 +0300)]
sample/ssl-client-mbedtls.c: break the loop on EOF

23 months agosample/ssl-client-mbedtls.c: fix printing response in readcb
Azat Khuzhin [Sat, 9 Jul 2022 18:03:36 +0000 (21:03 +0300)]
sample/ssl-client-mbedtls.c: fix printing response in readcb

23 months agoInitial Mbed-TLS 3 support to get the GitHub Actions working again
William Marlow [Thu, 23 Jun 2022 22:06:14 +0000 (23:06 +0100)]
Initial Mbed-TLS 3 support to get the GitHub Actions working again

mingw has upgraded to Mbed-TLS 3.1.0, so all the mingw tests that need
Mbed-TLS currently don't work.

v2: add missing mbedtls/version.h into test/regress_mbedtls.c
v3: suppress #warning "Including compat-2.x.h is deprecated" for mbedtls/compat-2.x.h

23 months agoSupport build dir of the MbedTLS
Azat Khuzhin [Sat, 9 Jul 2022 17:40:52 +0000 (20:40 +0300)]
Support build dir of the MbedTLS

23 months agoconfigure: fix AC_CHECK_FUNCS should use literals
Azat Khuzhin [Sat, 9 Jul 2022 17:28:18 +0000 (20:28 +0300)]
configure: fix AC_CHECK_FUNCS should use literals

Error

    configure.ac:291: warning: AC_CHECK_FUNCS(getnameinfo
    ): you should use literals
    ../autoconf-2.71/lib/autoconf/functions.m4:117: AC_CHECK_FUNCS is expanded from...
    ../autoconf-2.71/lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
    ../autoconf-2.71/lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
    configure.ac:291: the top level
    configure.ac:291: warning: AC_CHECK_FUNCS(getprotobynumber
    ): you should use literals
    ../autoconf-2.71/lib/autoconf/functions.m4:117: AC_CHECK_FUNCS is expanded from...
    ../autoconf-2.71/lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
    ../autoconf-2.71/lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
    configure.ac:291: the top level
    configure.ac:291: warning: AC_CHECK_FUNCS(getservbyname
    ): you should use literals
    ../autoconf-2.71/lib/autoconf/functions.m4:117: AC_CHECK_FUNCS is expanded from...
    ../autoconf-2.71/lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
    ../autoconf-2.71/lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
    configure.ac:291: the top level
    configure.ac:291: warning: AC_CHECK_FUNCS(inet_ntop
    ): you should use literals
    ../autoconf-2.71/lib/autoconf/functions.m4:117: AC_CHECK_FUNCS is expanded from...
    ../autoconf-2.71/lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
    ../autoconf-2.71/lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
    configure.ac:291: the top level
    configure.ac:291: warning: AC_CHECK_FUNCS(inet_pton
    ): you should use literals
    ../autoconf-2.71/lib/autoconf/functions.m4:117: AC_CHECK_FUNCS is expanded from...
    ../autoconf-2.71/lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
    ../autoconf-2.71/lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
    configure.ac:291: the top level

23 months agolistener: Preserve last error in evconnlistener_new_bind() before close
kenping [Thu, 21 Apr 2022 07:59:28 +0000 (15:59 +0800)]
listener: Preserve last error in evconnlistener_new_bind() before close

In function evconnlistener_new_bind() after go to "err:", The
evutil_closesocket() would clear the error code( I found this under
Windows ). User can not use EVUTIL_SOCKET_ERROR() to get the
evconnlistener_new_bind()'s failing error.

I add a err_code variable to store and restore the last error code.

v2: rebased by azat to make the patch simpler

23 months agoci: fix cmake build w/o OPENSSL_ROOT_DIR
Azat Khuzhin [Sat, 9 Jul 2022 15:43:29 +0000 (18:43 +0300)]
ci: fix cmake build w/o OPENSSL_ROOT_DIR

cmake build rules does not have detection of OPENSSL_ROOT_DIR via brew,
so we cannot run such builds on CI.

Always set OPENSSL_ROOT_DIR for cmake.

23 months agoci: remove separate build for BREW_AUTODETECT_OPENSSL (use it by default)
Azat Khuzhin [Sat, 9 Jul 2022 15:41:39 +0000 (18:41 +0300)]
ci: remove separate build for BREW_AUTODETECT_OPENSSL (use it by default)

23 months agoautotools: fix autodetection of openssl location via brew
Azat Khuzhin [Sat, 9 Jul 2022 15:40:35 +0000 (18:40 +0300)]
autotools: fix autodetection of openssl location via brew

23 months agoMerge branch 'Werror'
Azat Khuzhin [Sat, 9 Jul 2022 15:12:07 +0000 (18:12 +0300)]
Merge branch 'Werror'

* Werror:
  test: ignore -Walloc-size-larger-than error for calloc() returns ENOMEM
  Fix EVBASE_ACQUIRE_LOCK/EVBASE_RELEASE_LOCK for EVENT__DISABLE_THREAD_SUPPORT
  http: suppress "flags may be used uninitialized in this function" error
  Detech -Wno-unused-functions for GCC too
  cmake: add compiler version to the status message
  Fix BEV_LOCK/BEV_UNLOCK macros for EVENT__DISABLE_THREAD_SUPPORT
  Run builds with -Werror on CI for linux
  Fix -Werror for autotools
  Add -Wundef for cmake and fix EVENT__SIZEOF_TIME_T usage

23 months agotest: ignore -Walloc-size-larger-than error for calloc() returns ENOMEM
Azat Khuzhin [Sat, 9 Jul 2022 14:14:12 +0000 (17:14 +0300)]
test: ignore -Walloc-size-larger-than error for calloc() returns ENOMEM

Compiler report:

    /home/runner/work/libevent/libevent/test/regress_util.c: In function ‘test_event_calloc’:
    /home/runner/work/libevent/libevent/test/regress_util.c:1318:4: error: argument 2 value ‘9223372036854775815’ exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=]
      p = mm_calloc(EV_SIZE_MAX/2, EV_SIZE_MAX/2 + 8);
    In file included from /home/runner/work/libevent/libevent/test/../util-internal.h:37:0,
                     from /home/runner/work/libevent/libevent/test/regress_util.c:30:
    /usr/include/stdlib.h:541:14: note: in a call to allocation function ‘calloc’ declared here
     extern void *calloc (size_t __nmemb, size_t __size)

v2: clang on CI does not have this option

23 months agoFix EVBASE_ACQUIRE_LOCK/EVBASE_RELEASE_LOCK for EVENT__DISABLE_THREAD_SUPPORT
Azat Khuzhin [Sat, 9 Jul 2022 14:20:26 +0000 (17:20 +0300)]
Fix EVBASE_ACQUIRE_LOCK/EVBASE_RELEASE_LOCK for EVENT__DISABLE_THREAD_SUPPORT

23 months agohttp: suppress "flags may be used uninitialized in this function" error
Azat Khuzhin [Sat, 9 Jul 2022 14:17:38 +0000 (17:17 +0300)]
http: suppress "flags may be used uninitialized in this function" error

Some GCC reports [1]:

    /home/runner/work/libevent/libevent/http.c: In function ‘evhttp_make_header’:
    /home/runner/work/libevent/libevent/http.c:503:14: error: ‘flags’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      ev_uint16_t flags;
                  ^~~~~
    /home/runner/work/libevent/libevent/http.c: In function ‘evhttp_get_body’:
    /home/runner/work/libevent/libevent/http.c:2354:14: error: ‘flags’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      ev_uint16_t flags;
                  ^~~~~
  [1]: https://github.com/libevent/libevent/runs/7263518338?check_suite_focus=true#logs

23 months agoDetech -Wno-unused-functions for GCC too
Azat Khuzhin [Sat, 9 Jul 2022 14:08:21 +0000 (17:08 +0300)]
Detech -Wno-unused-functions for GCC too

Otherwise build fails [1]:

    /home/runner/work/libevent/libevent/dist/libevent-2.2.0-alpha-dev/minheap-internal.h:64:6: error: ‘min_heap_ctor_’ defined but not used [-Werror=unused-function]
     void min_heap_ctor_(min_heap_t* s) { s->p = 0; s->n = 0; s->a = 0; }
          ^~~~~~~~~~~~~~
    In file included from /home/runner/work/libevent/libevent/dist/libevent-2.2.0-alpha-dev/buffer.c:91:0:
    /home/runner/work/libevent/libevent/dist/libevent-2.2.0-alpha-dev/bufferevent-internal.h:414:1: error: ‘bufferevent_trigger_nolock_’ defined but not used [-Werror=unused-function]
     bufferevent_trigger_nolock_(struct bufferevent *bufev, short iotype, int options)
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from /home/runner/work/libevent/libevent/dist/libevent-2.2.0-alpha-dev/buffer.c:89:0:
    /home/runner/work/libevent/libevent/dist/libevent-2.2.0-alpha-dev/evthread-internal.h:140:1: error: ‘EVLOCK_TRY_LOCK_’ defined but not used [-Werror=unused-function]
     EVLOCK_TRY_LOCK_(void *lock)

  [1]: https://github.com/libevent/libevent/runs/7263518180?check_suite_focus=true

23 months agocmake: add compiler version to the status message
Azat Khuzhin [Sat, 9 Jul 2022 12:45:34 +0000 (15:45 +0300)]
cmake: add compiler version to the status message

23 months agoFix BEV_LOCK/BEV_UNLOCK macros for EVENT__DISABLE_THREAD_SUPPORT
Azat Khuzhin [Sat, 9 Jul 2022 12:38:56 +0000 (15:38 +0300)]
Fix BEV_LOCK/BEV_UNLOCK macros for EVENT__DISABLE_THREAD_SUPPORT

23 months agoRun builds with -Werror on CI for linux
Azat Khuzhin [Sat, 9 Jul 2022 11:47:12 +0000 (14:47 +0300)]
Run builds with -Werror on CI for linux

23 months agoFix -Werror for autotools
Azat Khuzhin [Sat, 9 Jul 2022 11:43:39 +0000 (14:43 +0300)]
Fix -Werror for autotools

23 months agoAdd -Wundef for cmake and fix EVENT__SIZEOF_TIME_T usage
Azat Khuzhin [Sat, 9 Jul 2022 11:22:38 +0000 (14:22 +0300)]
Add -Wundef for cmake and fix EVENT__SIZEOF_TIME_T usage

Note, autotools already supports it.

23 months agohttps-client: fix strndup() for mingw build
Azat Khuzhin [Sat, 9 Jul 2022 11:13:57 +0000 (14:13 +0300)]
https-client: fix strndup() for mingw build

Right now it still reports [1]:

    2022-07-09T10:53:05.4152800Z ../sample/https-client.c:558:43: warning: implicit declaration of function 'strndup' [-Wimplicit-function-declaration]
    2022-07-09T10:53:05.4153300Z   558 |                         char *host_ipv6 = strndup(&host[1], strlen(&host[1]) - 1);
    2022-07-09T10:53:05.4153651Z       |                                           ^~~~~~~
    2022-07-09T10:53:05.4154095Z ../sample/https-client.c:558:43: warning: incompatible implicit declaration of built-in function 'strndup' [-Wbuiltin-declaration-

  [1]: https://github.com/libevent/libevent/runs/7263194178?check_suite_focus=true

23 months agoFix some OpenSSL 3 test issues (#1291)
Azat Khuzhin [Sat, 9 Jul 2022 10:35:54 +0000 (13:35 +0300)]
Fix some OpenSSL 3 test issues (#1291)

These are updates to help with OpenSSL 3 compilation. I found
https://github.com/libevent/libevent/pull/1288 after I started this, but
these seem independent, and fix a different set of problems:

- First off, OpenSSL 3 does not by default allow signing with SHA1
  digests - moving this to SHA256 universally at this point seems a
  better idea than continuing to use the insecure SHA1 for older OpenSSL
  versions. This fixes X509_sign failing in regress_openssl for a number
  of tests, eg:

  ```
   regress: http/https_openssl_basic:
    FAIL ../test/regress_openssl.c:106: assert(0 != X509_sign(x509, key, EVP_sha1()))[Lost connection!] http/https_openssl_filter_basic:
    FAIL ../test/regress_openssl.c:106: assert(0 != X509_sign(x509, key, EVP_sha1()))[Lost connection!] http/https_openssl_simple:
  ...
  ```

- Secondly, when using TLS 1.3, there's no support for renegotiation, so
  for the renegotiation tests, we need to disable TLS v1.3, and expect
  to negotiate TLS 1.1 or 1.2

Fixes: #661
* upstream/pr/1291:
  OpenSSL 3 fixes: Disable TLS 1.3 when testing renegotiation support
  OpenSSL 3 fixes: use SHA256 instead of SHA1

23 months agoAdd missing strndup function on Windows to fix build on MSVC 2022
William Marlow [Sat, 18 Jun 2022 20:43:31 +0000 (21:43 +0100)]
Add missing strndup function on Windows to fix build on MSVC 2022

v2: Only define strndup on non-Mingw32 Windows

23 months agobuild: only try silence options if they exist
fanquake [Thu, 23 Jun 2022 12:38:14 +0000 (13:38 +0100)]
build: only try silence options if they exist

Otherwise GCC will warn. i.e:
```bash
  CCLD     libevent_openssl.la
cc1: note: unrecognized command-line option ‘-Wno-void-pointer-to-enum-cast’
may have been intended to silence earlier diagnostics
  CCLD     libevent_mbedtls.la
```

23 months agoOpenSSL 3 fixes: Disable TLS 1.3 when testing renegotiation support
Peter Edwards [Mon, 27 Jun 2022 21:41:47 +0000 (22:41 +0100)]
OpenSSL 3 fixes: Disable TLS 1.3 when testing renegotiation support

TLS 1.3 does not support renegotation - it has been removed from the
protocol. Disable TLS 1.3 when testing this, so we negotiate an older
protocol version

23 months agoOpenSSL 3 fixes: use SHA256 instead of SHA1
Peter Edwards [Mon, 27 Jun 2022 21:00:05 +0000 (22:00 +0100)]
OpenSSL 3 fixes: use SHA256 instead of SHA1

OpenSSL 3.x does not support signing certificates with SHA1 by default.
Use SHA256 instead.

23 months agoFix some typos (#1284)
cui fliter [Sun, 12 Jun 2022 20:58:50 +0000 (04:58 +0800)]
Fix some typos (#1284)

Signed-off-by: cuishuang <imcusg@gmail.com>
2 years agohttps-client: fix connect to ipv6 address with square brackets
Azat Khuzhin [Thu, 12 May 2022 04:37:19 +0000 (07:37 +0300)]
https-client: fix connect to ipv6 address with square brackets

getaddrinfo() cannot process addresses like "[::1]", only "::1"

Fixes: #1275
2 years agofix grammar in comment
zhongzedu [Mon, 9 May 2022 08:33:36 +0000 (16:33 +0800)]
fix grammar in comment

2 years agoinclude/event.h: include <event2/util.h> over deprecatd <evutil.h>
Syedh30 [Fri, 29 Apr 2022 14:10:29 +0000 (19:40 +0530)]
include/event.h: include <event2/util.h> over deprecatd <evutil.h>

Fixes: #1263
2 years agoFix mingw pipeline (by using correct PATH to msys64)
Igor Klemenski [Wed, 6 Apr 2022 21:35:00 +0000 (14:35 -0700)]
Fix mingw pipeline (by using correct PATH to msys64)

I found the correct path by looking at the _Disable Key Refresh_ step in
_mingw::autotools::set up msys2_ task
(https://github.com/rectified95/libevent/runs/5858227589?check_suite_focus=true)

    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe "((Get-Content -path **D:\a\_temp\msys64**\etc\post-install\07-pacman-key.post -Raw) ...

2 years agoFix windows pipeline (by updating vcpkg version to latest)
Igor Klemenski [Wed, 6 Apr 2022 20:44:27 +0000 (13:44 -0700)]
Fix windows pipeline (by updating vcpkg version to latest)

The Windows CI is failing at the prepare vcpkg step while installing zlib
Changing the vcpkg commit hash to point to latest release
https://github.com/microsoft/vcpkg/releases/tag/2022.03.10 as opposed to
sometime in 2019 to see if that fixes it.

2 years agoRequire libevent_core not libevent for pkg-config
moonlightsh [Thu, 10 Mar 2022 20:58:36 +0000 (23:58 +0300)]
Require libevent_core not libevent for pkg-config

libevent library itself had been deprecated long time ago.

Fixes: #1213
2 years agoDo not install RPATH for install tree by default
Azat Khuzhin [Thu, 10 Mar 2022 20:11:14 +0000 (23:11 +0300)]
Do not install RPATH for install tree by default

In ce8be2385b5fee16859a630fca0c98ad290c8e21 ("cmake: set rpath for
libraries on linux") RPATH was first instroduced.

Later in 6d09efe8686de824adf3d8810bbe0d5c386643e4 ("Set RPATH only if
installation is done into non system directory") it was set only if it
was installed to non system directory.

But absolute RPATH not a good default, let's change this.

Fixes: #920
2 years agoFix build w/o OpenSSL by w/ MbedTLS
Jay Freeman (saurik) [Sat, 12 Feb 2022 19:53:11 +0000 (22:53 +0300)]
Fix build w/o OpenSSL by w/ MbedTLS

In 78fa3971be892194aa168c04fc34bf5f2cd99b99 from
https://github.com/libevent/libevent/pull/1241#commitcomment-63865496 a
new "if MBEDTLS" block was added to include/include.am. This is not
parsed by automake as it isn't on the first column, resulting in a
subsequent error in the build.

From [1]:

> The if, else, and endif statements should not be indented, i.e., start on column one.

  [1]: https://www.gnu.org/software/automake/manual/html_node/Usage-of-Conditionals.html

Fixes: #1251
Fixes: google/oss-fuzz#7149
2 years agoSet RPATH only if installation is done into non system directory
Azat Khuzhin [Sat, 15 Jan 2022 19:06:58 +0000 (22:06 +0300)]
Set RPATH only if installation is done into non system directory

v2: use CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES

Fixes: #1245
2 years agoFix make install failed when Automake used and both OpenSSL and MbedTLS are activated
Dmitry Ilyin [Sat, 15 Jan 2022 05:30:26 +0000 (08:30 +0300)]
Fix make install failed when Automake used and both OpenSSL and MbedTLS are activated

Issue:
https://github.com/libevent/libevent/pull/1241#commitcomment-63865496

2 years agoregress_ssl: Use intptr_t when shoving an int into a void *
Jessica Clarke [Tue, 21 Dec 2021 13:15:58 +0000 (13:15 +0000)]
regress_ssl: Use intptr_t when shoving an int into a void *

Currently the code uses long, but long does not always have the same
representation as a pointer, such as on 64-bit Windows where long is
only 32-bit due to its unususal LLP64 ABI, but also on CHERI, and thus
Arm's prototype Morello architecture, where C language pointers are
represented as hardware capabilities, which have bounds, permissions and
other metadata to enforce spatial memory safety. Both of these cases
warn when casting a long to a pointer (Windows due to long being shorter
and thus it being likely you've truncated the address, and CHERI due to
long not having any capability metadata like pointers and thus it being
likely you've stripped the metadata, with the resulting "null-derived"
capability destined to trap if dereferenced), and in both cases casting
to intptr_t as the intermediate type instead will get rid of those
warnings.

2 years agotest: fix leak in http/cancel_*server_timeout tests
Azat Khuzhin [Tue, 21 Dec 2021 05:47:00 +0000 (08:47 +0300)]
test: fix leak in http/cancel_*server_timeout tests

Fixes: #1242
2 years agoInstall bufferevent_ssl.h with MbedTLS support also
Dmitry Ilyin [Wed, 15 Dec 2021 18:27:21 +0000 (21:27 +0300)]
Install bufferevent_ssl.h with MbedTLS support also

2 years agofeat: add `evdns_base_get_nameserver_fd` method
Yongsheng Xu [Fri, 10 Dec 2021 03:05:13 +0000 (11:05 +0800)]
feat: add `evdns_base_get_nameserver_fd` method

To get underlying udp socket fd.

2 years agoFix deadlock in case of evconnlistener_disable() in parallel with callback
moonlightsh [Wed, 17 Nov 2021 00:40:40 +0000 (08:40 +0800)]
Fix deadlock in case of evconnlistener_disable() in parallel with callback

I've got an issue when stop evconnlistener not in the event_base_loop()
thread. evconnlistener_disable() acquired lev->lock, if the same time,
user callbacks is runing, the event thread released lock, after callback
finished, it try to aquire the lock again, I think this makes conflict:

Here is backtraces:

thread 1:
    0  __lll_lock_wait (futex=futex@entry=0x555555559a60, private=0) at lowlevellock.c:52
    1  0x00007ffff7f2a131 in __GI___pthread_mutex_lock (mutex=0x555555559a60) at ../nptl/pthread_mutex_lock.c:115
    2  0x00007ffff7f424c9 in evthread_posix_lock (mode=0, lock_=0x555555559a60) at evthread_pthread.c:79
    3  0x00007ffff7f7dc12 in listener_read_cb (fd=7, what=2, p=0x5555555599a0) at listener.c:439
    4  0x00007ffff7f6d758 in event_persist_closure (base=0x555555559370, ev=0x5555555599d8) at event.c:1645
    5  0x00007ffff7f6da60 in event_process_active_single_queue (base=0x555555559370, activeq=0x5555555597e0,
       max_to_process=2147483647, endtime=0x0) at event.c:1704
    6  0x00007ffff7f6e018 in event_process_active (base=0x555555559370) at event.c:1805
    7  0x00007ffff7f6e92a in event_base_loop (base=0x555555559370, flags=0) at event.c:2047
    8  0x0000555555555449 in main () at test_listen.c:67

thread 2:
    0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x555555559858) at ../sysdeps/nptl/futex-internal.h:183
    1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x555555559800, cond=0x555555559830) at pthread_cond_wait.c:508
    2  __pthread_cond_wait (cond=0x555555559830, mutex=0x555555559800) at pthread_cond_wait.c:638
    3  0x00007ffff7f426f3 in evthread_posix_cond_wait (cond_=0x555555559830, lock_=0x555555559800, tv=0x0) at evthread_pthread.c:162
    4  0x00007ffff7f70bc5 in event_del_nolock_ (ev=0x5555555599d8, blocking=2) at event.c:2934
    5  0x00007ffff7f70748 in event_del_ (ev=0x5555555599d8, blocking=2) at event.c:2821
    6  0x00007ffff7f707a1 in event_del (ev=0x5555555599d8) at event.c:2830
    7  0x00007ffff7f7d76e in event_listener_disable (lev=0x5555555599a0) at listener.c:343
    8  0x00007ffff7f7d6e5 in evconnlistener_disable (lev=0x5555555599a0) at listener.c:325
    9  0x00005555555552c3 in disable_thread (arg=0x5555555599a0) at test_listen.c:27
    10 0x00007ffff7f27609 in start_thread (arg=<optimized out>) at pthread_create.c:477
    11 0x00007ffff7e4e293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

2 years agoSwitch coverage to ubuntu 18.04
Azat Khuzhin [Thu, 2 Dec 2021 07:27:16 +0000 (10:27 +0300)]
Switch coverage to ubuntu 18.04

It seems that there is no 16.04 image anymore, since github actions was
not able to find it for 24 hours [1].

  [1]: https://github.com/libevent/libevent/actions/runs/1522612189

2 years agobuild: use modern ax_pthread macro
fanquake [Wed, 24 Nov 2021 00:44:03 +0000 (08:44 +0800)]
build: use modern ax_pthread macro

acx_pthread became ax_pthread in 2009 and the macro has seen lots of updates
since then. This change switches to using the latest version.

2 years agoRevert "evdns: do not check server_req twice"
Azat Khuzhin [Tue, 30 Nov 2021 19:41:05 +0000 (22:41 +0300)]
Revert "evdns: do not check server_req twice"

That was wrong assumption.

This reverts commit 991f0ed3d86ffca0c017ab83cd239289912bdaad.

Fixes: #1231
2 years agoci: remove deprecated windows-2016 image
Azat Khuzhin [Tue, 30 Nov 2021 19:37:32 +0000 (22:37 +0300)]
ci: remove deprecated windows-2016 image

Refs: https://github.blog/changelog/2021-10-19-github-actions-the-windows-2016-runner-image-will-be-removed-from-github-hosted-runners-on-march-15-2022

2 years agoDon't define BIO_get_init() for LibreSSL 3.5+
Theo Buehler [Sun, 21 Nov 2021 20:38:20 +0000 (21:38 +0100)]
Don't define BIO_get_init() for LibreSSL 3.5+

BIO_get_init() is available in LibreSSL 3.5 and later. The BIO type
will become opaque, so the existing macro will break the build.

2 years agoMerge #1230 -- build: remove inconsistently used x-prefix comparisons
Azat Khuzhin [Tue, 30 Nov 2021 19:22:43 +0000 (22:22 +0300)]
Merge #1230 -- build: remove inconsistently used x-prefix comparisons

* upstream/pr/1230:
  build: fix typos in ax_check_funcs_ex.m4
  build: remove inconsistently used x-prefix comparisons

2 years agobuild: fix typos in ax_check_funcs_ex.m4
fanquake [Wed, 24 Nov 2021 06:44:48 +0000 (14:44 +0800)]
build: fix typos in ax_check_funcs_ex.m4

2 years agobuild: remove inconsistently used x-prefix comparisons
fanquake [Wed, 24 Nov 2021 06:41:33 +0000 (14:41 +0800)]
build: remove inconsistently used x-prefix comparisons

Given that these are already used inconsistently with `test` checks, it
makes sense to consolidate to not use the x-prefix comparisons at all.
In any case, it would be nice to think we no longer have to work around
a problem that existed in shells many, many years ago.

More info:
https://github.com/koalaman/shellcheck/wiki/SC2268
https://www.vidarholen.net/contents/blog/?p=1035

2 years agoFix comment for evdns_base_new()
Azat Khuzhin [Sun, 21 Nov 2021 21:05:27 +0000 (00:05 +0300)]
Fix comment for evdns_base_new()

2 years agoCheckWorkingKqueue.cmake: fix missing headers
Christopher Chavez [Fri, 12 Nov 2021 02:12:14 +0000 (20:12 -0600)]
CheckWorkingKqueue.cmake: fix missing headers

Avoid implicitly declaring functions memset() and exit()
as it is considered an error by some compilers
(e.g. Xcode clang 12 and later)

2 years agoevutil: Fix evutil_freeaddrinfo
Tomas Gonzalez [Mon, 1 Nov 2021 17:01:06 +0000 (10:01 -0700)]
evutil: Fix evutil_freeaddrinfo

During testing on win32, util/getaddrinfo failed with NULL hint info

     r = evutil_getaddrinfo("www.google.com", NULL, NULL, &ai);

throwing a critical heap exception when evutil_freeaddrinfo is called.
This is because of improper use of freeaddrinfo when nodes within the
ai structure are allocated using mm_malloc or mm_calloc
(EVUTIL_AI_LIBEVENT_ALLOCATED)

This adds the flag in apply_socktype_protocol_hack and walks the linked
list in evutil_freeaddrinfo removing linked list nodes that are custom
allocated before calling freeaddrinfo.

2 years agotest: retriable tests are marked failed only when all attempts have failed
Thomas Perrot [Wed, 29 Sep 2021 11:50:35 +0000 (13:50 +0200)]
test: retriable tests are marked failed only when all attempts have failed

Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com>
2 years agogithub/workflows/macos.yml: fix test step name
Azat Khuzhin [Sun, 19 Sep 2021 12:52:02 +0000 (15:52 +0300)]
github/workflows/macos.yml: fix test step name

2 years agoMerge branch 'skip-tests' -- fix/skip some tests to avoid complete check failures
Azat Khuzhin [Sun, 19 Sep 2021 12:59:57 +0000 (15:59 +0300)]
Merge branch 'skip-tests' -- fix/skip some tests to avoid complete check failures

* skip-tests:
  test: add --retries-delay (and set to 1 second by default)
  test: add --retries argument
  Add -Wno-void-pointer-to-enum-cast (we use this hack in tests)
  test/regress_http: mark data_length_constraints as retriable
  github/workflows/mingw: use ctest --output-on-failure
  test/dns: mark TCP tests as retriable
  test/regress: retry some signal rlated tests in darwin
  test/regress_util: mark monotonic_prc as retriable
  test/regress_http: fix unix_socket test
  test/regress_http: disable max_connections/data_length_constraints under windows
  Add EV_WINDOWS macro

2 years agotest: add --retries-delay (and set to 1 second by default)
Azat Khuzhin [Sun, 19 Sep 2021 10:18:40 +0000 (13:18 +0300)]
test: add --retries-delay (and set to 1 second by default)

In attemp to address failures of dns/tcp_* tests under windows [1].

  [1]: https://github.com/azat/libevent/runs/3644218468?check_suite_focus=true

2 years agotest: add --retries argument
Azat Khuzhin [Sun, 19 Sep 2021 10:15:02 +0000 (13:15 +0300)]
test: add --retries argument

2 years agoAdd -Wno-void-pointer-to-enum-cast (we use this hack in tests)
Azat Khuzhin [Sun, 19 Sep 2021 10:36:15 +0000 (13:36 +0300)]
Add -Wno-void-pointer-to-enum-cast (we use this hack in tests)

Refs: https://reviews.llvm.org/D75758

2 years agotest/regress_http: mark data_length_constraints as retriable
Azat Khuzhin [Sun, 19 Sep 2021 09:56:24 +0000 (12:56 +0300)]
test/regress_http: mark data_length_constraints as retriable

CI: https://github.com/libevent/libevent/runs/3643914024?check_suite_focus=true

2 years agogithub/workflows/mingw: use ctest --output-on-failure
Azat Khuzhin [Sun, 19 Sep 2021 09:33:44 +0000 (12:33 +0300)]
github/workflows/mingw: use ctest --output-on-failure

Otherwise it is hard to understand the problem [1].

  [1]: https://github.com/azat/libevent/runs/3643912284

2 years agotest/dns: mark TCP tests as retriable
Azat Khuzhin [Sun, 19 Sep 2021 09:24:50 +0000 (12:24 +0300)]
test/dns: mark TCP tests as retriable

CI: https://github.com/azat/libevent/runs/3643912296 # tcp_resolve_many_clients
CI: https://github.com/azat/libevent/runs/3643912192 # tcp_timeout
CI: https://github.com/azat/libevent/runs/3643912336 # tcp_resolve
CI: https://github.com/azat/libevent/runs/3643912174 # tcp_resolve_pipeline

2 years agotest/regress: retry some signal rlated tests in darwin
Azat Khuzhin [Sun, 19 Sep 2021 09:23:48 +0000 (12:23 +0300)]
test/regress: retry some signal rlated tests in darwin

CI: https://github.com/azat/libevent/runs/3643912290 # simplestsignal
CI: https://github.com/azat/libevent/runs/3643912296 # simplesignal
CI: https://github.com/azat/libevent/runs/3643912228 # multiplesignal

2 years agotest/regress_util: mark monotonic_prc as retriable
Azat Khuzhin [Sun, 19 Sep 2021 09:21:39 +0000 (12:21 +0300)]
test/regress_util: mark monotonic_prc as retriable

CI: https://github.com/azat/libevent/runs/3643966877

2 years agotest/regress_http: fix unix_socket test
Azat Khuzhin [Sun, 19 Sep 2021 08:07:55 +0000 (11:07 +0300)]
test/regress_http: fix unix_socket test

2 years agotest/regress_http: disable max_connections/data_length_constraints under windows
Azat Khuzhin [Sun, 19 Sep 2021 07:54:27 +0000 (10:54 +0300)]
test/regress_http: disable max_connections/data_length_constraints under windows

CI: https://github.com/libevent/libevent/runs/3643554394

2 years agoAdd EV_WINDOWS macro
Azat Khuzhin [Sun, 19 Sep 2021 07:54:08 +0000 (10:54 +0300)]
Add EV_WINDOWS macro

2 years agoci: split build and test into separate jobs
Azat Khuzhin [Tue, 10 Aug 2021 19:04:43 +0000 (22:04 +0300)]
ci: split build and test into separate jobs

2 years agotest: cleanup stalled socket after running http/unix_sock
Azat Khuzhin [Sat, 18 Sep 2021 22:47:42 +0000 (01:47 +0300)]
test: cleanup stalled socket after running http/unix_sock

Otherwise it breaks upload-artifacts:

    Run actions/upload-artifact@v1
    Uploading artifact 'ubuntu-18.04-cmake-NONE-build' from '/home/runner/work/libevent/libevent/build' for run #346
    Uploading 1095 files
    File error 'No such device or address' when uploading file '/home/runner/work/libevent/libevent/build/foo'.
    ...
    Error: No such device or address
    Error: Exit code 1 returned from process: file name '/home/runner/runners/2.282.1/bin/Runner.PluginHost', arguments 'action "GitHub.Runner.Plugins.Artifact.PublishArtifact, Runner.Plugins"'.