Commit Graph

303 Commits

Author SHA1 Message Date
Lee Smet 6486d3cc03 Fix bad comment on RouteFilter::allow trait method
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-20 15:28:52 +02:00
Lee Smet 49eb9e95b0 Fix broken doc links
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-20 15:28:15 +02:00
Lee Smet 014f829268 Add Default impl for SecretKey and PacketBuffer
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-20 15:24:33 +02:00
Lee Smet 5af941a7ab Fix Subnet contains_subnet doc test
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-20 15:19:55 +02:00
Lee Smet 4c816a4e75 Move business logic to library
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-20 15:17:07 +02:00
Lee Smet ea5d2a696b Properly keep route structure indexed by RouteKey
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-20 14:52:02 +02:00
Lee Smet 53493f693a Refactor routing table to use a trie
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-20 14:52:02 +02:00
Lee Smet ec5ef0be1d Add abstraction for ip pubkey mapping
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-19 17:12:41 +02:00
Lee Smet 0e6681161e Add IP Trie dependency
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-19 15:19:34 +02:00
Lee Smet 89a5935e2c Add update filter to limit subnet size
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-19 14:41:39 +02:00
Lee Smet aed423ba34 Rework RoutingTable retain to remove_peer
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-19 12:59:42 +02:00
Lee Smet 36e69c105d Remove obsolete peer_by_ip and RouteEntry next_hop
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-19 11:46:39 +02:00
Lee Smet b4ff95577a Extract Peer from RouteEntry when sending
Also when removing routes in the routing table

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-19 11:44:20 +02:00
Lee Smet 97570c49e2 Add Peer in RouteKey instad of overlay IP
The babel spec mentions overlay IP, however we have a designated type
for this, so it's better to outright use that and avoid some hassle in
lookiing up the proper Peer later on

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-19 11:30:49 +02:00
Lee Smet dd9ad18ec4 Add network method to Subnet
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-19 10:25:01 +02:00
Lee Smet d9f1ae306d Conditionally enable linux only dependencies
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-18 15:31:11 +02:00
Lee Smet 3bb14e9a4a Cleaner transfer of tun read result
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-18 15:16:45 +02:00
Lee Smet 289fdff937 Rework Router to tkae a subnet for tun address
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-18 12:04:47 +02:00
Lee Smet b1584f4aea Use RoutintTable lookup method in router
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-18 12:04:17 +02:00
Lee Smet 0603ef4861 Add method to find route in routing table for IP
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-18 12:02:29 +02:00
Lee Smet f4dea15307 Add method to check if IP is contained in a subnet
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-18 12:01:42 +02:00
Lee Smet 094d0c57ef Close #24: use subnet filter for incoming updates
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-13 16:36:38 +02:00
Lee Smet c40a550f62 Add basic RouteUpdateFilter implementation
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-13 16:14:33 +02:00
Lee Smet 6a44994877 Add contains_subnet method for Subnet
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-13 16:10:59 +02:00
Lee Smet f3551f1428 Lower MTU to avoid physical nic MTU overflow
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-12 16:27:32 +02:00
Lee Smet 1a2b7994ba Add test flow for encryption and decryption flow
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-12 14:31:25 +02:00
Lee Smet b635484d64 Retain PacketBuffer allocation if it isn't used
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-12 12:57:26 +02:00
Lee Smet fb1e1efa2f Avoid reallocation in decrypt flow
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-12 11:13:46 +02:00
Lee Smet d18f8de813 Close #22: Avoid reallocations in encrypt flow
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-11 18:03:31 +02:00
Lee Smet 1dffc61206 Use dedicated RouterId type in existing code
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-11 14:55:46 +02:00
Lee Smet f6232ba034 Add dedicated RouterId type
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-11 14:55:29 +02:00
Lee Smet 22f307d57e Elide RoutingTable::iter lifetime bounds
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-11 10:28:41 +02:00
Lee Smet d06bd6e120 Make RoutingTable field private
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-11 10:25:25 +02:00
Lee Smet e09f1d7f49 Remove obsolete ControlStruct type
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-08 15:18:26 +02:00
Lee Smet e429f04625 Improve control packet handling
- Pass actual packet to handler function instead of wrapper enum.
- Pass the peer who sent the control packet instead of extracting the IP
  from the control packet and doing a lookup in the router.
- Rework PeerInner to only contain data, move the actual stream
  management task to the parent Peer.
- Inject a clone of the peer in the channel with the control packet.

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-08 14:59:00 +02:00
Lee Smet d07b6f86a6 Remove legacy commented code
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-08 14:10:46 +02:00
Lee Smet 0c8638a7ce Remove unused router function
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-08 14:09:46 +02:00
Lee Smet 6332946d08 Update dependencies to latest versions
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-08 14:09:25 +02:00
Lee Smet 0e932795ea Remove explicit rand and getrandom dependencies
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-07 16:08:43 +02:00
Lee Smet 8fcb8aaff3 Update x25519-dalek dependency to v2.0.0
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-07 16:07:03 +02:00
Lee Smet 5ec9ed8a58 Remove console-subscriber dependency
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-07 14:57:29 +02:00
Lee Smet 7d4cfd801f Remve leftover useless clone
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-07 14:29:35 +02:00
Lee Smet 97d073f918 Use synchronous routing method to send from TUN
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-07 14:02:33 +02:00
Lee Smet 40b5f9cd14 Refactor routing logic to a sync method as well
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-07 14:01:17 +02:00
Lee Smet 4c566957b3 Update tokio dependencies to latest version
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-07 11:56:16 +02:00
Lee Smet 06843b646a Remove commented line of code
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-07 11:38:47 +02:00
Lee Smet 2ec5274380 Clean up route priting
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-06 16:34:25 +02:00
Lee Smet 0b5d86835d Close #20: Implement dedicated subnet type
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-06 15:29:58 +02:00
Lee Smet 4ed14440f2 Implement a basic subnet module
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-06 15:27:28 +02:00
Lee Smet be06e5c0a0 Add IpNet dependency
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
2023-09-06 13:20:32 +02:00