summaryrefslogtreecommitdiff
path: root/toxcore/ping.c
AgeCommit message (Collapse)Author
2020-05-02Fix errors on error paths found by oomer.iphydf
* Use-after-free because we free network before dht in one case. * Various unchecked allocs in tests (not so important). * We used to not check whether ping arrays were actually allocated in DHT. * `ping_kill` and `ping_array_kill` used to crash when passing NULL. Also: * Added an assert in all public API functions to ensure tox isn't NULL. The error message you get from that is a bit nicer than "Segmentation fault" when clients (or our tests) do things wrong. * Decreased the sleep time in iterate_all_wait from 20ms to 5ms. Everything seems to still work with 5ms, and this greatly decreases the amount of time spent per test run, making oomer run much faster.
2020-03-14Use spdx license identifier instead of GPL blurb.iphydf
2018-08-26Update copyright to 2018.iphydf
2018-08-16Use per-instance `Mono_Time` for Messenger and onion.iphydf
2018-07-09Factor out time keeping code into its own module: mono_time.c.iphydf
It turns out, `unix_time` is also monotonic, and is used as such, so I've renamed the new functions to `mono_time_*`. 2018-07-08: ``` 00:01 <@irungentoo> the idea used to be that the unix_time() function could go backward in time but I think I might have started using it like if it could not after I changed it so that it would never go back in time ```
2018-07-05Make tox.c unambiguously parseable.iphydf
Rules: 1. Constants are uppercase names: THE_CONSTANT. 2. SUE[1] types start with an uppercase letter and have at least one lowercase letter in it: The_Type, THE_Type. 3. Function types end in "_cb": tox_friend_connection_cb. 4. Variable and function names are all lowercase: the_function. This makes it easier for humans reading the code to determine what an identifier means. I'm not convinced by the enum type name change, but I don't know a better rule. Currently, a lot of enum types are spelled like constants, which is confusing. [1] struct/union/enum
2018-05-20Finish @Diadlo's network Family abstraction.iphydf
The Family stuff in toxcore is a big mess. I'm sure I saw a bunch of bugs on the way, but I'm not verifying that code now, so the bugs stay.
2018-05-20Move system header includes from network.h to network.ciphydf
2018-01-30Use nullptr as NULL pointer constant instead of NULL or 0.iphydf
This changes only code, no string literals or comments.
2018-01-16Make DHT a module-private type.iphydf
2018-01-14Use apidsl to generate ping.h.iphydf
The ping.api.h file looks rather ugly, but it works. This is an exercise in finding the complete set of use cases needed from apidsl for toxcore. We'll try to make things work as much as possible, and then make apidsl better and make the .api.h files pretty.
2018-01-13Make Ping_Array a module-private type.iphydf
2017-08-24AF_INET -> TOX_AF_INETDiadlo
2017-01-19Update license headers and remove redundant file name comment.iphydf
"All rights reserved" was incorrect. The project was licensed under GPL3, which means a lot of rights are licensed to everybody in the world, i.e. not reserved to the "Tox Project".
2016-12-22Wrap all sodium/nacl functions in crypto_core.c.iphydf
2016-11-09Remove new_nonce function in favour of random_nonce.iphydf
`new_nonce` has been an alias for `random_nonce` for a while now. Having two names for the same operation is confusing. `random_nonce` better expresses the intent. The documentation for `new_nonce` talks about guaranteeing that the nonce is different from previous ones, which is incorrect, it's just quite likely to be different.
2016-09-24Make toxcore code C++ compatible.iphydf
It is still C code, so still compatible with C compilers as well. This change lets us see more clearly where implicit conversions occur by making them explicit.
2016-09-13Add some astyle options to make it do more.iphydf
It now enforces a bit more formatting. In particular, padding inside parentheses is removed. I would like it to remove padding after unary operators, but there seems to be no option for that.
2016-09-13Group #include directives in 3-4 groups.iphydf
1. Current module (if C file). 2. Headers from current library. 3. Headers from other library (e.g. toxcore includes in toxav). 4. System headers.
2016-09-01Sort #includes in all source files.iphydf
2016-08-31Add braces to all if statements.iphydf
2016-08-18Make tox_callback_friend_name stateless.iphydf
See #27 and #40 for details.
2016-01-27 fix: compare sensitive data with sodium_memcmpRoman Proskuryakov
fix: make increment_nonce & increment_nonce_number independent of user-controlled input fix: make crypto_core more stable agains null ptr dereference
2016-01-04DHT improvements part 1.irungentoo
2015-12-16Improved the to_ping list.irungentoo
2015-12-08uint32_t -> unsigned int.irungentoo
2015-12-08Forgot to stage this before committing.irungentoo
2015-12-08If we receive a packet from a node we are searching for, ping it.irungentoo
2015-08-07Removed a useless define.irungentoo
2015-07-29client_id -> public_keyirungentoo
2015-05-07Only set last_to_ping if at least one node was pinged,irungentoo
2015-01-29Code cleanups.irungentoo
Rename array in Node_format from client_id to public_key.
2014-11-21Cleaned up packet length types in toxcore.irungentoo
They are now all uint16_t instead of sometimes being uint32_t. Replaced some other uint32_t with unsigned ints.
2014-08-31Tweaked some values in DHT to decrease the discovery time mainlyirungentoo
for the auto tests.
2014-06-13Const correctness for various packet callbacksMarc Schütz
2014-06-10Const correctness in various interdependent filesMarc Schütz
2014-05-19Fixed a bug where someone could just send back the ping request packetirungentoo
with only the first byte set to 1 instead of 0 and the public key set to the one of the reciever as a valid response packet. This breaks network compatibility with all previous cores.
2014-05-13Nodes already in the DHT closelist should not be added to the toping list.irungentoo
2014-05-12Added ping_array, a special efficient array for use in operationsirungentoo
that require sending ping type packets. Made ping packets use it.
2014-04-22Decided pretty much how the handshake would work.irungentoo
Started writing the code. Astyled some files.
2014-04-21Crypto related cleanups.irungentoo
Moved Bunch of functions from net_crypto to crypto_core. decrypt_data_fast and decrypt_data_symmetric were the same thing therefore, removed decrypt_data_fast. Replaced all the crypto_secretbox_* defines with the equivalent crypto_box_* one. New define: crypto_box_KEYBYTES that is equal to crypto_box_BEFORENMBYTES.
2014-04-16Some speedups and small fixes.irungentoo
2014-03-16Renamed toping to to_ping.irungentoo
2014-03-05CPU optimizations.irungentoo
Use get_shared_key() in more places.
2014-03-04CPU usage improvements.irungentoo
Shared keys for recieved DHT packets are now stored in a special array so that they don't need to be recomputed for nodes that send us lots of packets.
2014-03-02Small CPU optimizations to ping requests/reponses.irungentoo
Same idea as last commit.
2014-03-01Some small DHT CPU optimizations.irungentoo
Only compute the shared key once instead of twice for received DHT requests/responses.
2014-01-25Improved hole punching a bit.irungentoo
2014-01-17Incorporated onion into Tox.irungentoo
Fixed a couple of issues related to that.
2013-12-08Cleaned up and fixed various things.irungentoo