Commit Graph

498 Commits

Author SHA1 Message Date
Lee Smet efdcd14b75 Fix darwin import path in tun module
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-30 16:04:38 +01:00
Lee Smet e56ed5206b Close #111: Move node setup code to lib
This avoids any actual logic in the binary only section, and prepares to
clean up the CLI.

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-30 15:53:24 +01:00
Lee Smet 4c3c9da45b Fix #116: Join multicast disc group on all infaces
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-24 15:32:26 +01:00
Lee Smet 4ade07f9a7 Fix #114: Prevent zombie quic connections
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-23 15:32:54 +01:00
Lee Smet 09cff9ff35 Fix obsolete return value in peer::died
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-23 14:32:21 +01:00
Lee Smet f5159c1834 Close #116: Terminate connection of dead peer
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-23 12:44:21 +01:00
Lee Smet f4cef3d84c Remove obsolete comment on peer_manager::new_ref
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-23 12:02:31 +01:00
Lee Smet db0ce69e79 Log endpoint when we can't connect to it
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-22 15:43:46 +01:00
Lee Smet a2c166d9e0 Move data format code to unix only block
This avoids a clippy error on windows where this code is not used

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-22 15:26:53 +01:00
Lee Smet 2ca65b58e1 Close #103: Document key-file flag for inspect cmd
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-22 15:11:19 +01:00
Lee Smet c42512cbe6 Close #109: Track peer bandwidth usage
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-22 14:56:32 +01:00
Lee Smet 22e157d9b2 Add -V/--version flag to print binary version
Version is set to the value in Cargo.toml

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-20 12:12:40 +01:00
Lee Smet 409a19df28 Close #100: Harden prefix decoding
Prefix decoding copies based on the earlier specified plen. For IPv4 and
IPv6, these have an implied maximum of 32 and 128, respectively. Since
that is not checked, a remote node could supply a value which is too
high, which in turn cuases the copy to read too many bytes, or to copy
outside of the destination bound. Both of these scenarios result in a
panic. That panic would only affect the connection of that remote peer
and leave the remainder of the system intact, so no real harm is done.

Now, we cleanly return a None value. We don't attempt to skip bytes to
leave the buffer in a known good state, and most likely a following read
will find a bad frame. Ultimately, this would lead to the connection
dying due to no IHU's being received.

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-18 15:10:08 +01:00
Lee Smet 2e58fa28e6 Fix update tests
Which were forgotten to be changed in the previous 2 commits

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-17 15:39:15 +01:00
Lee Smet 4b0df422a8 Fix size calculation for update packet
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-17 15:38:42 +01:00
Lee Smet 94f09c430c Fix #99: Proper address encoding in update TLV's
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-17 15:22:56 +01:00
Lee Smet b70fa579ed Fix skipping of unknown TLV's
Since we already read a TLV type and TLV len byte, we need to decrement
the header length by 2 instead of 1

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-17 15:07:29 +01:00
Lee Smet 191da7ed18 Close #88: Relax timing of periodic events
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-17 14:52:55 +01:00
Lee Smet c0d99dd23a Remove obsolete sleep in expired route key removal
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-17 12:55:41 +01:00
Lee Smet afba7443ae Close #106: Inform peers if they died
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-17 11:54:52 +01:00
Lee Smet 5ba38c68ac Fix trace log typo
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-17 11:54:22 +01:00
Lee Smet 8b147eea89 Close #96: Forget LL peers on connect failure
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-12 11:45:18 +01:00
Lee Smet a9c6d0b6c4 Close #101: Request route table dump for new Peer
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-09 15:53:43 +01:00
Lee Smet a1aa5102a0 Close #94: Add route requests
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-09 14:14:10 +01:00
Lee Smet b9678d7810 Add seqno request codec test
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-09 14:14:10 +01:00
Lee Smet a823192b62 Tighten quic keep alive timings
See how this behaves for now

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-04 15:13:25 +01:00
Lee Smet 6cbeed8c14 Suggest inlining Quic delegate Async{Read/Write}
Add inline attributes on the delegate implementations of AsyncRead and
AsyncWrite for connection::Quic. Analysis of the generated assembly
showed that this was not done automatically.

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-04 15:08:04 +01:00
Lee Smet 1dd91543e5 Change default peer discovery port
Previous value collides with now introduced quic transport

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-03 16:36:39 +01:00
Lee Smet 655bf876c4 Tweak quic transport config a little bit.
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-03 16:12:10 +01:00
Lee Smet 71a5c9a89a Implement outgoing quic connection
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-03 12:25:55 +01:00
Lee Smet a3028114c0 Implement quic listener
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-02 19:40:16 +01:00
Lee Smet 766162ba88 Further prepare peer manager for connection types
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-02 16:02:43 +01:00
Lee Smet fa531e0dc6 Remove commented argument in Peer::new()
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-02 14:06:44 +01:00
Lee Smet d189334d58 Rework Peer::new() to take Connection as argument
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-02 13:11:21 +01:00
Lee Smet 2a70ac43a1 Add Connection trait
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2024-01-02 12:59:59 +01:00
Lee Smet 91e62a16d7 Change --port flag to --tcp-listen-port
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-12-28 17:02:59 +01:00
Lee Smet 88a4171c44 Close #90: Add endpoint type
This prepares for support of multiple underlay connections without
requiring further external breaking changes.

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-12-28 16:53:46 +01:00
Lee Smet 5fdc76f3ee Close #83: Add bigger processing cost to IPv4 peer
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-12-27 16:41:35 +01:00
Lee Smet 02419d9d23 Generate No Route To Host ICMP in packet injection
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-12-27 13:04:59 +01:00
Lee Smet d1c76d44fa Improve trace log for handling data packets
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-12-27 12:23:08 +01:00
Lee Smet 9550cf9dfc Remove unused imports in src/data.rs
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-12-27 12:13:41 +01:00
Lee Smet 0d108708fe Use proper ICMP type when reassembling icmp packet
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-12-27 11:26:32 +01:00
Lee Smet 8bdfbfb596 Support no route to host ICMP from hops
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-12-27 11:17:23 +01:00
Lee Smet 3c16d62b73 Generate Time Exceeded ICMP messages
Messages are transmitted as OOB_ICMP

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-12-26 17:39:42 +01:00
Lee Smet 54257a7c45 Support OOB ICMP: receive from network
Implements a new data type OOB_ICMP which is generated by (intermediate)
hops in the network. The receiving node decodes and reassembles the icmp
packet and forwards it to the local TUN interface.

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-12-26 17:14:51 +01:00
Lee Smet cdb0ef77bb Fix packetbuffer access into tag space
PacketBuffer buffer and buffer_mut methods incorrectly calculated the
offset of the end of the useable buffer, resulting in the returned slice
pointing into the space reserved for the AES_GCM_TAG.

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-12-26 16:52:10 +01:00
Lee Smet 305ab2beea Fix #84: Fix log line typo
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-12-20 16:40:47 +01:00
Lee Smet 17ac202d40 Close #80: Keep track of TTL for data packets
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-12-01 11:51:32 +01:00
Lee Smet a813a86d96 Don't send receiver IP addr in IHU
In accordance with the RFC, the IHU can set AE to AE wildcard, with no
actual address set, if the IHU is sent over a unicast link, which is
always the case for us.

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-11-30 15:45:32 +01:00
Lee Smet 640a50415a Track SocketAddr in Peer instead of IpAddr
This gives more info as it includes the port and if needed the scope id

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-11-30 15:38:10 +01:00