Commit Graph

73 Commits

Author SHA1 Message Date
Logan007
9076ed1bab added optional payload compression (lzo) for all transforms 2020-05-03 18:48:59 +02:00
emanuele-f
46aaa86629 Fix multicast dropped when routing is disabled 2019-12-26 22:13:49 +01:00
realjiangms
9601e82daf More reliable punching:
1. Some nat router blocks the port if incoming traffic arrives before outcoming traffic being sent. Give edge ability to set proper TTL so that the registration packet is dropped before it arrives peer.
2. Support Symmetric NAT by predicting 15 more ports when sending registration packet
3. Purge pending mac also on P2P normal packet. This is actually more usual condition.
4. Add doc for new flag.
2019-11-08 09:21:10 +08:00
emanuele-f
7e7782f965 Possibly fix mingw compilation 2019-11-03 15:54:34 +01:00
emanuele-f
1b49b37a75 Disable PMTU options on apple to fix compilation issues 2019-09-24 09:50:29 +02:00
emanuele-f
8f3009c448 Fix occasional connection issues on startup due to bad MAC address read 2019-09-22 20:16:01 +02:00
emanuele-f
0538c5261d Disable PMTU in other platforms 2019-09-21 19:25:56 +02:00
emanuele-f
6c67ed0440 MTU changes to avoid connection stall on PMTU discovery failures 2019-08-16 16:55:40 +02:00
emanuele-f
27da194872 Reduce log level due to invalid supernode register ACK cookies 2019-08-15 19:02:42 +02:00
emanuele-f
2f671cf6d9 Add support for TOS setting in edge 2019-07-16 00:37:52 +02:00
emanuele-f
eea0c9b46b Add option to disable p2p 2019-07-15 23:33:11 +02:00
emanuele-f
4e9d66a0a2 Rework log levels
Now "-v" only returns high level information, whereas "-vv" can be used to further increase the verbosity.
2019-07-15 23:21:38 +02:00
emanuele-f
6bb7e3d9c5 Fix dropped broadcast traffic
Fixes #161
2019-07-15 22:44:12 +02:00
emanuele-f
035b66b1a9 Fix mtu with AES
This avoids fragmentation when possible
2019-07-15 20:14:14 +02:00
emanuele-f
6328962752 Improve packet length log 2019-07-15 19:42:51 +02:00
emanuele-f
8880330c41 Windows compilation fix 2019-07-08 14:13:26 +02:00
emanuele-f
1c9e029b88 Retry multicast group join instead of exiting
Multicast group join failures can occur during system startup
2019-07-06 11:24:29 +02:00
Luca
1512f20eaa Compilation fix 2019-07-01 07:15:13 +02:00
emanuele-f
a70641897d Graceful termination in Windows 2019-07-01 00:26:44 +02:00
emanuele-f
41bff29df6 Disable multicast peers discovery in windows 2019-06-22 16:50:11 +02:00
Teteros
ba38ab70de
Fix typo: 'enstablished' -> 'established' 2019-06-13 14:11:57 +01:00
emanuele-f
447c3ad8c3 Replace peers linked list with hash 2019-06-10 00:33:11 +02:00
emanuele-f
4eacea7d57 Little improvement 2019-06-10 00:32:38 +02:00
emanuele-f
f36814b152 Implement query peer to try p2p during send
When a lot of monodirection traffic is sent, p2p can be hard to
enstablish because a reply is needed in order to start the registration.
Now a sending peer can query the peer information via the supernode.

This is based on the following commits:
- 1236f37a70
- ad2d416510
- 5348671299
- b2806dcde8
2019-06-08 22:04:10 +02:00
emanuele-f
b36754eae0 Set last_p2p ib peer_set_p2p_confirmed 2019-06-08 21:41:28 +02:00
emanuele-f
3db1cab276 Split broadcast stats from other supernode stats 2019-06-08 18:49:47 +02:00
emanuele-f
0e6db6361e Fix connection stall when idle p2p refresh occurs
The edge received packets from the supernode and thought that the other
peer was still active, but the other peer had dropped the p2p connection
due to refresh
2019-06-08 17:50:48 +02:00
emanuele-f
f038f22a0b Fix too many registrations going on 2019-06-08 16:10:00 +02:00
emanuele-f
623a9e480c Improve log messages 2019-06-08 15:32:47 +02:00
fengdaolong
69e3b49bec eliminate compilation warnings 2019-06-04 00:09:15 +08:00
yunbox
f48c170c26 Fix supernode handling REGISTER message from edge and let edge ask supernode to forward REGISTER message in case of non-p2p-reflection.
This is reliable way to PUNCH UDP HOLE (following STUN spec)
2019-05-23 19:24:27 +08:00
emanuele-f
3aec02d3e6 Fix unidirectional P2P connection due to pending registration
If A is directly available and B is NATted and B sends the first message to A via the supernode S,
A will try to register to B via the port used by B to talk to S. This will not work as B is NAT-ted,
so A must discard such pending registration as soon as it receives a P2P Registration from B.
2019-05-23 00:46:29 +02:00
emanuele-f
fb813e5438 Fix "invalid transop ID" when encryption is disabled 2019-05-22 23:30:05 +02:00
emanuele-f
52d33ed880 Fix missing destination MAC in REGISTER preventing proper P2P
As explained in #109
2019-05-22 23:04:27 +02:00
Jiang Zihao
0edca7e16a Fix purge_expired_registrations to accept passed-in last_purge instead of static function var. 2019-05-22 22:46:23 +02:00
emanuele-f
59011308b2 Ignore invalid community when not received from supernode
The packet may be received from a multicast registration from a local peer.

Fixes #107
2019-05-22 22:40:42 +02:00
emanuele-f
04226c09c8 Fix compilation warnings and little leak 2019-05-21 22:53:55 +02:00
emanuele-f
bc904cfbcc Skip localhost received sockets 2019-05-06 00:40:26 +02:00
emanuele-f
e2861e5f71 Fix send error in peer registration refresh 2019-05-06 00:08:08 +02:00
emanuele-f
49fd9fc5da Discard idle known_peers to avoid connection blocking on disconnection
Fixes #103
2019-05-05 23:48:48 +02:00
emanuele-f
824b45a808 Add linux termination handler and print stats on shutdown 2019-05-05 21:47:50 +02:00
emanuele-f
d5387945b4 Add the -i option to specify registration interval on edge nodes
Registration is bound to UDP NAT hole punching, so the edges should choose their own value.
2019-05-05 21:24:53 +02:00
emanuele-f
856dbae44c Cosmetic changes to improve edge registration tracing 2019-05-05 19:09:51 +02:00
Luca Deri
fbc3754601 Compilation fix 2019-05-05 10:08:21 +02:00
emanuele-f
c89ece71ca Code rework changes
- Remove keyschedule leftover and adapt to new API
- Fix cleanup functions
- Remove unused random_device_mac
2019-04-27 15:55:07 +02:00
emanuele-f
f577d997a7 Drop keyschedule support
- Legacy features are now moved to the legacy directory with readme
- Keyschedule feature is not supported anymore
2019-04-27 12:42:06 +02:00
emanuele-f
e757f94efa Initial code rework (wip)
- The edge structure is now opaque
- The configuration is now exposed via an API
- Code cleanup: using multiple transops at once is not supported anymore
2019-04-27 01:56:57 +02:00
emanuele-f
bb07f0426e Properly initialize AES IV and hash the AES key
This implements the changes discussed in #68 and #72.
This breaks compatibility with the previous AES implementation.

This also fixes two problems reported by valgrind:

==4887== Invalid write of size 2
==4887==    at 0x483E9DB: memmove (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4887==    by 0x10E37F: setup_aes_key (transform_aes.c:378)
==4887==    by 0x10E451: add_aes_key (transform_aes.c:401)
==4887==    by 0x10ED10: transop_aes_setup_psk (transform_aes.c:580)
==4887==    by 0x10A547: main (benchmark.c:92)
==4887==  Address 0x4d574a0 is 0 bytes after a block of size 16 alloc'd
==4887==    at 0x4839B65: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4887==    by 0x10E337: setup_aes_key (transform_aes.c:374)
==4887==    by 0x10E451: add_aes_key (transform_aes.c:401)
==4887==    by 0x10ED10: transop_aes_setup_psk (transform_aes.c:580)
==4887==    by 0x10A547: main (benchmark.c:92)

==13057== Use of uninitialised value of size 8
==13057==    at 0x49023B3: ??? (in /usr/lib/libcrypto.so.1.1)
==13057==    by 0x490346A: AES_cbc_encrypt (in /usr/lib/libcrypto.so.1.1)
==13057==    by 0x11270A: transop_encode_aes (transform_aes.c:230)
==13057==    by 0x10F5CD: send_packet2net (edge_utils.c:1224)
==13057==    by 0x10F813: readFromTAPSocket (edge_utils.c:1278)
==13057==    by 0x1106A8: run_edge_loop (edge_utils.c:1596)
==13057==    by 0x10B9F7: main (edge.c:701)
2019-04-16 02:09:13 +02:00
emanuele-f
d689691599 n2n.h cleanup 2019-04-14 18:08:51 +02:00
emanuele-f
3149a77753 Replace fprintf with traceEvent 2019-04-14 17:33:57 +02:00