4966 Commits

Author SHA1 Message Date
hunterx008
0428771acb Remove redundant condition in function:event_base_once 2024-05-04 12:39:38 +03:00
Cœur
eec47a6710
Fix typos (#1634) 2024-04-30 09:59:58 +02:00
icy17
64decd48e2
Fix potential Null pointer dereference in dns-example.c (#1601) 2024-04-29 07:51:22 +02:00
icy17
a584efaa0e Fix potential Null pointer dereference in time-test.c 2024-04-29 08:47:25 +03:00
Andy Pan
aef201a9fc
Change ident for EVFILT_USER to 0 and add a test (#1582)
Conventionally, ident for EVFILT_USER is set to 0 to avoid
collision of file descriptors, which is what other renowned
networking frameworks like netty(java), mio(rust), gnet(go),
swift-nio(swift), etc. do currently.

Co-authored-by: Azat Khuzhin <azat@libevent.org>
2024-04-29 07:35:33 +02:00
Andy Pan
cbbf209c08
Support SO_REUSEPORT on FreeBSD, DragonFly and Solaris (#1624)
## References

- [The SO_REUSEPORT socket option on Linux](https://lwn.net/Articles/542629/)
- [DragonFly Release 3.6](https://www.dragonflybsd.org/release36/)
- [FreeBSD 12.0-RELEASE Release Notes](https://www.freebsd.org/releases/12.0R/relnotes/)
- [SO_REUSEPORT on Solaris 11.4](https://docs.oracle.com/cd/E88353_01/html/E37843/setsockopt-3c.html)

Co-authored-by: Azat Khuzhin <azat@libevent.org>
2024-04-29 07:31:34 +02:00
Cœur
a942694155 Fix CMake Deprecation Warning 2024-04-29 08:17:43 +03:00
Cœur
73c0349ed4
Fix evutil_parse_sockaddr_port documentation (#1628)
In some IDE like Xcode, the list is interpreted as markdown instead of plain text
2024-04-29 07:16:58 +02:00
Hennadii Stepanov
71d41cdf37 build: Add Iphlpapi to Libs.private in *.pc files on Windows
It has been required since https://github.com/libevent/libevent/pull/923
at least for the `if_nametoindex` call.
2024-04-25 09:44:01 +02:00
Emil Engler
1e6c0e726b Do not set TCP keepalive on Unix sockets
This commit disables the property of TCP keepalive on Unix domain
sockets, because they essentially serve no purpose here, except for
causing problems on Windows and macOS systems.

Fixes #1615
2024-04-24 09:28:32 +02:00
dockercui
147298a2d1 Fix some comments
Signed-off-by: dockercui <dockercui@aliyun.com>
2024-04-24 08:27:12 +02:00
Andy Pan
6074d55822 Avoid calling read(2) on eventfd on each event-loop wakeup
Register the eventfd with EPOLLET to enable edge-triggered notification
where we don't need to read the data from the eventfd for every wakeup
event.

When the eventfd counter reaches the maximum value of the unsigned 64-bit,
we rewind the counter and retry again. This optimization saves one system
call on each event-loop wakeup, which eliminates the extra latency for epoll
as the EVFILT_USER filter does for the kqueue.
2024-04-20 13:16:17 +03:00
dependabot[bot]
e0a4574ba2 Bump the github-actions group with 5 updates
Bumps the github-actions group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [actions/cache](https://github.com/actions/cache) | `3` | `4` |
| [nick-fields/retry](https://github.com/nick-fields/retry) | `2` | `3` |
| [coverallsapp/github-action](https://github.com/coverallsapp/github-action) | `1.2.5` | `2.2.3` |
| [ossf/scorecard-action](https://github.com/ossf/scorecard-action) | `2.1.2` | `2.3.1` |
| [github/codeql-action](https://github.com/github/codeql-action) | `2.2.4` | `3.24.10` |


Updates `actions/cache` from 3 to 4
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v3...v4)

Updates `nick-fields/retry` from 2 to 3
- [Release notes](https://github.com/nick-fields/retry/releases)
- [Changelog](https://github.com/nick-fields/retry/blob/master/.releaserc.js)
- [Commits](https://github.com/nick-fields/retry/compare/v2...v3)

Updates `coverallsapp/github-action` from 1.2.5 to 2.2.3
- [Release notes](https://github.com/coverallsapp/github-action/releases)
- [Upgrade guide](https://github.com/coverallsapp/github-action/blob/main/UPGRADE.md)
- [Commits](09b709cf6a...3dfc556739)

Updates `ossf/scorecard-action` from 2.1.2 to 2.3.1
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](e38b1902ae...0864cf1902)

Updates `github/codeql-action` from 2.2.4 to 3.24.10
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](17573ee1cc...4355270be1)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: nick-fields/retry
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: coverallsapp/github-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-17 09:39:14 +03:00
Diogo Teles Sant'Anna
80e25c02ff Enable dependabot for github actions 2024-04-15 10:40:35 +03:00
Diogo Teles Sant'Anna
a4ec4cbe51 Hashpin workflows that use sensitive permisisons 2024-04-15 10:40:35 +03:00
williammuji
9de85b5834 fix WSOptions enum value and extended payload length bug 2024-04-15 10:31:04 +03:00
icy17
6e390911d0 Fix potential Null pointer dereference in regress_buffer.c 2024-04-15 10:26:46 +03:00
icy17
74217832a8 Fix potential Null pointer dereference in regress.c 2024-04-15 10:26:11 +03:00
icy17
d6e8835256 Fix potential Null pointer dereference in regress_et.c 2024-04-15 10:17:08 +03:00
icy17
d45dca4373 Fix potential Null pointer dereference in regress_thread.c 2024-04-15 10:16:26 +03:00
icy17
2bdf17370c Fix potential Null pointer dereference in regress_finalize.c 2024-04-15 10:08:00 +03:00
icy17
17796a2d8a Fix potential Null pointer dereference in regress_http.c 2024-04-15 10:06:42 +03:00
icy17
f9526e13ce Fix potential NULL pointer dereference in regress_bufferevent.c 2024-04-15 10:05:32 +03:00
icy17
fc48803db4
Fix potential Null pointer dereference in regress_zlib.c (#1597)
Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
2024-04-15 10:02:27 +03:00
emma-coronado
c6e8f17541 Edit logo path to match new website directory 2024-04-08 07:08:49 +02:00
Liu Dongmiao
39073df831 evutil: don't call memset before memcpy
In `evutil_parse_sockaddr_port`, it would `memset` the `out` to zero,
however, the `memset` is unnecessary before `memcpy`, and may cause
undefined behavior if the `outlen` is invalid.

This should close #1573.
2024-03-31 18:32:36 +02:00
neil
4fd07f0ee8
Upgrade vmactions to use linux runners (#1570)
Co-authored-by: neil <neilgit@neilpang.com>
2024-03-12 21:56:35 +01:00
Azat Khuzhin
539f73e319 Fix leak in evbuffer_add_file() on empty files
Found by oss-fuzz, after coverage had been improved in google/oss-fuzz#11257
v2: adjust test
v3: fix for windows (_get_osfhandle() crashes when called on closed fd)
v4: fix for EVENT__DISABLE_MM_REPLACEMENT
2024-03-12 09:29:47 +01:00
Azat Khuzhin
b9e1fe74e7 ci: disable netbsd and freebsd due to lack of runners
For example for openbsd-cmake-job (7.2, NONE)

    This request was automatically failed because there were no enabled runners online to process the request for more than 1 days.

And maybe this will fix the macos builds.
2024-03-11 21:00:18 +01:00
Andy Pan
0054b9aadb
Enable the full TCP KeepAlive mechanism on Windows (#1568)
#1532 implemented the full support of TCP Keep-Alives on UNIX-like OS's while leaving a `TODO` for Windows. This PR intends to resolve that `TODO`.

## References
 
- [SIO_KEEPALIVE_VALS Control Code](https://learn.microsoft.com/en-us/windows/win32/winsock/sio-keepalive-vals)
- [IPPROTO_TCP socket options](https://learn.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options)
- [TCP_KEEPINVTL and TCP_KEEPIDLE - Socket Keep Alives not working](https://cygwin.com/pipermail/cygwin/2020-June/245436.html)
- [Cygwin: tcp: Support TCP_KEEPIDLE, TCP_KEEPCNT, TCP_KEEPINTVL](https://sourceware.org/pipermail/cygwin-cvs/2020q3/014473.html)
- [Add cross-platform support for keep-alive socket options](https://github.com/dotnet/corefx/pull/29963/files)
2024-03-11 10:12:14 +01:00
tgolang
9c8860ec6c chore: remove repetitive words
Signed-off-by: tgolang <seekseat@aliyun.com>
2024-03-11 09:18:25 +01:00
Andy Pan
e66df92cfc
Accept SOCK_NONBLOCK/SOCK_CLOEXEC in type argument of socketpair (#1567)
Setting `SOCK_NONBLOCK` and `SOCK_CLOEXEC` in the `type` argument of `socketpair()` is widely supported across UNIX-like OS: Linux, *BSD, Solaris, etc., as is the `socket()`. This will conserve several extra system calls, we should use it where available.

### References

- [socketpair(2) on Linux](https://man7.org/linux/man-pages/man2/socketpair.2.html#HISTORY)
- [socketpair(2) on FreeBSD](https://man.freebsd.org/cgi/man.cgi?query=socketpair&sektion=2#DESCRIPTION)
- [socketpair(2) on DragonFly](https://man.dragonflybsd.org/?command=socketpair&section=2)
- [socketpair(2) on NetBSD](https://man.netbsd.org/socketpair.2#DESCRIPTION)
- [socketpair(2) on OpenBSD](https://man.openbsd.org/socketpair.2)
- [socketpair(3C) on Solaris](https://docs.oracle.com/cd/E88353_01/html/E37843/socketpair-3c.html)

Changelog:
- Set SOCK_NONBLOCK and SOCK_CLOEXEC in the type argument of socketpair
- Avoid EPROTOTYPE on macOS and OpenBSD
- Eliminate the warnings about unused variables
- Add some comments
2024-03-07 09:19:11 +01:00
Azat Khuzhin
f2b3ce6b55
Merge pull request #1558 from azat/ratelimit-fixes
Fix few issues found by oss-fuzz in bufferevent ratelimits
2024-03-03 23:10:48 +01:00
Azat Khuzhin
e4b8732701 Fix integer-overflow in ev_token_bucket_cfg_new
Found by oss-fuzz, after coverage had been improved in https://github.com/google/oss-fuzz/pull/11257

v2: better check (found by CI for windows)
2024-03-03 16:25:08 +01:00
Azat Khuzhin
15e643d0ca Fix pread detection for cmake builds
Otherwise it will use lseek()+read() - suboptimal
2024-03-03 16:04:56 +01:00
Andy Pan
921097477e Simplify TCP_KEEPALIVE_ABORT_THRESHOLD settings on Solaris 2024-03-03 13:57:38 +01:00
Azat Khuzhin
c4fb0f7603 Fix divide-by-zero in ev_token_bucket_get_tick_
Found by oss-fuzz, after coverage had been improved in https://github.com/google/oss-fuzz/pull/11257
2024-02-20 08:58:04 +01:00
Azat Khuzhin
ec8d7a5a7b
ci: fix ABI check (#1510) 2024-02-20 08:54:14 +01:00
Pierce Lopez
7eddd5262a Patch abi-compliance-checker to avoid endless loop 2024-02-20 08:25:09 +01:00
Pierce Lopez
798547ac20 Force abi-check to use DWARF 3 2024-02-20 08:13:04 +01:00
Azat Khuzhin
e486962561 Fix abi_check.sh by excluding .abi-check from cp
cp: cannot copy a directory, './.abi-check', into itself, '/le/src/.abi-check/work/abi-check/src/libevent/current/.abi-check'
2024-02-20 08:13:04 +01:00
Azat Khuzhin
5bdfab7679 Debug abi check 2024-02-20 07:53:18 +01:00
Azat Khuzhin
f37c667cba Add ABI check without deploy for PRs 2024-02-20 07:53:18 +01:00
Azat Khuzhin
551df0b2f1 ci: try to fix ABI check by using newer version of ubuntu
Looks like after upgrading ubuntu from 18.04 (that has 1.9 version of
lvc abi tools) to 20.04 (that has 1.11) the abi-check started to
timeout (works longer then 6 hours, while usually few minutes, and
sometimes even faster was enough).

Unlikely upgrading ubuntu will help, since 22.04 and 20.04 has the same
version, but still, let's try.

Refs: #1463
2024-02-20 07:50:35 +01:00
Azat Khuzhin
0dbd3eb3c9 tests: add test for EV_SIGNAL with timeout
Refs: https://github.com/libevent/libevent-book/issues/12
2024-02-19 22:07:32 +01:00
Azat Khuzhin
5cec3417bf
Make Infer static analyzer happy (#1554) 2024-02-19 08:21:11 +01:00
Ramon Ortega de Voor
ed35b30feb Fix two compiler errors for unused variable and undefined function
In buffer.c a variable "flags" and a label "done" are defined but
never used if "EVENT__HAVEMMAP" is not defined.

The code does not work on platforms which do not provide
the function `socketpair()`. Introduce EVENT__HAVE_SOCKETPAIR flag
which determines if `socketpair()` or `evutil_ersatz_socketpair()`
is used.
2024-02-19 08:19:24 +01:00
Azat Khuzhin
95ed33e37a
Follow up for HTTP chunk size check (#1552) 2024-02-18 22:08:54 +01:00
Azat Khuzhin
f9939490eb Fix leak in evconnlistener_new_async()
Fixes: https://github.com/libevent/libevent/issues/414
2024-02-18 22:07:22 +01:00
Azat Khuzhin
317911a1a0 Fix util/monotonic_prc_fallback under FreeBSD
Looks like there was garbage, since evutil_configure_monotonic_time_()
does not reset evutil_monotonic_timer structure, while in case of
fallback it uses two fields from it:
- last_time
- adjust_monotonic_clock

Fixes: https://github.com/libevent/libevent/issues/1495
2024-02-18 20:40:53 +01:00