Commit Graph

189 Commits

Author SHA1 Message Date
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
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
d1e850c56c
fix: Add missing htons call when adding configured TCP relay. 2023-11-23 00:13:16 +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
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
Green Sky
8099d82397
diagnostic: get the number of close dht nodes with announce/store support 2023-11-13 01:24:15 +01: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
24b54722ae
fix: Ensure we have allocators available for the error paths. 2023-09-11 21:43:43 +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
a1e2458412
docs: Fix doxygen config and remove some redundant comments.
Doxygen doesn't like these. We should probably remove all redundant
comments, but this was the set of comments doxygen complained about.
2023-08-16 07:53:19 +00:00
Green Sky
2b1a6b0d23
add missing ngc constants getter declarations and definitions 2023-08-14 12:47:08 +02:00
iphydf
2e02d56379
chore: Add missing module dependencies.
Also flip some callback asserts, because they can be reached by fuzzing
eventually.

Also update the bootstrapd checksum, since the alpine image changed a
bit.
2023-08-10 21:01:17 +00:00
jfreegman
172f279dc0
Increase max group message length by four bytes
The max message length was reduced by 4 bytes to account for the pseudo message ID, which had unintended effects on clients. It makes more sense to increase the raw packet length by four and keep the max group message length the same as the max message length for friend chats.
2023-03-03 15:53:22 -05:00
jfreegman
b2ca401543
Fix behaviour of group api function
The function that tells us if we're connected to a group now behaves
according to the documentation and returns true if we're attempting
to connect to a group, rather than only returning true if we've
connected with other peers
2023-01-24 17:32:31 -05:00
Green Sky
88ffd1a649
fix: resolve_bootstrap_node() not checking net_getipport() returned count correctly
doc: improve inline docu of return of net_getipport
2023-01-04 00:03:15 +01:00
sudden6
873896058f
chore: update tox-boostrapd hash 2022-12-08 13:16:14 +01:00
sudden6
ad2375ffe9
fix: potential endless loop under extremely high load
If there are more connections waiting to be accepted than
MAX_INCOMING_CONNECTIONS existing accepted connections are overwritten.
2022-12-05 23:40:23 +01:00
jfreegman
7ee7720890
Make some improvements to how often/when we announce a group
Instead of announcing a group whenever our connection status changes,
including when we gain or lose a TCP relay connection, we now only
when our UDP status changes, or if our previously announced
relay has gone offline. We also refresh our announcement
20 minutes regardless of any connection changes.

change should vastly reduce the amount of unnecessary DHT
traffic related to group announcements.
2022-11-25 10:56:47 -05:00
jfreegman
b8aa21cc44
Fix group custom packet size limits
Lossy custom packets cannot be split, therefore they need to be limited
to the maximum safe UDP packet size.
2022-11-24 12:18:14 -05:00
sudden6
8c7d30475f
refactor: re-implement shared key cache in separate file
The exisiting implementation is not clearly documented and used by
multiple modules.
2022-11-22 23:43:05 +01:00
Green Sky
7dfa935ac8
fix: missing net to host conversion of port in logging in group_chat.c 2022-10-04 03:41:17 +02:00
jfreegman
856e4fed8a
Fix bug causing friend group invites to sometimes fail & improve logging
The group privacy status was incorrectly set to private when a peer
accepted a friend's group invite, which would cause handshake requests
to fail in certain scenarios
2022-10-01 14:40:35 -04:00
Green Sky
8054854b58
fix: missing net to host conversion of port in logging 2022-10-01 20:22:11 +02:00
jfreegman
0a277b52ea
Merge the remainder of the new groupchats implementation
Commit history: https://github.com/jfreegman/toxcore/tree/ngc_jf
Spec: https://toktok.ltd/spec.html#dht-group-chats
2022-09-22 11:16:08 -04:00
Green Sky
d3819b23b3
refactor: extract each case in handle packet in messenger 2022-09-19 20:44:16 +02:00
sudden6
306693aba3
fix: unlock correct dht_friend 2022-08-07 15:37:10 +02:00
sudden6
9a265804f8
chore: update bootstrapd hash 2022-05-25 21:04:21 +02:00
iphydf
50094b7385
test: Add a protocol dump test to generate initial fuzzer input. 2022-04-19 23:42:47 +00:00
Robin Linden
3a5da3588f
Release 0.2.18 2022-04-18 20:12:07 +02:00
zoff99
6b0d1151ac
fix: remove the assert because buffer can be larger than UINT16_MAX. 2022-04-18 17:14:02 +02:00
zugz (tox)
452a02f729
cleanup: remove unused field last_seen from Onion_Friend 2022-04-17 11:01:37 +00:00
iphydf
19b9cf3812
test: Enable fuzzing for TCP.
If the `recvbuf` network function returns 0 all the time, that means
there is never any data available on the TCP socket. This change makes
it so there is a random amount of data available on the TCP socket.

This invalidates the bootstrap fuzzer corpus.
2022-04-14 13:19:56 +00:00
iphydf
efea12ed6f
Revert "fix: Allow onion paths to be built from more random nodes."
This reverts commit 5073882e0f.
2022-04-11 11:56:43 +00:00
iphydf
365ecd57f2
refactor: Move crypto utilities from util to crypto_core.
This makes more sense as a module for them to live in. Now, util no
longer depends on crypto_core and can thus potentially be used in
crypto_core in the future (functions like min/max may be useful).
2022-04-10 23:27:15 +00:00
iphydf
d78ee9b12e
fix: Fix potential array out-of-bounds in DHT random node retrieval.
It can't happen in almost every reality, except when the RNG is fairly
broken and doesn't add 2 fake DHT friends on startup. Still, this code
should be defensive and never index outside `num_friends` elements.
2022-04-10 23:17:15 +00:00
iphydf
5073882e0f
fix: Allow onion paths to be built from more random nodes.
Right now it only gets built from the first 2 friends in the DHT friend
list: either friend 0 and then 1 or friend 1 and then 0. The randomness
in this code doesn't make sense unless the intention was to select from
all friends, which the code will now do.

Also: use uniform random distribution to select the friends rather than
modulus, which is only uniform for powers of 2.
2022-04-10 22:10:32 +00:00
zugz (tox)
417d28d439
fix: really fix overrun added in e49a477a 2022-04-10 00:00:00 +00:00
jfreegman
7e38ead415
Add missing return on error
Note: This code cannot presently be called
2022-04-08 19:23:12 -04:00
zugz (tox)
697e8d0264
fix leak and overrun added in e49a477a 2022-04-07 00:00:00 +00:00
iphydf
cb34fe12d1
test: Add more functionality to the bootstrap harness.
Ideally this would be able to reach some of the events, so we can write
code to respond to those events, but so far only the friend request
event actually happens.
2022-04-07 20:17:56 +00:00