fastd_peer_reset_socket() does not clean up session state. These errors
are usually harmless, so we reduce the loglevel to debug2, clear the
error and continue.
Add a "parent" to the socket struct which will refer to a non-offload
socket. For offloading a socket bound to the same address will be
created using SO_REUSEPORT, so we can connect() to the peer adddress.
Error handling is made more robust.
For the initial handshake, we send two packets at once, one with and one
without a control header. When receiving handshakes from a peer that
supports L2TP, we ignore the packet without the control header.
In preparation for L2TP offloading, we are making fastd's protocol more
similar to L2TP (while staying backwards-compatible).
For everything that is not data, we will prepend an L2TP control packet
header.
The header is actually put together in
fastd_method_put_common_header_raw() now, for the single place in
generic-poly1305 where we need to rebuild a previously removed header.
The script has been unmaintained for a long time.
The Android support code in fastd itself still exists, so Android
support can be revived when a maintainer is found.
In the absence of a Git repo during build, `fastd -v` would print a message
like 'fastd 21' instead of 'fastd v21' since the switch to Meson. Fix this.
For fastd versions before v20, this was just a memory leak (which could
still be used for DoS, as it's remotely triggerable). With the new
buffer management of fastd v20, this will trigger an assertion failure
instead as soon as the buffer pool is empty.
Set --git-dir and --work-tree explicitly to prevent Git from finding
unrelated repositories for source directories without version information
(for example in the OpenWrt build system, where version information of
the OpenWrt repo was returned instead).
By reserving encrypt_headroom bytes in the methods' decrypt functions,
realignment can be avoided for all methods except for null.
We must be careful to subtract what is pulled from the buffer
afterwards, so no oversized buffer is allocated that might fail the
max_buffer check.
A decrypted packet may be aligned correctly, but have too little headroom
to be encrypted using a different method. This led to an assertion
failure, crashing fastd.
Also move the realignment to the receive path, so it is only checked for
forwarded packets.