diff options
| author | Jonathan <jonathan@mullvad.net> | 2022-06-13 15:36:06 +0200 |
|---|---|---|
| committer | Jonathan <jonathan@mullvad.net> | 2022-06-13 15:49:05 +0200 |
| commit | 3f089faace4f64dd1b94888ff016add13eda5731 (patch) | |
| tree | 5ecd1beb1f37fd1d16ef93705853f8708afe5a12 | |
| parent | 68fc78c892a6e25cdb360ce5104d40330add6993 (diff) | |
| download | mullvadvpn-3f089faace4f64dd1b94888ff016add13eda5731.tar.xz mullvadvpn-3f089faace4f64dd1b94888ff016add13eda5731.zip | |
Fix a bug related to automatic MTU detection
A panic would happen when a route node had both an IP and a device and
a wireguard tunnel would start up. This has been patched and the panic
has been turned into an error that will only log a failure and cause the
default MTU to be statically determined.
| -rw-r--r-- | talpid-core/src/routing/linux.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/talpid-core/src/routing/linux.rs b/talpid-core/src/routing/linux.rs index e4fd6cc265..2a34de42cd 100644 --- a/talpid-core/src/routing/linux.rs +++ b/talpid-core/src/routing/linux.rs @@ -113,6 +113,9 @@ pub enum Error { #[error(display = "No netlink response for route query")] NoRouteError, + #[error(display = "Route node was malformed")] + InvalidRouteNode, + #[error(display = "No link found")] LinkNotFoundError, @@ -738,7 +741,7 @@ impl RouteManagerImpl { Some(route) => { let node = route.get_node(); match (node.get_device(), node.get_address()) { - (Some(device), None) => { + (Some(device), _) => { let mtu = self.get_device_mtu(device.to_string()).await?; if mtu != STANDARD_MTU { log::info!( @@ -751,8 +754,9 @@ impl RouteManagerImpl { return Ok(mtu); } (None, Some(address)) => attempted_ip = address, - _ => { - panic!("Route must contain either an IP or a device."); + (None, None) => { + log::error!("Route contains an invalid node which lacks both a device and an address"); + return Err(Error::InvalidRouteNode); } } } |
