Commit Graph

5109 Commits

Author SHA1 Message Date
iphydf 7a3ead591f cleanup: Use a struct for the ip_ntoa buffer.
Every use of this function needs to allocate the same buffer. None of
the callers uses a differently sized buffer, so we might as well put it
in a struct and have the type checker prove the buffer size is correct.

Also rename `ip_ntoa` to `net_ip_ntoa` to avoid clashes with ESP-IDF
system libraries which define this function as well.
2022-04-03 18:57:04 +00:00
iphydf e4d1958ffa refactor: Allow NULL logger; make it no-op in NDEBUG. 2022-04-03 18:29:22 +00:00
iphydf 4d5887cc58 test: Improve stability of forwarding_test.
By trying to create a tox tcp relay on 100 ports starting at 36570.
2022-04-03 18:14:01 +00:00
iphydf 378febffff cleanup: Use static_assert instead of assert where possible.
This avoids some "always true condition" warnings and lifts the errors
(if any) into compile time.
2022-04-03 17:58:14 +00:00
zugz (tox) e49a477a84 feat: add forwarding and announce request handling
This is the "server-side" part of the new friend finding system,
allowing DHT nodes to store small amounts of data and permit searching
for it. A forwarding (proxying) mechanism allows this to be used by TCP
clients, and deals with non-transitivity in the network.
2022-04-03 00:00:08 +00:00
zugz (tox) 97acb39c1f cleanup: add timed_auth module for ping_ids 2022-04-03 00:00:08 +00:00
zugz (tox) 7cee48d9c4 cleanup: clarify and isolate use of custom IP_Port values to denote TCP connections 2022-04-03 11:41:42 +00:00
iphydf dec1399776 test: Add fuzzer support functions for internal toxcore objects.
These help creating fuzzer fixtures with non-trivially constructed
objects and takes care of cleaning them up afterwards so the fuzzer code
can focus on the system under test.
2022-04-03 11:21:06 +00:00
iphydf c71b1218f8 chore(deps): Use upstream cmp directly instead of our fork.
The upstream maintainer is active and has merged our changes.
2022-04-03 09:02:31 +00:00
iphydf b66f4959e2 chore: Add dependabot config.
To keep the third_party/cmp submodule up-to-date.
2022-04-03 08:45:09 +00:00
iphydf e3ace8ca24 cleanup: Make *_free functions nullable.
These should be no-ops when passed a null pointer.
2022-04-02 21:28:26 +00:00
iphydf eb07575334 cleanup: Remove layers in the cmake build.
Nothing checks whether these layers are actually observed. The bazel
build does check this, so there's no need to have this documentation in
the cmake build. It'll just go out of date.
2022-04-01 17:17:15 +00:00
iphydf 1f4aaf01cb chore: Fix path to fuzzer binaries in clusterfuzz build. 2022-04-01 16:58:17 +00:00
iphydf cc31ff07fa feat: Add support for custom random number generator.
This can be used by fuzzers to make RNG-driven code deterministic (i.e.
based on the fuzzer input).
2022-04-01 14:06:05 +00:00
iphydf 660e346fce cleanup: Disallow stack frames of over 9000 bytes.
This only happens in tests, which are easy to fix. Inside toxcore we
should actually be more stringent, but for now this helps already.
2022-04-01 13:57:16 +00:00
iphydf 8b407802dd refactor: Rename bin_pack/unpack functions the same as cmp funcs.
No real reason to have different names. Also "bin" is shorter than
"bytes" to write.
2022-04-01 11:15:16 +00:00
iphydf d0ebc21a0e cleanup: Add Network object parameter for addr_resolve.
This function doesn't use Network yet, but it will in the future, and
for now it's better to pass Network to all network I/O functions.
2022-04-01 10:42:43 +00:00
iphydf e04484efae cleanup: Remove unused random_testing program.
Fuzzers do a better job of this.
2022-04-01 09:20:04 +00:00
iphydf b09a1ff02d cleanup: Remove all uses of TOX_*_MAX_SIZE macros.
We should use the functions for these instead.
2022-04-01 09:10:37 +00:00
zugz (tox) 3cc72f5f57 fix: fix typo in git command in INSTALL.md 2022-03-31 00:00:00 +00:00
iphydf c8e5fd37ae cleanup: Add include for assert.h for the fuzzing build.
See https://github.com/TokTok/c-toxcore/runs/5776684729?check_suite_focus=true#step:4:945.
2022-03-31 19:11:09 +00:00
iphydf cc0c4a5fe1 cleanup: Move definitions of tox_private.h functions to tox_private.c.
Also moved lock/unlock to tox_private so they can be used across these 2
tox/tox_private translation units.
2022-03-31 18:49:26 +00:00
iphydf 9b2e887826 cleanup: Expand CONST_FUNCTION and remove the macro.
Generating functions is ugly. Ideally astyle wouldn't ask us to write 4
lines of code where 1 would be more readable, but such is life (until we
move to clang-format).
2022-03-31 18:35:45 +00:00
iphydf ee42a5ca05 chore: Add uint8_t version of bin_pack for numbers.
This was the only one missing. Also added a test for integer
conversions: lossy ones are rejected, lossless ones are ok.
2022-03-31 17:09:15 +00:00
jfreegman 015305a088 Merge moderation portion of new groupchats codebase 2022-03-30 20:09:50 -04:00
iphydf 09575dc05b chore: Clone submodules in clusterfuzzlite Dockerfile.
Needed for the build afterwards.

Also added the cflite Dockerfile to automatic CI builds so changes to it
are checked in pull requests.

Also fixed the tokstyle docker image. It needs clang instead of gcc now.
2022-03-30 18:29:46 +00:00
iphydf 7db0c80c93 test: Add DHT and tox_events fuzz tests to the cmake build. 2022-03-29 22:57:23 +00:00
iphydf f39aac09e6 feat: Allow custom network functions.
The idea here is to have a `Network` object that contains functions for
network operations and an optional userdata object that can manage those
network operations. This allows e.g. a fuzzer to replace the network
functions with no-ops or fuzzer inputs, reducing the need for `#ifdef`s.
2022-03-29 22:03:26 +00:00
iphydf 2e3819c956 chore: Remove valgrind build.
This is very slow, around 20 minutes, which seriously slows down
velocity for little gain. MSAN runs on unit tests and 1 auto test, so
we'll catch increasingly many valgrind-ish bugs that way in one of the
1-5-minute builds.
2022-03-29 12:53:02 +00:00
iphydf ad90f5bbb8 cleanup: Mark Mono_Time const where possible. 2022-03-28 21:26:34 +00:00
iphydf d56cb13279 cleanup: Avoid name clash between struct field and function.
`connection_status_callback` is also used as struct field in net_crypto.
2022-03-28 21:12:08 +00:00
Tha14 73b0e0fed7 Add information regarding git submodules, cmp 2022-03-28 22:49:31 +03:00
iphydf 6cc8ef3771 cleanup: Add more null checks in tox_new.
So the rest of the code can assume non-null more.
2022-03-28 14:52:38 +00:00
iphydf f13029417e test: Remove save_load_test from autotools build.
It keeps timing out. Not great, but it's covered by other builds.
2022-03-28 00:11:47 +00:00
iphydf 24065cf5a9 chore: Update bootstrap daemon checksum. 2022-03-27 23:30:37 +00:00
zugz (tox) c38f21f888 fix: Correct calculation of packet sent time 2022-03-27 23:30:36 +00:00
iphydf e4558a287c perf: Make time move a lot faster in fuzzing runs. 2022-03-27 22:52:35 +00:00
iphydf ae369dc2e7 test: Enable more tests for msan. 2022-03-27 22:26:15 +00:00
iphydf b768c153ae chore: Add third_party to toxcore-sources docker image.
This is needed so other/docker/coverage/run works.
2022-03-27 22:01:19 +00:00
iphydf bb7b1e9b3a cleanup: Make addr_resolve a private function.
This isn't used anywhere except in network_test. That test now checks
behaviour of the function actually used elsewhere in tox code, instead.
2022-03-27 20:10:42 +00:00
iphydf 478ef39b39 test: Add some support functions to make writing fuzzers easier. 2022-03-27 18:43:41 +00:00
iphydf 96ab8918dc cleanup: Use _Static_assert in gcc/clang.
Hopefully they don't throw warnings at us.
2022-03-27 18:18:33 +00:00
sudden6 bc006beb4e cleanup: split CMakeLists.txt and add some missing targets 2022-03-27 20:09:10 +02:00
iphydf ac3e8fea63 test: Improve stability of tox_many_tcp_test.
If the TCP port is in use, try the next TCP port.
2022-03-27 15:10:24 +00:00
iphydf ee154da4a9 refactor: Use cmp instead of msgpack-c for events packing.
This library is better in every way.
2022-03-26 23:57:15 +00:00
iphydf 6749974470 cleanup: Expose struct Tox to internal code.
To avoid unsafe casts that tokstyle doesn't allow and that can cause
random breakages.
2022-03-26 21:15:31 +00:00
sudden6 48fb45887f try to save the fuzzed save file again
This should test some additional code paths.
2022-03-26 14:09:04 +01:00
iphydf 1928704065 test: Add fuzzer tests to the bazel build. 2022-03-25 18:48:41 +00:00
iphydf 7dde71c4e9 chore: Use "master" as the branch in toktok-fuzzer.
This is the standard across toktok repos. Exceptions are a pain for
automation and tooling.
2022-03-23 23:03:52 +00:00
iphydf 2dcb946e62 cleanup: Reduce scope of array-typed variables where possible.
Cimple cannot actually find these without also causing false positives,
but I found them with cimple before removing the code causing false
positives again.
2022-03-21 12:02:46 +00:00