62 Commits

Author SHA1 Message Date
irungentoo
c959f6c019
Added function to check if we were only connected to LAN DHT peers. 2014-08-18 18:56:02 -04:00
Marc Schütz
9762089bad Const-correctness for onion_client.c 2014-06-30 21:41:03 +02:00
irungentoo
07936960df
Astyle and fixes. 2014-06-10 18:35:55 -04:00
Marc Schütz
99d5940140 Const correctness in various interdependent files 2014-06-10 20:54:48 +02:00
irungentoo
d87c772a7e
Reduced size of get_node packets.
Sendback data is now 8 bytes.

This does not break the network as the sendback data can be any
size between 1 and 150 bytes.
2014-05-28 17:59:48 -04:00
irungentoo
a05ab89dbf
pack/unpack nodes can now pack and unpack TCP nodes. 2014-05-13 14:53:59 -04:00
irungentoo
a26ced5fcb
Merge branch 'master' into TCP 2014-05-08 18:26:01 -04:00
irungentoo
deb8bfc350
Random number functions belong in crypto_core. 2014-05-01 19:42:44 -04:00
irungentoo
c16928c4aa
MAX_SENT_NODE is now 4.
This means that in every part of the Tox code that sends nodes
will now send a maximum of 4 nodes instead of 8.
2014-04-25 09:15:53 -04:00
irungentoo
a79eafbb52
The data in the DHT get nodes and send nodes packets can now be of
variable length.
2014-04-25 09:02:49 -04:00
irungentoo
0559904ea2
Updated some files so that they could build with latest core.
Fixed some issues.
2014-04-23 12:29:24 -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
Carlos E. Garcia
cf33c2f9ad multiple spelling fixes 2014-04-16 12:14:44 -04:00
irungentoo
f9bf7b074a
Major protocol changes, this commit breaks all network compatibility.
Removed a bunch of useless space from various structs.

pack_nodes() and unpack_nodes() are now used to transmit lists of
nodes for the DHT and onion parts. They provide a way to transmit
both ipv6 and ipv4 nodes in the same packet in a portable way that
takes as little space as possible without compression.

Using pack_nodes, merged the send nodes and send nodes ipv6 packets
into one packet greatly reducing the risk of amplification attacks.
2014-04-15 18:09:07 -04:00
irungentoo
f9c9b263e0 Renamed toping to to_ping. 2014-03-16 13:57:21 -04:00
irungentoo
3bcc6e2ae5 CPU optimizations.
Use get_shared_key() in more places.
2014-03-05 16:54:17 -05:00
irungentoo
b6fe49e59a CPU usage improvements.
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-04 15:36:29 -05:00
irungentoo
718b5e8ca3 Speeded up DHT peer finding and decreased DHT bandwidth usage. 2014-02-24 17:14:47 -05:00
irungentoo
86ba735198 Improved hole punching a bit. 2014-01-25 21:09:26 -05:00
irungentoo
3268f18a32 Some small improvements added. 2014-01-19 14:14:23 -05:00
irungentoo
d11cf9c5a8 Small performance increases. 2014-01-17 15:46:09 -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
9fcb707ec4 Wrote random_path function.
Added onion_client to the build system.
2014-01-16 10:00:36 -05:00
irungentoo
aff78b159c onion_client almost done. 2014-01-15 20:47:26 -05:00
irungentoo
97a141c0cc Some work done on the onion announce part. 2014-01-02 22:33:46 -05:00
irungentoo
86aff82a9f Another packet type added to onion.c 2013-12-27 15:21:16 -05:00
irungentoo
dfd46a040a Merge branch 'assoc-refresh-distant-data' of https://github.com/FullName/ProjectTox-Core into FullName-assoc-refresh-distant-data 2013-12-12 21:51:17 -05:00
irungentoo
48c50b5cef Send groupchat ips like DHT ones. 2013-12-08 18:23:30 -05:00
irungentoo
a4968bdbc5 Compatibility fixes.
AF_INET/AF_INET6 can vary across devices, we introduce TOX_AF_INET and
TOX_AF_INET6 to fix this.
2013-12-08 18:15:30 -05:00
Coren[m]
ad9d20c08b
do_Assoc(): keep the data of the buckets somewhat current 2013-12-08 05:43:24 +01:00
irungentoo
7cd43ecc76 Merge branch 'master' into harden 2013-12-06 22:51:17 -05:00
alexandervdm
a93d76a958 fix 'typedef redefinition' build errors on older gcc versions
building toxcore
2013-12-01 21:06:20 +01:00
irungentoo
fcc1463fe1 The stuff in do_DHT only need to be run once per second.
Should lower CPU usage by a bit.
2013-11-30 21:52:50 -05:00
Coren[m]
b132c92b3a
Assoc's array is now allocated dynamically and per default much smaller (320 entries).
id_hash() was not at all working as expected for very small bucket size (when (size / 4) was zero). Simplified to be trivially correct.
Also added a used flag on adding an entry, which is set by callers if they have that association in active use. Those get priority over unused entries on collision.
Fleshed out test to be at least elementary useful.
Each group chat now uses an own, small assoc (80 entries).
2013-11-17 01:05:00 +01:00
Coren[m]
0d8329b3a9
Significantly trimmed down version of an ID<=>IP cache.
Besides acknowledging timeouts, the module isn't trying to do anything fancy with the data besides storing and retrieving.
2013-11-14 19:05:53 +01:00
irungentoo
4943054742 Fixed small issues.
DHT_test now only prints non zero entries.
2013-11-10 17:57:24 -05:00
irungentoo
91c9dc2464 Get node testing response packets are now handled. 2013-11-02 23:04:03 -04:00
irungentoo
beaa31bebc Testing requests are now sent. 2013-10-30 19:50:06 -04:00
irungentoo
988922bdeb Removed some now useless code. 2013-10-28 15:52:46 -04:00
irungentoo
a6edd9dad6 Base of hardening stuff. 2013-10-26 17:35:55 -04:00
irungentoo
55692665dc Removed now useless ping_id from send/get node packets. 2013-10-24 18:59:00 -04:00
irungentoo
f7b90f1060 Adding encrypted data to send/getnode packets now done. 2013-10-24 17:39:14 -04:00
Coren[m]
a0f08839bd Main: Eliminate TOX_ENABLE_IPV6 (then always on), CLIENT_ONETOONE_IP (then always off).
Additionally (besides cleanups):

network.h/tox.h:
- WIN32: fix a strange sa_family_t definition
- WIN32: define EWOULDBLOCK to WSAEWOULDBLOCK
- WIN32: kill macro for an existing function (IN6_ADDR_EQUAL)

network.c:
- use EWOULDBLOCK instead of EAGAIN (same value, but EWOULDBLOCK is more "popular")
- new_networking(): only try to enable IPv4-in-IPv6 if it's not already enabled per default
- inet_ntop()/inet_pton(): WIN32: remove partial initializers in favor of a simple memset()
- ip_equal(): WIN32: use an existing function
- logging: networking_wait_execute(): only dump result if not timeout
- logging: loglogdata(): kill an unused variable

LAN_discovery.c:
- send_broadcasts(): re-enabled, can only support IPv4 by principle, split into fetch_broadcast_info() (to fetch the addresses once) and send_broadcasts() (actual sending)

DHT.c:
- DHT_load_state_callback(): enclosed a fprintf(stderr, ...) into #ifdef DEBUG

Lossless_UDP.c:
- change_handshake(): harden against strange sa_family_t definitions

Messenger.c:
- logging: fix ID to string conversion

util.c:
- logging: eliminate a signed-warning
2013-10-20 16:56:12 +02:00
Coren[m]
9de295374d expanded Client_data to hold two addresses (IPv4, IPv6) instead of one
Compilerflag: CLIENT_ONETOONE_IP (to define in DHT.h, default unset i.e. NEW case: two addresses)

Every function in DHT{_test}.c working on Client_data has been rewritten to store IPv4 addresses in assoc4, IPv6 addresses in assoc6.
Loading/Storing of states defined with other compiler switch is transparently adjusting to the differences.

DHT.h, DHT.c:
- introduction and handling of the structure changes

DHT_test.c, Messenger.c:
- logging adapted to new structures

util.h:
- LOGGING isn't undefined per default anymore
2013-09-27 03:27:52 +02:00
Coren[m]
88678e584a moved stuff that belongs into ping.[ch] there
DHT.*, ping.*:
- moved stuff from struct DHT into struct PING: toping, last_toping
- moved functions add_toping(), do_toping()
- made id_closest() publicly accessible
- send_ping_request(): killed (Net_Crypto *c) parameter in favor of copying it into (PING *) on new_ping()

group_chats.c:
- killed local 1:1 copy in favor of DHT.c::id_closest()
2013-09-21 15:39:15 +02:00
Coren[m]
57d10f0a80 Merge remote-tracking branch 'upstream/master' into MessengerLoadSave
Conflicts:
	toxcore/Messenger.c
	toxcore/util.c
	toxcore/util.h
2013-09-16 09:29:08 +02:00
irungentoo
12d1c5199b astyled everything. 2013-09-14 12:42:17 -04:00
Coren[m]
87f5f9d4eb State loading/saving: Instead of a blob, segment into sections marked with tags.
Primary rationale: The part that DHT saves changes if IP is expanded to IPv6. To let people keep their friends/name, change the datafile format now, while everybody is still on the same page.

Loading/Saving rewritten to allow a part of the file to be incomprehensible to the loading routine.
Added a magic cookie at the beginning to mark the file as tox's.
Changes in some part of the datafile can be skipped and the remaining parts still be consumed.
Allows a wide margin of forward compatibility (like the IP to IPv6 transition, but also e.g. a change in the key format).
As long as the file is not completely garbled, the routine will read as much as possible. Only the KEY section is considered mandatory: a malformed key section leads to a negative result.

util.*:
- holds the driving function which jumps from section to section and calls back with section length and tag (type)

Messenger.c,DHT.*:
- new loading functions call the util-function with a callback, which subsequently consumes the sections
- old routines are kept to fall back onto if the magic cookie at the beginning isn't present
- saving is still done in one local routine
2013-09-13 18:05:11 +02:00