Commit graph

1247 commits

Author SHA1 Message Date
f6fc1a39dd shell: pass ifname and mtu to fastd_shell_env_set_iface() individually
Make the function reusable for non-fastd_iface_t interfaces.
2021-03-04 00:44:43 +01:00
cc98d2fc97 iface: factor out interface name formatting 2021-03-04 00:44:43 +01:00
4dc9c723ef socket: implement offload socket creation 2021-03-04 00:44:43 +01:00
66d2ecdf48
config: add L2TP offload option 2021-03-01 21:54:45 +01:00
d2ddba5bab
polling: always call fastd_socket_error() for socket errors
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.
2021-03-01 21:54:45 +01:00
560fa47394
Prepare for offload sockets
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.
2021-03-01 21:54:45 +01:00
b0f78fbd6f
null-l2tp: always send keepalives
When the peer offloads L2TP to the kernel, fastd won't see any data
packets. Force sending keepalives, which are sent as control packets.
2021-03-01 21:54:45 +01:00
6594c0194d
Add null@l2tp method
The data packets of this method are compatible with L2TPv3 in
tap/multitap mode.
2021-03-01 21:54:42 +01:00
06fbf6ccf6
Use new data packet type when both sides support L2TP 2021-02-28 16:12:53 +01:00
d4b2be57c0
handshake: prepend control header when peer supports L2TP
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.
2021-02-28 16:12:53 +01:00
d96f75feee
handshake: check incoming flags, pass through to fastd_handshake_send_free()
We don't accept any unknown flags anymore.
2021-02-28 16:12:53 +01:00
8134d5deb7
Move buffer free out of fastd_send() 2021-02-28 16:12:53 +01:00
0b677cba54
handshake: add flag to mark fastd versions with L2TP support 2021-02-28 16:12:52 +01:00
450e439c43
handshake: remove packed attribute from fastd_handshake_packet_t
As the packet type is included in the struct now, the attribute has
become redundant.
2021-02-28 16:12:52 +01:00
df2b398ea5
Introduce L2TP-compatible packet types
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.
2021-02-28 16:12:52 +01:00
cf9d706208
method: merge nonce increment call into fastd_method_put_common_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.
2021-02-28 16:12:52 +01:00
790be9105a
method: add generic session flags
Pass a session flag field to session_init() and use it for the initiator
flag.
2021-02-28 16:12:52 +01:00
c974ccee55
random: optimize urandom read 2021-02-28 16:12:52 +01:00
8a5717e73e
receive: merge handling of packets from known and unknown addresses 2021-02-19 19:07:42 +01:00
9bb78a5ab9
handshake: move buffer free out of fastd_handshake_handle() 2021-02-19 19:07:42 +01:00
David Bauer
afebb8bc39
doc: openwrt: fix indentation ()
reload_instances was using combined tabs and spaces.

Remove the space indentation to match the rest of the file.
2021-02-19 19:07:29 +01:00
8391c1c8e2
doc: update link to benchmark wiki page 2021-01-20 13:05:33 +01:00
ac5ffbf343
doc: remove outdated Android build script and instructions
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.
2021-01-20 13:01:26 +01:00
0d4045fb85
build: fix build on OSX
Closes 
2020-11-07 12:23:28 +01:00
0780f1d816
build: fix fallback version number
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.
2020-10-19 22:26:17 +02:00
65ec849141
Development version 2020-10-19 21:25:34 +02:00
2ce6095b27
fastd v21 2020-10-19 21:24:26 +02:00
f3bc0f5d54
doc: add fastd v21 release notes 2020-10-19 21:23:08 +02:00
7379251133
receive: fix buffer leak when receiving invalid packets
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.
2020-10-19 21:08:16 +02:00
0442abce36
ec25519-fhmqvc: change log message "authorized" -> "authenticated" 2020-10-19 17:26:15 +02:00
731147f855
ec25519-fhmqvc: fix typo in comment 2020-10-19 17:25:44 +02:00
c006466287
Development version 2020-10-10 18:32:47 +02:00
a9bacad749
fastd v20 2020-10-10 18:31:22 +02:00
af40597e16
doc: releases/v20: add status socket unlink feature 2020-10-10 16:34:12 +02:00
15c317b04e
doc: add fastd v20 release notes 2020-10-10 16:30:35 +02:00
b162b4468a
doc: openwrt: switch to USE_PROCD 2020-10-10 14:43:05 +02:00
32faf8d809
doc: openwrt: remove 'up' and 'down' options
The way these options work is incompatible with USE_PROCD. Use on_up and
on_down instead, which are handled by fastd itself.
2020-10-10 14:19:06 +02:00
9cd08c1e34
doc: update build documentation 2020-10-10 12:57:05 +02:00
95bc966436
build: prevent git describe from finding unrelated repositories
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).
2020-10-10 12:17:39 +02:00
ba0f616acc
buffer: statically allocate buffers
We need a total of 3 buffers:

- Input buffer
- Output buffer
- Duplicated buffer for broadcast forward
2020-10-01 18:42:08 +02:00
755b7ab9dd
methods: reserve sufficient headroom to avoid realign
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.
2020-10-01 17:34:24 +02:00
216eaca291
buffer: consistently use term "headroom" 2020-09-30 23:24:01 +02:00
f9089a8a76
Improve buffer realignment, handle missing headroom
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.
2020-09-30 22:54:12 +02:00
4b82401157
methods: to not pass peer to encrypt()/decrypt() 2020-09-30 21:06:52 +02:00
ec61d9871a
methods: pass peer to session_init() 2020-09-30 21:06:42 +02:00
c561365328
methods: make output buffer the return value 2020-09-30 21:06:39 +02:00
b89a0ec3d3
buffer: turn buffer descriptor into buffer header
Preparation for const buffers.
2020-09-29 23:25:34 +02:00
987ef622c8
buffer: make base a uint8_t* 2020-09-29 22:31:27 +02:00
68265164a8
methods: avoid modifying the input buffer
Many methods only need a movable view of the input buffer.
2020-09-29 22:30:58 +02:00
2b6de7eddf buffer: introduce read-only views of buffers
Prepare for read-only buffer descriptors by adding views with movable
data pointer.
2020-09-29 21:58:48 +02:00