Commit Graph

214 Commits

Author SHA1 Message Date
irungentoo
2ea634ece2
Set packets_left to default non zero values when creating connection. 2014-07-14 16:37:43 -04:00
irungentoo
4da8664a15
Packets can now be sent from the connection status callback. 2014-07-14 16:23:19 -04:00
irungentoo
0244bd596d
Attempted fix of file transfer issue.
Instead of dropping the rate to minimum just half it until it drops
to the minimum.
2014-07-14 12:21:13 -04:00
notsecure
a5d2775c25 . 2014-07-11 10:23:40 -04:00
notsecure
e2d388b137 fix send rate going up when peer disconnects 2014-07-10 10:34:38 -04:00
irungentoo
6d4fdb3597
Merge branch 'const_correctness' of https://github.com/schuetzm/ProjectTox-Core 2014-07-02 15:41:59 -04:00
Marc Schütz
aba594d1f8 Const-correctness for toxcore/net_crypto.c 2014-06-30 21:26:51 +02:00
Marc Schütz
8391417f61 Const correctness for toxcore/Messenger.c and related files 2014-06-30 21:26:50 +02:00
irungentoo
8f7638da5c
Core should no longer attempt to send data faster than the links can
carry it.
2014-06-29 20:46:06 -04:00
irungentoo
a058a17273
Fixed some more possible issues with file transfers/conjestion control. 2014-06-25 15:04:34 -04:00
irungentoo
eb2688b715
Tweaked conjestion control algorithm.
File transfers should now work better.
2014-06-25 13:23:56 -04:00
Maxim Biro
a32d270330 Reduced number of realloc calls bs_list does 2014-06-20 20:22:03 -04:00
irungentoo
750c75a47d
Astyled code. 2014-06-15 10:36:57 -04:00
Marc Schütz
4940c4c62b Const correctness for various packet callbacks 2014-06-13 22:55:15 +02:00
irungentoo
2740099da0
pthread is now a core dependency instead of just a toxav dependency.
Fixed possible thread bug with sending A/V packets.

TODO: eventually make toxcore thread safe.
2014-06-12 11:15:20 -04:00
Marc Schütz
99d5940140 Const correctness in various interdependent files 2014-06-10 20:54:48 +02:00
irungentoo
7adefb6e6b
Renamed list functions to fix conflict issue on certain machines. 2014-06-06 13:23:21 -04:00
irungentoo
a4ac1497a5
Fixed regression that made packet_send_rate increase even when
no data was transmitted.
2014-06-05 19:16:03 -04:00
irungentoo
94a675f3e9
Optimized net_crypto UDP packet sorting using list. 2014-06-05 18:05:17 -04:00
irungentoo
aa256d5858
Doubled minimum transfer rate.
File transfers got stuck because it was too low.
2014-06-04 17:55:07 -04:00
irungentoo
dc6f46a240
Request packets are now sent with send_data_packet_helper().
This means all data packets are now padded the same way.
2014-06-04 17:35:38 -04:00
irungentoo
b44b58cae4
Added data packet padding to toxcore.
Data sent as lossless or lossy is now padded with:
((MAX_CRYPTO_DATA_SIZE - data_length) % CRYPTO_MAX_PADDING) bytes
in order to reduce the possibility of length related attacks.

I set CRYPTO_MAX_PADDING to 8 but it can be changed anytime without
breaking network compatibility between tox cores.
2014-06-04 13:28:56 -04:00
irungentoo
de5a33e852
Tweaked file transfers a bit. 2014-06-03 20:17:31 -04:00
irungentoo
4eecaf3ee6
Increased some timeouts to try to prevent disconnections when
transferring files on wireless networks.
2014-06-02 19:35:49 -04:00
irungentoo
89bf08287d
Renamed tox_do_run_interval to tox_do_interval.
tox_do_interval now returns a time in ms based on how much action
is going on in net_crypto.
2014-05-30 23:01:17 -04:00
notsecure
5346af8067 file transfer fixes
-removed rate limit
-send rate no longer gets reset on local/LAN connections
2014-05-26 13:33:19 -04:00
notsecure
e3bc591b3b more conjestion control
needs testing
2014-05-22 20:19:19 -04:00
notsecure
1e4eb83880 improved conjestion control 2014-05-21 20:49:37 -04:00
irungentoo
f818c1a197
Added functions to send and receive lossy encrypted packets over
the Tox connection.

A/V should now work over TCP.
2014-05-21 15:28:14 -04:00
irungentoo
d68197b895
Save a couple TCP relays on save and reconnect to them on load.
Removed some old code.
2014-05-18 13:45:33 -04:00
irungentoo
d573271f03
Fixed connection issue. 2014-05-18 12:15:57 -04:00
irungentoo
e87929e869
TCP branch now ready for start of real testing.
Friends can now exchange TCP relay addresses so that they can
connect together.

Currently all bootstrap nodes are treated as TCP relays.
2014-05-18 10:55:38 -04:00
irungentoo
9d4947ffa5
add_tcp_relay_peer() can be used to add relays that we know that
peer is connected to.

Some cleanups/fixes.
2014-05-17 21:30:52 -04:00
irungentoo
b5f84b33f7
net_crypto now works again on pure UDP. 2014-05-17 15:23:16 -04:00
irungentoo
60ed415a5a
Added a function to get the DHT public key stored in net_crypto.
The DHT public keys in onion_client/net_crypto are synced and set
to whichever is more recent.

Tox peers now try to connect directly even when already connected
with a TCP relay.
2014-05-17 14:56:20 -04:00
irungentoo
a5da6df144
Net_crypto can now handle packets sent as TCP OOB packets.
Added timestamp to know which DHT public key is good in case
onion_client and net_crypto report different ones.
2014-05-17 12:33:22 -04:00
irungentoo
454cadb91c
Changed cookie/cookie request packet.
Cookie now contains the dht public key of the peer which makes
more sense than including the real public key of the reciever.

It means we no longer have to rely entirely on onion_client to
find the dht public key of the other peer.
2014-05-17 09:21:07 -04:00
irungentoo
86c191c2d4
Fixed typo. 2014-05-16 17:50:26 -04:00
irungentoo
3ab05b6e2e
Some TCP code added to net_crypto.
add_tcp_relay() can be used to connect to some TCP relays.

If both Toxes are connected to the same TCP relay(s) and create a
connection on which they set the others dht_public_key, they will
connect.
2014-05-16 17:29:50 -04:00
irungentoo
1e7164fcee
Fixed possibility that packet_send_rate would get stuck. 2014-05-15 16:49:39 -04:00
irungentoo
2ea0657a6d
Fixed some issues.
Friends with multiple ips (on LAN) should be handled better.

Remade the function to check the crypto connection status.
2014-05-12 20:59:51 -04:00
irungentoo
87cec79206
Fixed issue where callbacks were not set for accepted connection. 2014-05-11 19:35:23 -04:00
irungentoo
1580a5c696
Added kill packets.
There should be no more delay between a peer closing their client
and their friend being notified of them going offline. (unless the
kill packet is lost)
2014-05-11 18:27:23 -04:00
irungentoo
1e485b2c2f
Added basic congestion control to net_crypto. 2014-05-10 13:42:59 -04:00
irungentoo
b0731f54cd
Fixed small issues.
Added set_buffer_end().

File transfer test now checks if pieces arrive correctly.
2014-05-09 21:46:37 -04:00
irungentoo
98f20c76de
Connection between toxes is lossless once again. 2014-05-08 18:04:46 -04:00
irungentoo
32c8d5114c
Fixed bug. 2014-05-05 10:00:37 -04:00
irungentoo
fca5e1b99a
Added arrays to store packets on send/recv in net crypto.
Wrote down more of the protocol.

Padding support has been added and implemented which will make it
possible for us to pad packets to mitigate length related attacks.
2014-05-04 20:04:43 -04:00
irungentoo
4dc0af61c6
All time in core is now monotonic. 2014-05-03 11:58:45 -04:00
irungentoo
db78c99ff4
Messenger now works with the new net_crypto api.
Added callbacks in net_crypto for the data packets and status changes.

Added onion_getfriend_DHT_pubkey to onion_client.

Net crypto isn't done yet so connections between toxes are not
lossless, this means file sending is broken hence why the test fails.
2014-05-02 21:25:23 -04:00
irungentoo
8ae0a79305
Move the handshake creating code to a function.
Fixed another instance where it was not sent.
2014-05-02 15:59:13 -04:00
irungentoo
8b29ac8eae
Fixed one case of the handshake not being sent. 2014-05-02 15:25:18 -04:00
irungentoo
aca18f65c3
Small fixes. 2014-05-02 15:13:10 -04:00
irungentoo
8e24771fc4
Remove Lossless UDP (This breaks Tox.) 2014-05-02 10:36:48 -04:00
irungentoo
47aa53a384
Protocol implementation is starting to look ok.
Still need to decide exactly how data packets will work though.
2014-05-01 19:20:28 -04:00
irungentoo
509edb983f
Remove duplicates. 2014-04-30 21:01:09 -04:00
irungentoo
5715e50169
Some more code written for the middle level protocol stuff. 2014-04-30 20:53:43 -04:00
irungentoo
0505df009b
Added number to cookie request/response packets to prevent possible
DoS issue.
2014-04-30 09:24:05 -04:00
irungentoo
3863e01e22
Some more work done on the middle network protocol.
Handshake most likely has no more possible flaws to it, next thing
to do is to do the same with the data packets.

Wrote a couple more functions.
2014-04-29 20:45:32 -04:00
irungentoo
b9370d519f
Added some functions to create/handle middle level protocol packets. 2014-04-28 20:14:07 -04:00
irungentoo
50cea69f57
Added raw UDP cookie request packet handler. 2014-04-27 20:37:59 -04:00
irungentoo
384750af8c
Major cleanups.
Fixed circular dependency between DHT and net_crypto: DHT no longer
depends on net_crypto.

Moved the crypto request packets functions to crypto core and DHT.

Cleaned up/added some defines that can be used to get the true maximum
length of things like the friends request message.

MAX_DATA_SIZE has been replaced in most places by more appropriate defines.
2014-04-23 11:35:40 -04:00
irungentoo
1bfe15ee88
Decided pretty much how the handshake would work.
Started writing the code.

Astyled some files.
2014-04-22 20:28:40 -04:00
irungentoo
9c6a8432ce Crypto related cleanups.
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-21 16:51:36 -04:00
irungentoo
9f6b17de55
Added function to increment nonce by specified number.
Nonces now behave like big endian numbers.
2014-04-18 20:36:52 -04:00
irungentoo
e95494482f A bit of work done on the TCP relay server. 2014-03-15 22:11:36 -04:00
irungentoo
d058a59ccf Fixed some possible ways connections could linger indefinitely without being killed. 2014-03-07 16:05:08 -05:00
irungentoo
a251e71a97 Some small changes/fixes.
Changed some timeouts and made cryptopacket_handle return correctly.
2014-03-03 20:46:34 -05:00
irungentoo
cd2474a2f6 Incorporated onion into Tox.
Fixed a couple of issues related to that.
2014-01-17 13:35:40 -05:00
irungentoo
878762a8e4 Added functions to add/remove friends in onion_client.
Added a tiny optimization to net_crypto.
2014-01-13 20:11:54 -05:00
irungentoo
977aab7f2f It makes more sense for new_keys() to be in new_net_crypto() 2013-12-26 09:47:35 -05:00
irungentoo
83cb946db0 Removed upper size limit from encrypt and decrypt_data_symmetric. 2013-12-21 19:42:30 -05:00
irungentoo
cbee548b0a Fixed arm bug. 2013-12-12 13:49:49 -05:00
irungentoo
606c2c12ab Small fixes. 2013-12-07 21:13:07 -05:00
irungentoo
beaa31bebc Testing requests are now sent. 2013-10-30 19:50:06 -04:00
irungentoo
415835ce3d Merge branch 'master' into harden
Also removed some old, useless loading code.
2013-10-28 16:01:29 -04:00
irungentoo
d2ab13c611 Cleaned up some code/fixed some warnings.
I'm sure nobody has any of the old save files anymore so I removed the
functions.
2013-10-27 20:25:31 -04:00
irungentoo
9ccdac0e82 All modules using unix_time should run unix_time_update() 2013-10-25 14:47:34 -04:00
irungentoo
b891446c31 For security reasons, keep memcpy's and memcmp's in crypto functions. 2013-10-25 14:43:47 -04:00
Coren[m]
065495cd7c Merge remote-tracking branch 'upstream/master' into cleanup_unix_time_id_eq_cpy_is_timeout
Conflicts:
	toxcore/net_crypto.c
2013-10-24 22:47:23 +02:00
Coren[m]
0a4c3d7e2e Move unix_time(), id_cpy()/id_eq(), is_timeout() to util.*
unix_time():
- returns local value for current epoch
- value is updated explicitly with unix_time_update() called at new_DHT()/doMessenger()/do_DHT()

is_timeout():
- uses the local value for current epoch

id_cpy()/id_eq() => id_copy()/id_equal():
- centralized duplicate definitions
- replaced (most) memcpy()/memcmp() of (*, *, CLIENT_ID_SIZE) with id_copy()/id_equal()
2013-10-24 22:32:28 +02:00
irungentoo
bba10544e7 Added symmetric crypto functions to net_crypto. 2013-10-24 15:55:52 -04:00
irungentoo
8e0ab68d30 Removed define that could become confusing. 2013-10-24 13:34:04 -04:00
irungentoo
a67b4f8c6d Code cleanups. 2013-10-23 14:32:09 -04:00
Bahkuh
f581e20233 This squash should work now. 2013-10-22 20:24:48 +02:00
irungentoo
147d820ad2 Fixed connection sometimes being too slow and some other possible problems. 2013-10-19 22:29:48 -04:00
irungentoo
6ef2b5ead6 Code cleanups. 2013-10-06 17:40:23 -04:00
irungentoo
edf799133c Fixed some possible bugs. 2013-10-04 11:20:47 -04:00
irungentoo
aae9fae257 Fixed possible problem. 2013-09-28 20:50:54 -04:00
irungentoo
d4e42230bd Potential DoS fixed. 2013-09-28 19:03:29 -04:00
Coren[m]
6fe25e4f6f Permit -Wshadow as useful warning. 2013-09-27 11:24:33 +02:00
irungentoo
beff2b6de6 Possible bug fixed. 2013-09-25 13:19:19 -04:00
irungentoo
0d54a675ec Removed unused variables. 2013-09-22 14:25:52 -04:00
irungentoo
83c6e9dd35 Fixed the connection bug and cleaned up some stuff. 2013-09-22 11:08:23 -04:00
irungentoo
a6abf007cb Connection speed ups. 2013-09-21 09:33:44 -04:00
irungentoo
3e4599e33a Lossless UDP is now suitable for sending files.
Added some actual flow control and made send/recieve buffers grow when
necessary.
2013-09-21 09:03:54 -04:00
irungentoo
5a83c1296c astyled everything. 2013-09-17 16:28:39 -04:00
Sebastian Stal
96d39de223 Fix leaks and null dereferences in net_crypto 2013-09-15 10:48:16 -07:00
Coren[m]
fa576e464e Merge remote-tracking branch 'upstream/master' into Integration 2013-09-13 19:44:14 +02:00
irungentoo
339dcd6070 Nonce generation changes.
Nonces don't need to be random, only different.

also random_int now gives same quality random numbers for both NaCl and
libsodium.
2013-09-13 10:42:14 -04:00
Coren[m]
bcb283cf45 big push, putting all the infrastructure in place behind TOX_ENABLE_IPV6 2013-09-10 16:36:20 +02:00
Jin^eLD
e092eee869 Allow to build vs nacl instead of libsodium
By default libsodium is used. Only if --enable-nacl is specified, then
nacl will be used instead of libsodium.

Pass locations of nacl headers and libraries by using the following
options:

--with-nacl-headers=/home/me/somewhere/nacl-20110221/build/469/include/amd64/
--with-nacl-libs=/home/me/somewhere/nacl-20110221/build/469/lib/amd64/
2013-09-06 22:54:45 +03:00
irungentoo
bb35305d94 Merge branch 'group-chats' 2013-09-05 17:02:23 -04:00
irungentoo
31f43799e1 Fixed small problem. 2013-09-04 07:26:30 -04:00
irungentoo
c59975dd7e Work in progress group chats.
Not done yet.
2013-09-03 08:53:07 -04:00
irungentoo
b73ba8244a Removed useless code, possibly fixed something. 2013-09-02 16:52:09 -04:00
irungentoo
a4bf25801d Merge branch 'master' of https://github.com/JamoBox/ProjectTox-Core into JamoBox-master 2013-09-02 15:59:28 -04:00
JamoBox
7b944e9c65 comment updates 2013-09-02 17:12:02 +01:00
irungentoo
5233656561 Properly fixed signed/unsigned comparisons. 2013-09-02 09:55:37 -04:00
Tyler Bunnell
d1c52788c5 Fix signed/unsigned comparison warnings 2013-09-01 20:42:59 -06:00
Kostya
25563ac070 Fixed build errors. 2013-08-30 03:28:50 -04:00
irungentoo
ea994606fe Merge branch 'master' of https://github.com/JamoBox/ProjectTox-Core into JamoBox-master
Conflicts:
	toxcore/LAN_discovery.h
2013-08-29 17:55:58 -04:00
pete
82b8927af7 Correct a lot of the grammar and spelling. Also spent a few hours fixing the comments so they follow a standard. 2013-08-29 22:17:51 +01:00
jin-eld
e658892793 Rename core directory because of autoconf name clash
While doing the checks configure might generate "core" files and will
then try to remove them. Having a "core" directory generates an error
while runing the configure script.

There's no workaround but to rename the core directory.
2013-08-24 03:25:07 +03:00