Commit Graph

5234 Commits

Author SHA1 Message Date
Green Sky
01e7950c67
increase lossy custom packet size in ngc to the toxcore common max of 1373 2023-12-15 00:57:33 +01:00
jfreegman
9b3c1089f1
Make group saving/loading more forgiving with data errors
Rather than aborting the process on invalid group save data we
either try to continue if possible, or abort the saving/loading
instead of the entire process
2023-12-14 10:21:21 -05:00
Maxim Biro
55a76003b0
Replace memset(int32_t*, -1, _) with a for-loop
memset() treats the passed buffer as a char* array, assigning to every
1-byte of the array the value. So for a single 4-byte int32_t element,
it is assigning bytes 0, 1, 2 and 3 of it to -1. It happens that -1 is
0xFF, so in the end the uint32_t is set to 0xFFFFFFFF, which is -1 in
the two's complement, so the memset() actually produces the correct
result in the end, assuming the platform uses two's complement integers.

Assigning it in the loop is less error-prone, as using memset() on
non-1-byte wide arrays with a non-zero value is fishy, and it is more
portable as we don't have to assume the use of two's complement.

It looks like in a future version of the C standard, C23, two's
complement is the only integer format in C23 (thanks to @robinlinden on
IRC for pointing that out), so perhaps we shouldn't be as concerned with
the portability here? Though @iphydf says that it's still a good idea to
use a for-loop for this case.
2023-12-13 18:40:12 -05:00
zoff99
66453439ac
fix: also Install header for private/experimental API functions with autotools 2023-12-09 10:54:26 +00:00
iphydf
3983369103
fix: Enable debug flag for ubsan.
Otherwise the nullability annotations are compiled out in attributes.h.
2023-12-09 01:14:53 +00:00
Maxim Biro
4d1db21102
Update tox-boostrapd hash 2023-12-08 03:31:14 -05:00
Maxim Biro
e700c31b70
Fix memory leak in group connection 2023-12-08 03:31:13 -05:00
Maxim Biro
2994441d9c
Fix memory leak in save-generator 2023-12-08 03:31:12 -05:00
Maxim Biro
d0400df13d
Fix memory leak in tox-bootstrapd 2023-12-08 03:31:04 -05:00
jfreegman
7a6d50ebe3
Install header for private/experimental API functions
This allows client developers to use the private API without
needing to manually specify the header path in the source
code, which may vary from system to system.
2023-12-07 13:02:18 -05:00
jfreegman
d89677fb5f
Remove defunct IRC channel from README.md
We can replace this with a tox groupchat once we make a release
2023-12-07 01:09:57 -05:00
Maxim Biro
26d41fc604
Replace DEFAULT_TCP_RELAY_PORTS_COUNT with a compile-time calculation
That way we don't have to rely on a human to remember to keep
DEFAULT_TCP_RELAY_PORTS_COUNT in sync with DEFAULT_TCP_RELAY_PORTS.
2023-12-05 09:56:46 -05:00
Maxim Biro
63fb2941ca
Clarify disabling of static assert checks 2023-12-05 06:56:27 -05:00
iphydf
65b3375b98
refactor: Use Bin_Pack for packing Node_format. 2023-12-04 17:36:09 +00:00
jfreegman
84ba154f6a
group connection queries now return our own connection type 2023-12-04 10:35:50 -05:00
Maxim Biro
a4df2862ed
Replace tabs with spaces 2023-12-03 04:09:43 -05:00
Maxim Biro
1b6dee7594
Update tox-bootstrapd's base Docker images 2023-12-02 01:49:55 -05:00
Maxim Biro
a030cdee5c
Fix Docker tox-bootstrapd hash update failing when using BuildKit
Docker is defaulting to using BuildKit for building images since version
23.0 (2023-02-01), which is not compatible with this script. The script
was fishing the hash of the intermediate build container in which the
build has failed, in order to run the sha256sum in that image, however
with BuildKit there are no longer any intermediate build containers,
which breaks the script.

The legacy builder is supposedly getting removed in a future version of
Docker, which is why we embrace BuildKit instead of reverting to the
legacy builder via DOCKER_BUILDKIT=0:

  $ DOCKER_BUILDKIT=0 docker build ...
  DEPRECATED: The legacy builder is deprecated and will be removed in a
              future release. BuildKit is currently disabled; enable it
              by removing the DOCKER_BUILDKIT=0 environment-variable.

While DOCKER_BUILDKIT=1 is unnecessary on Docker >= 23.0, it's needed
for anyone running older Docker, so it makes sense to have it in for
now, while everyone transitions.
2023-12-02 01:49:53 -05:00
iphydf
7cfe35dff2
cleanup: Remove explicit layering_check feature.
It's default in .bazelrc now.
2023-11-23 23:55:57 +00:00
iphydf
d390947245
chore: Upgrade sonar-scan jvm to java 17.
https://community.sonarsource.com/t/java-11-is-deprecated-as-a-runtime-env-to-scan-your-projects/9659
2023-11-23 11:23:54 +00:00
iphydf
d1e850c56c
fix: Add missing htons call when adding configured TCP relay. 2023-11-23 00:13:16 +00:00
iphydf
814090f2b8
chore: Cancel old PR builds on docker and sonar-scan workflows.
Also, don't error on test failures on windows (they are very flaky).
2023-11-22 23:38:50 +00:00
iphydf
83efb17367
perf: Add a KVM FreeBSD build on cirrus ci. 2023-11-22 23:17:27 +00:00
iphydf
a927183233
test: Add a test for encrypting 100MB of data.
Both in C and C++, because the C++ tests don't currently run on FreeBSD,
and we want to know how the FreeBSD VM performs (answer: poorly).
2023-11-22 21:12:27 +00:00
iphydf
28f39049f6
chore: Retry freebsd tests 2 times.
Also, use `cmake --build` instead of manually calling `gmake`. This
allows us to maybe later use `ninja` instead of `gmake` without changing
this build invocation.

Also, increase timeout to 120 seconds. FreeBSD tests are slow.
2023-11-22 21:12:16 +00:00
iphydf
47e77d1bb0
chore: Use C99 on MSVC instead of C11.
The windows sdk has buggy headers in C11.
2023-11-22 19:55:28 +00:00
iphydf
7155f7f60e
test: Add an s390x build (on alpine) for CI.
It doesn't work at all, because we're missing something in the net code
to do with endian conversions. I haven't investigated, yet, but at least
now we have a failing test that can be investigated.

Also moved to cmake 3.5 at minimum. CMake will stop supporting lower
versions than that, soon.

Also moved to C11 from C99 to get `static_assert`.

Also made a network ERROR into a WARNING. It triggers on FreeBSD.
2023-11-22 18:29:26 +00:00
iphydf
6c35cef63f
chore: Add a compcert docker run script.
Useful for local runs. Does the same as CI, so if it fails on CI, this
can be used to test locally, avoiding slow CI round trips.
2023-11-18 06:19:21 +00:00
iphydf
41e6ea865e
cleanup: Use tcc docker image for CI.
Instead of repeating the instructions in github actions configs.
2023-11-18 03:44:06 +00:00
iphydf
e726b197b0
refactor: Store time in Mono_Time in milliseconds.
Conversion to seconds happens in `mono_time_get`, and a new function
`mono_time_get_ms` allows code to retrieve monotonic time in
milliseconds.
2023-11-17 05:20:29 +00:00
zoff99
cd34b60f0f
feat: allow for larger incoming NGC packets 2023-11-16 20:47:02 +00:00
iphydf
94cf9d1f36
fix: Fix memory leak in the error path of loading savedata. 2023-11-16 00:41:45 +00:00
jfreegman
fc623a5281
tox_new() should return null when savedata loading fails
Returning a valid tox instance when loading a corrupt
savefile is probably not desired behaviour
2023-11-14 22:15:55 -05:00
Tha14
06d949a701
fix: always respond to version packets with toxcore version 2023-11-13 15:45:17 +00:00
Green Sky
8099d82397
diagnostic: get the number of close dht nodes with announce/store support 2023-11-13 01:24:15 +01:00
zoff99
d01c116764
cleanup: make it more clear that assert and uint32_t increment both only exist if NDEBUG is not defined 2023-11-12 06:18:01 +00:00
iphydf
58fac53429
refactor: Add a bin_unpack_bin_max for max-length arrays.
These are statically allocated (e.g. `uint8_t[1024]`) arrays with
variable length data inside them. Examples are group topics and
nicknames.
2023-11-12 00:57:44 +00:00
iphydf
6be29f01e5
chore: Add more logging to loading conferences from savedata.
Better error messages than "something went wrong in type 20".

Also fix bazel-asan/tsan builds.

https://github.com/tweag/rules_nixpkgs/issues/442 is blocking fuzz
tests under asan.
2023-11-08 15:51:11 +00:00
jfreegman
1195271b7f
Fix inversed return values
This was causing pings to be sent every 1-2 seconds rather than
the expected interval.
2023-11-07 12:54:20 -05:00
iphydf
82276ef5ac
cleanup: Fix GCC compatibility. 2023-11-07 12:18:22 +00:00
iphydf
24b54722ae
fix: Ensure we have allocators available for the error paths. 2023-09-11 21:43:43 +00:00
iphydf
48dbcfebc0
cleanup: Remove redundant -DSODIUM_EXPORT from definitions.
`-DSODIUM_STATIC` implies `-DSODIUM_EXPORT`.
2023-09-11 19:43:00 +00:00
iphydf
0cef46ee91
cleanup: Fix a few more clang-tidy warnings. 2023-09-07 07:49:47 +00:00
iphydf
0c5b918e9f
cleanup: Fix a few more clang-tidy warnings. 2023-09-07 07:06:34 +00:00
iphydf
4d3c97f49d
cleanup: Enforce stricter identifier naming using clang-tidy. 2023-08-31 13:37:16 +00:00
iphydf
a549807df7
refactor: Add mem module to allow tests to override allocators.
This will allow us to do more interesting things with memory allocation
within toxcore, and allow fuzzers to explore various allocation failure
paths.
2023-08-30 22:55:05 +00:00
iphydf
6133fb1531
chore: Add devcontainer setup for codespaces.
These commands run when starting a new codespaces VM.
2023-08-30 09:51:14 +00:00
Robin Linden
620e07ecd9
chore: Set a timeout for tests started using Conan 2023-08-29 13:26:12 +00:00
Robin Linden
c0ec33b168
chore: Migrate Windows CI from Appveyor to Azure DevOps 2023-08-29 13:26:12 +00:00
jfreegman
8ed47f3ef2
fix incorrect documentation
The key used to get wiped on a kick but this is
no longer the case
2023-08-16 23:41:08 -04:00