Commit Graph

3449 Commits

Author SHA1 Message Date
irungentoo
b6377dfd25 Merge pull request #580 from FullName/networking_test
Fix in ip_equal, plus testing code which led to that fix...
2013-09-15 15:53:34 -07:00
Coren[m]
ee1cc34d55 Fix in ip_equal, plus testing code which led to that fix...
network.c:
- use the correct macro for IPv4-in-IPv6 test

network_test.c:
- bunch of tests for addr_resolve() and ip_equal()
2013-09-15 23:39:09 +02:00
irungentoo
6bb9f94ff1 Merge pull request #581 from stal888/csafixes
Fix leaks and null dereferences in net_crypto
2013-09-15 11:45:12 -07:00
Sebastian Stal
96d39de223 Fix leaks and null dereferences in net_crypto 2013-09-15 10:48:16 -07:00
Coren[m]
6d3ac937af Merge remote-tracking branch 'upstream/master' into nTox 2013-09-15 19:07:54 +02:00
irungentoo
decdb7aa8c more portability fixes. 2013-09-15 10:17:09 -04:00
irungentoo
bbeb6e15cd Fixed portability problems. 2013-09-15 09:47:17 -04:00
irungentoo
43b609d41c Fixed merge problems. 2013-09-15 09:35:46 -04:00
irungentoo
fca574a0e0 Merge branch 'master' of https://github.com/irungentoo/ProjectTox-Core 2013-09-15 09:31:46 -04:00
irungentoo
8c41244627 Fixed portablity problems.
struct in6_addr member names can differ per platform.
2013-09-15 09:31:27 -04:00
irungentoo
f447027d9d Merge pull request #579 from FullName/Integration
IPv6: post-integration fixes
2013-09-15 05:06:55 -07:00
Coren[m]
16a6c9fb59 Merge remote-tracking branch 'upstream/master' into Integration 2013-09-15 08:54:14 +02:00
Coren[m]
1e1782a952 ip_equal(): handle embedded v4 vs. native v4 as equal
network.c:
- ip_equal(): on IPv4 vs. IPv6, check if the IPv6 is an embedded IPv4 and if true, compare that
2013-09-15 08:33:09 +02:00
Coren[m]
2092b5d936 addr_resolve() rewrite broke { (ipv6enabled == true) name => IPv4 address }
network.c:
- addr_resolve(): save AF_UNSPEC ip4 address into ip4, not into to->ip4
2013-09-15 08:20:37 +02:00
irungentoo
dde98eb345 DHT peer finding for new friends should now be slightly faster.
Also fixed the "[i] could not send message" bug in nTox.
2013-09-14 20:38:48 -04:00
irungentoo
20a8fb8a23 Fixed warnings. 2013-09-14 19:15:26 -04:00
irungentoo
04e7b0eb6c Fixed small problems, updated TODO. 2013-09-14 18:59:04 -04:00
irungentoo
18cfda2dc7 Small fixes. 2013-09-14 15:12:54 -04:00
irungentoo
46a99a8774 Fixed some warnings. 2013-09-14 12:57:41 -04:00
irungentoo
12d1c5199b astyled everything. 2013-09-14 12:42:17 -04:00
irungentoo
64d000cdfa Some fixes. 2013-09-14 12:41:14 -04:00
Coren[m]
0db05eca49 Save datafile when adding a friend/accepting a friend request.
(Note to self: make clean is your friend. Those extra seconds are well spent.)
2013-09-14 18:39:59 +02:00
Coren[m]
36e5636406 DHT.c:
- get_close_nodes(): refactored the inner loop out into get_close_nodes_inner()
2013-09-14 17:10:10 +02:00
Coren[m]
a7d059a130 network.c:
- addr_resolve(): for() instead of while(), flip conditions for a much neater function (suggested by Andreas Schneider)
- ip_ntoa(): enforced termination: terminate at the maximum position, that's the one snprintf() may forget
- networking_poll(): forgot tabs2spaces
2013-09-14 17:09:03 +02:00
Coren[m]
e818fce756 Merge remote-tracking branch 'upstream/master' into nTox 2013-09-14 13:32:39 +02:00
Coren[m]
d9965df382 LAN_discovery.c:
- LAN_ip(): use standard macro from IPv4-in-IPv6 test
2013-09-14 13:32:07 +02:00
Coren[m]
09cdd813c5 DHT.c:
- get_close_nodes()/sendnodes()/sendnodes_ipv6(): when selecting for SEND_NODES/SEND_NODES_IPV6, treat embedded IPv4-in-IPv6 addresses as being IPv4

Messenger.c:
- added a named constant for sixty seconds friend/client dump
- fix logging to convert client_id to printable before printing
2013-09-14 12:55:56 +02:00
Coren[m]
a341b259b6 Change sublength to 32 bits. Someone might have more than (sizeof(Friends) / 65536) friends... 2013-09-14 10:43:09 +02:00
Coren[m]
fa576e464e Merge remote-tracking branch 'upstream/master' into Integration 2013-09-13 19:44:14 +02:00
Coren[m]
d2603cf169 Merge remote-tracking branch 'upstream/master' into MessengerLoadSave 2013-09-13 18:43:04 +02: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
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]
f2ad7fd4ea Rename load_old_key_or_save_new_one() to load_data_or_init(). 2013-09-13 09:20:03 +02:00
Coren[m]
484615e67d Made (load_/save_)data() functions static. 2013-09-13 09:16:48 +02:00
Coren[m]
cbd575f7a0 Merge remote-tracking branch 'upstream/master' into nTox 2013-09-13 09:14:21 +02:00
Coren[m]
e67a11dd04 Merge remote-tracking branch 'upstream/master' into Integration 2013-09-13 09:06:52 +02:00
Coren[m]
ec3734fc5d TOX_ENABLE_IPV6 is now #define'd per default. Added some logging and error messages. 2013-09-13 08:50:46 +02:00
irungentoo
f8b979a92a Put group chat functions in the public API.
Group chats are not complete, they seem to work very well though.

This means that the functions will change.
2013-09-12 20:29:30 -04:00
irungentoo
41b162eb18 Merge branch 'master' of https://github.com/irungentoo/ProjectTox-Core 2013-09-12 19:26:37 -04:00
irungentoo
91d7f4857f Very basic group chats, tested and working with nTox.
Please wait until the tox.h API is updated before integrating it into
your clients.

nTox:
/g
creates a new group chat

/i friendnum groupnum
invite friendnum to groupnum

/z groupnum message
send message to groupnum

NOTE: group chats currenly might not handle packet loss well if there are less than 6 participants.
2013-09-12 19:26:30 -04:00
irungentoo
983d36f70b Merge pull request #575 from FullName/DHT_bootstrap
Patch to allow DHT_bootstrap to also do LAN discovery.
2013-09-12 11:51:47 -07:00
Coren[m]
cdd5878bc4 Merge remote-tracking branch 'upstream/master' into Integration
Conflicts resolved:
	toxcore/Messenger.c
	toxcore/network.h
2013-09-12 19:55:51 +02:00
Coren[m]
d95df291f0 Merge remote-tracking branch 'upstream/master' into DHT_bootstrap
Conflicts:
	toxcore/Messenger.c
2013-09-12 19:39:21 +02:00
Coren[m]
c35e0bd6e3 Merge remote-tracking branch 'upstream/master' into nTox 2013-09-12 19:34:28 +02:00
Coren[m]
b5db32585a Patch to allow DHT_bootstrap to also do LAN discovery.
This patch inserts LAN discovery in DHT_bootstrap, allowing it to find clients even if it's run parameterless (and clients don't connect to it directly, e.g. because the port is already bound to a different client).

- moves the #define of LAN_DISCOVERY_INTERVAL from Messenger.c to LAN_discovery.h
- includes LAN_discovery.h into DHT_bootstrap.c
- DHT_bootstrap.c sends and accepts LAN_discovery packets
2013-09-12 19:09:25 +02:00
Coren[m]
591d6c70c6 network.*:
- addr_resolv(_or_parse_ip)(): added an optional parameter to return both an IPv6 and an IPv4 address if requested address family was AF_UNSPEC
- logging of unhandled packets

DHT.c:
- bootstrap_from_address(): use the additional return from addr_resolv_or_parse_ip() to bootstrap in both network types at once

Lossless_UDP_testclient.c:
- main(): adapt to signature change of addr_resolve()

Messenger.c. LAN_discovery.h:
- lost a htons(), readded
- moved LAN_DISCOVERY_INTERVAL #define into LAN_discovery.h

LAN_discovery.c:
- added IPv4-in-IPv6 local address test
2013-09-12 18:39:21 +02:00
Coren[m]
0cfbe004ef Messenger.c:
- remove local PORT definition in favor of TOX_PORT_DEFAULT
2013-09-12 16:07:51 +02:00
Coren[m]
a74cfaea81 tox.h:
- #define'd tox's network port (as range)
- finally killed tox_new_ex() in favor of changing tox_new()'s signature
- renamed tox_bootstrap() to tox_bootstrap_from_ip()

network.h:
- #define'd tox's network port (as range)
- renamed SEND_NODES_EX to SEND_NODES_IPV6
- bind() loop uses #define'd port range

DHT.c:
- renamed SEND_NODES_EX to SEND_NODES_IPV6
- sending ipv6 node addresses even if can't use them ourselves

nTox.c:
- adapted to changed tox_new()
2013-09-12 15:42:03 +02:00
Coren[m]
20f865521a nTox.c:
- correct a message who claims we're going to exit when we actually aren't
- don't treat a failed close on reading the data file as failure of the reading
2013-09-12 14:19:22 +02:00
irungentoo
b37b521cd5 Integration of group chats into messenger in progress. 2013-09-11 20:42:25 -04:00