Commit Graph

5315 Commits

Author SHA1 Message Date
iphydf
687af81f20
cleanup: Remove empty test doing nothing.
It's no longer needed since NGC was merged.
2024-01-15 18:29:08 +00:00
iphydf
fcf5882428
test: Add printf log statement to group_moderation_test. 2024-01-15 18:09:38 +00:00
iphydf
b4d8826228
cleanup: Remove old type-ordered event getters.
These are quite expensive, because they go through all events to index
in a typed array that no longer exists. Clients should index in the
union array and find the event they want themselves, or use dispatch.
2024-01-15 17:29:43 +00:00
Green Sky
8c35e0fefb
feat: add ngc events 2024-01-15 16:32:10 +00:00
iphydf
97bdd83937
refactor: Make event dispatch ordered by receive time. 2024-01-15 16:32:10 +00:00
Green Sky
001d00ab30
fix: dont resolve to ipv6 addresses when its disabled 2024-01-15 15:29:01 +01:00
Green Sky
d3b935f63f
fix(test): tests use ipv6 by default, even with USE_IPV6 set to 0 2024-01-15 15:29:01 +01:00
Green Sky
29fc5ea1f7
chore: add clangd files to .gitignore 2024-01-15 12:12:28 +01:00
iphydf
d30c81acbc
refactor: Move file streaming test to its own file.
It can't easily be ported to events.
2024-01-14 23:00:42 +00:00
Green Sky
acdc67387b
fix(ci): window builds now build in parallel
Co-authored-by: Maxim Biro <nurupo.contributions@gmail.com>
2024-01-14 10:01:35 -05:00
iphydf
bcb6592af5
test: Add C++ classes wrapping system interfaces.
These are more convenient and safer than the manual vtables we have in
the fuzzer support code. We can override individual member functions,
and C++ will take care of correctly casting and offsetting this-pointers
when needed.
2024-01-13 16:16:47 +00:00
iphydf
4cea4f9ca4
fix: Make all the fuzzers work again, and add a test for protodump.
fuzz_select_target wasn't selecting anything, so fuzzers using that
function either did nothing or would only ever select one of the
functions.
2024-01-13 15:06:30 +00:00
iphydf
c4e209ea1d
refactor: Factor out malloc+memcpy into memdup.
Only applied in one place, but perhaps later we can implement a pattern
in tokstyle to find more opportunities for using memdup.
2024-01-13 11:57:21 +00:00
jfreegman
87bcc4322d
fix: Remove fatal error for non-erroneous case
We allow non-null data pointers to be passed to functions
alongside 0-length data. For example when creating a data
buffer that has room for the entire packet, including ignored
header data.

This error broke a rare but legitimate case where we miss
packets during a handshake attempt and need to store empty
handshake packets in the packet array.
2024-01-12 20:06:43 -05:00
iphydf
812f931d5f
fix: Make sure there's enough space for CONSUME1 in fuzzers. 2024-01-12 14:52:35 +00:00
iphydf
50f1b30fa9
test: Add fuzz tests to the coverage run.
So we don't need to write so many edge case tests ourselves for things
like parsers, which really don't need those manual tests, as long as we
can check for some properties like "can output the parsed data and it'll
be the same as the input".
2024-01-12 12:33:41 +00:00
iphydf
df76f5cf47
chore: Move from gcov to llvm source-based coverage. 2024-01-12 10:27:48 +00:00
jfreegman
072e3beb3f
fix: issues with packet broadcast error reporting
commit 5b9c420c introduced some undesirable behaviour with packet send
functions returning error when they shouldn't. We now only return an
error if the packet fails to be added to the send queue or cannot
be wrapped/encrypted. We no longer error if we fail to send the packet
over the wire, because toxcore will keep trying to re-send the packet
until the connection times out.

Additionally, we now make sure that our packet broadcast functions
aren't returning an error when failing to send packets to peers
that we have not successfully handshaked with yet, since this is
expected behaviour.
2024-01-11 14:54:58 -05:00
jfreegman
6b6718e4d2
cleanup: Make group packet entry creation less error-prone
We always assumed that create_array_entry() would only be called
with an empty array entry and wouldn't modify entries on error.
We now explicitly require both conditions, and also give an
error in the case of a non-null data pointer with a zero
length field, as this indicates a logic error.

Checks for an empty array entry that precede a call to
create_array_entry() are now redundant. It should be noted that
a non-empty entry doesn't necessarily indicate an error. This
condition can be triggered if packets are being sent or
received faster than they can be processed/acknowledged,
which is common when spamming messages on poor connections.
2024-01-11 11:02:29 -05:00
jfreegman
5b9c420ce1
refactor: packet broadcast functions now return errors
We now return an error if our broadcast packets fail to
send for every peer in the group
2024-01-11 10:06:46 -05:00
iphydf
af4cb31028
refactor: Use operator== for equality tests of Node_format.
It has padding bytes, so memcmp isn't necessarily safe. It is definitely
unsafe for fuzzed node formats.
2024-01-11 13:32:01 +00:00
iphydf
9592d590cf
refactor(test): Slightly nicer C++ interface to tox Random. 2024-01-10 21:56:34 +00:00
iphydf
c66e10fb7a
refactor: Minor refactoring of get_close_nodes functions.
Avoiding passing down the entire DHT struct pointer to the inner
functions makes it possible in the future to write unit tests without
having to construct a full DHT object.
2024-01-10 20:12:04 +00:00
jfreegman
ebc9643862
fix: don't pass garbage data buffer to packet send functions
This garbage data was never looked at due to passing
a zero length along with it, but it's still undesirable.
2024-01-10 12:37:21 -05:00
iphydf
32b68cffca
cleanup: Some more test cleanups, removing overly smart code. 2024-01-10 12:42:37 +00:00
iphydf
0426624dcb
refactor: Assign malloc return to a local variable first. 2024-01-10 11:46:41 +00:00
iphydf
afc38f2458
test: Add more unit tests for add_to_list. 2024-01-10 02:58:13 +00:00
iphydf
05ce5c1ab9
test: Add "infer" CI check to github, remove from circle.
This now uses our own built image with the current master of infer.
2024-01-09 10:59:53 +00:00
iphydf
814c12a6f4
cleanup: Add dynamically derived array sizes to the API. 2024-01-07 14:43:57 +00:00
iphydf
226b23be12
cleanup: Add explicit array sizes to toxencryptsave.
Also mark arrays as `[]` instead of `*`.
2024-01-07 13:27:38 +00:00
iphydf
ef33cb4de0
cleanup: Add Toxav alias for ToxAV.
ToxAV does not comply with naming standards.
2024-01-07 00:27:39 +00:00
iphydf
1da723b34d
cleanup: Make Tox_Options a typedef.
In preparation for it becoming private in 0.3.0.
2024-01-06 20:52:18 +00:00
iphydf
b148a2afff
chore: Simplify msvc build using vcpkg. 2024-01-06 12:27:31 +00:00
iphydf
5cac6d7eb1
cleanup: Move tox_get_system out of the public API.
It's not released, yet, and this function is a pain. We don't want it
going forward.
2024-01-05 19:29:59 +00:00
iphydf
c9ca4007e3
refactor: Align group message sending with other send functions.
None of the others use out parameters. Also no toxcore function uses out
parameters for anything other than arrays and errors. This would be a
first, for no good reason.
2024-01-05 19:20:01 +00:00
iphydf
6c6c0b1b1b
cleanup: Make setters take non-const Tox *.
Also renamed the setter parameters to match the property being set..
2024-01-05 17:21:35 +00:00
iphydf
a76f758d70
cleanup: Mark arrays in the tox API as [] instead of *.
This makes it clearer what is actually a pointer (i.e. the `this` pointer
or the `error` pointer) vs. what is an array.
2024-01-05 17:08:40 +00:00
iphydf
baf6d1f6cf
cleanup: Make array params in toxav [] instead of *.
Similar to the toxcore PR. It's clearer and helps apigen understand what
the API means.
2024-01-05 16:39:03 +00:00
iphydf
79f55bd06a
cleanup: Put the size of fixed arrays into the API types.
These are ignored by C compilers, but can be used as documentation and
by bindings generators.
2024-01-05 07:44:35 +00:00
iphydf
1e73698db2
cleanup: Add typedefs for public API int identifiers.
These make it clearer which kinds of `uint32_t` can fit in which
functions. It also makes it easier to generate higher level bindings
without doing a lot of inference/heuristics.
2024-01-04 13:29:43 +00:00
iphydf
cac074c57f
chore: Add fetch-sha256 script to update bootstrap node hash.
This fetches it from github, so we don't need to build it locally.

Not super ideal, because devs are supposed to build it locally to prove
reproducibility, but we can keep that diligence on the dev to do once
when actually merging the PR.
2024-01-03 23:01:55 +00:00
Maxim Biro
32576656bb
Make the comment capitalization uniform 2024-01-02 19:07:39 -05:00
Maxim Biro
aff4dda17c
Spellcheck tox-bootstrapd 2024-01-02 19:07:37 -05:00
iphydf
40b5fbbe9d
chore: Remove settings.yml in favour of hs-github-tools.
Centralised settings means we can update them without having to pass all
the CI checks of each repo.
2024-01-02 21:38:33 +00:00
iphydf
ebafd51be7
chore: Use GPL license with https.
This aligns with the new zig-toxcore-c repo. It is a chore, but better
than changing the zig-toxcore-c license to not use https.
2024-01-01 11:43:27 +00:00
iphydf
0e42752f0f
cleanup: Move all vptr-to-ptr casts to the beginning of a function.
These casts are effectively part of the function type, so it makes sense
to have them at the beginning.
2023-12-30 01:45:23 +00:00
iphydf
5407384211
cleanup: Use github actions matrix to simplify CI. 2023-12-27 14:39:17 +00:00
iphydf
82d8265688
fix: Use QueryPerformanceCounter on windows for monotonic time.
This fixes time resolution issues and simplifies the code a bit. QPC can
in theory jump forward in time, but in practice not by enough to matter
in our use case.
2023-12-27 12:21:33 +00:00
iphydf
1224e656e3
chore: Add net_(new|kill)_strerror to cppcheck's allocators.
This helps ensure strerrors are cleaned up everywhere.
2023-12-27 04:24:32 +00:00
iphydf
6a90ddfe4e
cleanup: Run clang-tidy on headers, as well. 2023-12-27 02:37:39 +00:00