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)
This undoes most of the changes made in 37233553a4 as the problem with the drops was only mitigated.
The actual fix for the dropped packets was in e989f475a1 and the invalid initialization was the root cause
You can now do 'cp edge.conf.sample edge.conf' to create a n2n configuration. If the .conf (for edge and supernode) are present, the service is enabled automatically. This prevents unwanted services to be enabled, and it preserves services activation across updates
edge detects it and bypsses the supernode
deri@Lucas-iMac.local 132> ping 192.168.254.126
PING 192.168.254.126 (192.168.254.126): 56 data bytes
64 bytes from 192.168.254.126: icmp_seq=0 ttl=64 time=84.314 ms <<== via supernode
64 bytes from 192.168.254.126: icmp_seq=1 ttl=64 time=0.989 ms <<== local network announce detected
64 bytes from 192.168.254.126: icmp_seq=2 ttl=64 time=0.642 ms
64 bytes from 192.168.254.126: icmp_seq=3 ttl=64 time=0.727 ms
^C
--- 192.168.254.126 ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.642/21.668/84.314/36.169 ms