diff options
| author | David Lönnhager <david.l@mullvad.net> | 2023-09-05 13:19:57 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2023-09-05 13:22:30 +0200 |
| commit | d494927cb3fe13681eac62fc15d19e7e04cb6e0f (patch) | |
| tree | 5c81a6de626d787172a37bd1934802c5da37d98a | |
| parent | c3f39987f4161a630e33a79f1abf445102656848 (diff) | |
| download | mullvadvpn-d494927cb3fe13681eac62fc15d19e7e04cb6e0f.tar.xz mullvadvpn-d494927cb3fe13681eac62fc15d19e7e04cb6e0f.zip | |
Document function that handles route messages on macOS
| -rw-r--r-- | talpid-routing/src/unix/macos/mod.rs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/talpid-routing/src/unix/macos/mod.rs b/talpid-routing/src/unix/macos/mod.rs index 7720d79d08..0780cd9c30 100644 --- a/talpid-routing/src/unix/macos/mod.rs +++ b/talpid-routing/src/unix/macos/mod.rs @@ -273,11 +273,23 @@ impl RouteManagerImpl { } } - /// Update routes that use the non-tunnel default interface + /// Handle changes to the routing table. Specifically, when a default route is added, modified, + /// or deleted: + /// + /// * Replace the default route with a default route for the tunnel interface (i.e., one whose + /// gateway is set to the link address of the tunnel interface). + /// * At the same time, update the route used by non-tunnel interfaces to reach the relay/VPN + /// server. The gateway of the relay route is set to the first interface in the network + /// service order that has a working ifscoped default route. + /// + /// # Arguments + /// + /// * `route_is_being_deleted` - A boolean that should be set to `true` if `route` is being + /// deleted. This should be `false` if the route is being modified or added. async fn handle_route_change( &mut self, route: data::RouteMessage, - is_deletion: bool, + route_is_being_deleted: bool, ) -> Result<()> { // Ignore routes that aren't default routes if !route.is_default().map_err(Error::InvalidData)? { @@ -292,7 +304,7 @@ impl RouteManagerImpl { let tun_gateway_link_addr = tunnel_route.gateway().and_then(|addr| addr.as_link_addr()); - if new_gateway_link_addr == tun_gateway_link_addr && !is_deletion { + if new_gateway_link_addr == tun_gateway_link_addr && !route_is_being_deleted { return Ok(()); } } |
