uhash needs the input padded to a multiple of 32 bytes, with the special
case that an empty input needs to be padded to 32 as well. Handle this
special case in the uhash code itself, so it doesn't need to be handled
by the callers.
This fixes an uninitialized memory error reported by valgrind for the
method aes128+ctr. It is unclear why only this method is affected, or why
it is even necessary at all - we only support stream cipher, and
crypto_onetimeauth_poly1305_verify does not care about padding.
With the update to OpenSSL 1.1, only the aes128-ctr cipher references
symbols from the library, so we can remove it from the toplevel
target_link_libraries() and build.h.
TUN/TAP interfaces were separated in 2015 (since OpenBSD 5.9 or 6.0),
requiring adjustments in fastd. This makes fastd incompatible with older
OpenBSD versions (in TAP mode).
Fixes: #2
Fixes TUN and Multi-TAP modes with multiple peers.
The script is not converted to USE_PROCD, as we still want to have full
control over stdin and daemonization.
Also improve error handling with -o pipefail.
Fixes: #3
Deprecating and eventually removing the current little-endian handshake
format just causes unnecessary churn for users without objective benefit.
The only field that was unconditionally encoded as big-endian before is
"error detail"; as this is also variable-length and was never longer
than 1 byte in practice (and it will not be for a long time), we can also
switch that around to little-endian without any compatiblity issues.
By specifying port 0, fastd will statically bind to a random port
(rather than recreating the socket for each connection attempt).
While we're at it, clean up bind address handling a bit and also pass
"default" bind address via the new flags field.
The docs docs are updated as well (they were incorrect before, a port 0
bind was simply rejected).
It seems that newer kernels fail with ENETUNREACH instead of EINVAL with
an invalid source address in pktinfo.
This fixes fast reconnect on source address change.
When compiled with musl >1.1.20, fastd will crash in case it can't
resolve a peers hostname. This is due to a changed implementation of
freeaddrinfo in musl 1.1.21 onwards.
This segfault is fixed by not calling freeaddrinfo in case the supplied
pointer is null.
Signed-off-by: David Bauer <mail@david-bauer.net>