Commit Graph
5599 Commits
Author SHA1 Message Date
iphydf 7740bb421f refactor: decouple net_crypto from DHT
This introduces a vtable interface for the DHT dependency in net_crypto,
allowing us to break the dependency and make testing/mocking/fuzzing easier.
2026-01-04 20:59:26 +00:00
iphydf 1936d42965 test: add benchmark for toxav audio and video
This includes RTP, but no networking.
2026-01-02 01:58:07 +00:00
iphydf 46bfdc2df7 fix: correct printf format specifiers for unsigned integers 2026-01-01 16:01:12 +00:00
iphydf b66b8ded66 refactor: improve group stability, moderation determinism, and DHT dual-stack handling
* DHT Routing: Fixed dual-stack handling to clear stale IPv4/IPv6 associations when a node's address updates.
* Performance: Switched to memcmp for public key/hash comparisons (safe for non-secrets).
* Group Chat Reliability:
    * Added logic to use friend connection IPs as a fallback if DHT discovery is slow, with a fix to prevent overwriting existing valid IPs.
    * Increased handshake connection limits and fixed full-group sync behavior.
    * Enforced list sorting and fixed timestamps to ensure consistent moderation state hashes across all peers.
2026-01-01 03:27:34 +00:00
iphydf 4fbd7c10a9 fix(toxav): fix heap buffer overflow in RTP video packet handling
The `rtp_receive_packet` function (via `fill_data_into_slot`) relied on
the `data_length_full` field in the RTP header to allocate the frame
buffer, but failed to verify that the actual payload length of the
incoming packet fit within this allocated size. A malicious peer could
send a packet with a small `data_length_full` but a large payload,
causing `memcpy` to write past the end of the buffer.

This commit adds a bounds check to ensure that the packet offset plus
the payload length does not exceed the total frame length. Tested via
unit tests.
2026-01-01 01:32:23 +00:00
iphydf 809fe8c78c refactor(tox): make the #define consts int literals.
Some language bindings generators don't like doing sizeof math.
2025-12-31 00:32:41 +00:00
iphydf 50d242a370 refactor(toxav): improve MSI safety and testability
- Refactor MSISession to use a mandatory MSICallbacks struct in msi_new.
- Remove individual MSI callback setters to enforce full initialization.
- Fix doubly linked list corruption in new_call when reusing friend numbers.
- Fix missing capability updates and callback triggers during friend recall.
- Remove legacy toxav_hacks.h and clean up build files.
2025-12-31 00:32:39 +00:00
iphydf da1c13a2f9 fix(toxav): harden video processing and fix large frame handling
- Remove invalid vpx_img_free call in vc_iterate.
- Make vc_reconfigure_encoder atomic and add resolution limits.
- Support 32-bit RTPMessage lengths to correctly handle large frames.
- Ensure len is correctly set for assembled video frames.
- Add security checks for incoming frame sizes and resolutions.
- Significantly expand video and rtp unit tests covering security scenarios.
- Clean up VCSession structure and improve internal API consistency.
- Use #define for security constants in video module.
2025-12-30 21:59:14 +00:00
iphydf 4728252888 fix(toxav): fix multiple logic bugs in audio module
- Fix heap-buffer overflow in `ac_iterate` (PLC) by validating sampling rates and channel counts from untrusted RTP packets.
- Fix out-of-bounds read by adding explicit packet length validation (minimum 5 bytes).
- Fix jitter buffer reset bug where late packets caused a full buffer clear due to unsigned wrap-around.
- Fix jitter buffer PLC logic to correctly handle sequence number wrap-around at 16-bit boundaries.
- Refactor `ac_iterate` to process all currently ready packets in a single call, improving throughput.
- Optimize `ac_iterate` by moving the large scratch buffer allocation outside the packet processing loop.
- Add unit tests covering jitter buffer edge cases, wrap-around scenarios, and malicious packet handling.
- Refactor `ACSession` to be opaque and provide accessor for frame duration.
2025-12-30 17:37:05 +00:00
iphydf dc963d9a99 fix(toxav): fix multiple bugs in bandwidth controller and add tests
- Fix rate limiting logic to be wrap-around safe for timestamps.
- Fix potential division-by-zero/sum-overflow in percentage calculation by using double precision.
- Fix NULL callback dereference in send_update.
- Add comprehensive unit tests covering edge cases and bug scenarios.
- Refactor BWController to be more testable by injecting a packet sending callback.
2025-12-30 17:35:51 +00:00
iphydf 3bf5778efb refactor(toxav): split out RTP module and add exhaustive unit tests 2025-12-30 17:11:53 +00:00
Constantin Sunzow b79b7d4365 fix(autotools): add tox_log_level.h to public headers list
The tox_log_level.h header file was added as a public API header in
version 0.2.21, but was not included in the libtoxcore_la_include_HEADERS
variable in toxcore/Makefile.inc. This caused the header to not be
installed when building with autotools, leading to compilation errors
for applications that include tox_options.h (which depends on
tox_log_level.h, like qTox).

This patch adds tox_log_level.h to the list of installed headers,
matching the behavior of the CMake build system.

Commit: c834472637
Fixes: compilation error "tox_log_level.h: No such file or directory"
2025-12-25 14:34:07 +00:00
iphydf ea2e34ff26 chore: Disable cirrus. We're out of quota again. 2025-12-25 10:33:33 +00:00
Green Sky b449ea2ed4 chore(ci): update azure runner image to windows-2022
windows-2019 is EOL
2025-11-24 12:34:36 +01:00
iphydf e115b136d5 refactor: Make add_to_list non-recursive. 2025-11-05 01:18:42 +00:00
iphydf 206ea35304 refactor: Explicitly pass dependencies to constructors.
Instead of transitively loading them from dependencies, we should be
explicit about what each object needs. The downside of this is that it's
not clear whether the object and its dependency use the same common
dependency. The upside is that we don't expose those getters of internal
dependencies.
2025-11-02 23:31:59 +00:00
Green Sky 7cefa93cf2 fix(toxencryptsave): Wipe salt and passkey after usage. 2025-10-25 12:17:39 +02:00
iphydf 7c3be23429 refactor: Add file/line to tox-bootstrapd logging.
Also, allow trace logging in bootstrapd (disabled by default, but
enabled on the websockify docker image so we can debug things there).
2025-10-18 22:33:09 +00:00
iphydf f84e8cdce3 refactor: Move loglogdata out of network.c.
With another bit of refactoring, this can be an independent bit of code
that can be independently benchmarked and tested.
2025-10-08 18:38:08 +00:00
iphydf 390f7db060 refactor: Move random and memory OS-specifics to os_* files. 2025-10-08 10:59:32 +00:00
Green Sky 6f7f515544 chore(toxav): use realtime deadline for vp8 encoder
Technically all this does is choose a quality based on frame
duration, which we always set to 1, and as such is always realtime.
(In same timebase as pts, which we use as a frame counter...)

Also no deadline for decoder. (documentation tells us its ignored)
2025-10-06 01:01:32 +02:00
Green Sky 5047ae5a24 chore: make the source tarball exhibit the old behavior 2025-10-05 21:51:36 +02:00
iphydf 14804a4b86 chore: Fix sonar-scan CI action. 2025-10-05 19:16:46 +00:00
Green Sky e2db7d946d cleanup: Exclude lan_discovery test from running on macos,
instead of excluding it from the project.
2025-10-05 20:36:12 +02:00
iphydf 3accade676 chore: Fix CI, disabling some tests that no longer run on CI. 2025-10-05 18:05:23 +00:00
iphydf ef8d767e6f cleanup: Fix comment formatting errors.
Cimple is now stricter in these.
2025-10-05 18:05:02 +00:00
iphydf 34ec822da7 cleanup: Fix some clang-19 format warnings. 2025-07-13 12:26:15 +00:00
iphydf 40b3f0b463 refactor: Use clang's nullability qualifiers instead of attributes. 2025-07-13 00:26:24 +00:00
iphydf f81e30679b refactor: Use per-parameter nullability annotations.
This is less error-prone.
2025-07-12 09:20:18 +00:00
Green Sky 6794447518 chore(toxav): increase the idle iterate interval to 1 second
and remove a non-existant reference in a comment
2025-05-16 11:10:12 +02:00
Green Sky 3e22fd5cc4 fix(toxav): handle vpx_image_alloc failure 2025-05-15 23:35:37 +02:00
Green Sky 4057695c5f chore(toxav): tighten the video bitrate
to the same as the vp8 encoder internally checks.
2025-05-15 21:51:46 +02:00
github-actions[bot] 3e6b22f5de chore: Release v0.2.21
This release brings 2 great featues. First, the abillty to disable DNS lookups, which has been a long requested security feature, which we plan to default to in an upcoming version.
Second, there is an network profiler, which tallies up sent and received network packets.

Beside these features we also have fixes like a 75% memory usage reduction for NGCs and connecting to NGC with a password if we are already joined, which might be necessary if a password was set or changed while you where away.
Furthermore, we now have better localhost discovery, which means that nodes on the same system find each other.

---

If you have not yet upgraded to the previous release (0.2.20), you absolutely should, as it fixes a security issue. All releases before 0.2.20 used VBR opus encoding, which is susceptible to transcription attacks. ( see https://github.com/TokTok/c-toxcore/pull/2757 )
2025-05-15 12:08:17 +00:00
Green Sky 219773bff5 fix(ngc): dont double every message, if we are not directly connected
but we and the other peer would support direct.
2025-05-13 17:12:40 +02:00
Green Sky 1d4cc783b1 fix(bazel): one more fuzz target that needs netprof 2025-03-31 13:50:07 +02:00
Green Sky 066aafbfcd fix(bazel): make net_prof visible to its consumers 2025-03-28 15:09:32 +01:00
Green Sky 9dcc2f530d fix(bazel): missing dep for auto_tests 2025-03-21 13:06:25 +01:00
Green Sky 741ac5f5e6 fix(bazel): missing dep for fuzz target 2025-03-20 13:00:30 +01:00
jfreegman 76bc4c496d refactor: TCP connection netprof objects are now owned by Messenger
This allows us to have a single netprof object for all TCP client
connections, which makes it easier to query and keep track of
TCP network data for groupchats. Previously we were not properly
querying groupchat TCP network data via the netprof API.
2025-03-18 21:32:41 -04:00
dependabot[bot] 59d3f6674f chore(deps): bump golang.org/x/net
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.33.0 to 0.36.0.
- [Commits](https://github.com/golang/net/compare/v0.33.0...v0.36.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-13 11:23:11 +00:00
Green Sky 9324a974d4 fix: forgot an enum in the nodes request rename
see https://github.com/TokTok/c-toxcore/pull/2860
2025-03-12 19:29:40 +01:00
github-actions[bot] 81b1e4f634 chore: Release v0.2.21-rc.1
Pre-release for toxcore. Primarily, we now have an experimental network profiling callback.
v0.2.21-rc.1
2025-02-24 14:28:06 +00:00
Robin Linden 9303e2e49a chore: Update the pkgsrc versions in the update-versions tool 2025-02-24 01:50:17 +01:00
Robin Linden 71ec4b3b1e chore: Update the version-sync script to work in a post-tox.api.h world 2025-02-22 15:49:22 +01:00
iphydf 66da842f75 chore: Add version update script compatible with ci-tools. 2025-02-21 13:40:30 +00:00
iphydf 199878f766 chore: Use new bazel script for circle ci. 2025-02-20 09:07:36 +00:00
iphydf 8278e9cda4 chore: Add release issue template and workflow. 2025-02-16 19:58:08 +00:00
iphydf a9bb3a1c4d chore: Fix alpine-s390x build. 2025-02-16 00:37:49 +00:00
iphydf 6e0a641272 chore: Add a source tarball deploy workflow.
This builds the autotools files (configure, etc.) so people can build
the code without needing to install autotools.
2025-02-15 12:44:03 +00:00
iphydf 4adebe4d8b chore: Don't upload ios/macos variants in deploy workflows.
We already put them into an xcframework. There's no strong reason to
keep them as separate assets as well.

Also removed the Makefile for single-file uploads, because it
individually appears in the release assets. The .c files are
intentionally separate asset uploads, but the Makefile is always the
same so can be fetched directly from the repo if needed.
2025-02-15 12:10:04 +00:00