diff options
| author | Emīls <emils@mullvad.net> | 2020-08-26 00:56:35 +0100 |
|---|---|---|
| committer | Emīls <emils@mullvad.net> | 2020-09-02 10:58:47 +0100 |
| commit | ccd92467d7f1f21531166e61e65092b0ed5ae53e (patch) | |
| tree | 58862173c98eca07503088b0da85bd978c9063eb /talpid-core | |
| parent | e387c43658b017a382e60bdd6841597ea8aea42f (diff) | |
| download | mullvadvpn-ccd92467d7f1f21531166e61e65092b0ed5ae53e.tar.xz mullvadvpn-ccd92467d7f1f21531166e61e65092b0ed5ae53e.zip | |
Update netlink related dependencies
Diffstat (limited to 'talpid-core')
| -rw-r--r-- | talpid-core/Cargo.toml | 14 | ||||
| -rw-r--r-- | talpid-core/src/routing/linux.rs | 25 | ||||
| -rw-r--r-- | talpid-core/src/routing/unix.rs | 2 |
3 files changed, 16 insertions, 25 deletions
diff --git a/talpid-core/Cargo.toml b/talpid-core/Cargo.toml index 5222c5d26d..9828bbedf6 100644 --- a/talpid-core/Cargo.toml +++ b/talpid-core/Cargo.toml @@ -39,7 +39,8 @@ tonic = "0.3.1" prost = "0.6" [target.'cfg(unix)'.dependencies] -nix = "0.17" +nix = "0.18" +tokio-io = "0.1" [target.'cfg(target_os = "android")'.dependencies] @@ -52,10 +53,13 @@ failure = "0.1" notify = "4.0" resolv-conf = "0.6.1" async-stream = "0.2" -rtnetlink = "0.2" -netlink-packet-route = "0.2" -netlink-proto = "0.2" -netlink-sys = "0.2" +rtnetlink = "0.3" +netlink-packet-core = "0.2" +netlink-packet-utils = "0.2" +netlink-packet-route = "0.3" +netlink-proto = "0.4" +netlink-sys = "0.3" +byteorder = "1" futures = { package = "futures", version = "0.3" } nftnl = { version = "0.5", features = ["nftnl-1-1-0"] } mnl = { version = "0.2.0", features = ["mnl-1-0-4"] } diff --git a/talpid-core/src/routing/linux.rs b/talpid-core/src/routing/linux.rs index 566e1c027b..c7be9c6bff 100644 --- a/talpid-core/src/routing/linux.rs +++ b/talpid-core/src/routing/linux.rs @@ -52,7 +52,7 @@ pub enum Error { BindError(#[error(source)] io::Error), #[error(display = "Netlink error")] - NetlinkError(#[error(source)] failure::Compat<rtnetlink::Error>), + NetlinkError(#[error(source)] rtnetlink::Error), #[error(display = "Route without a valid node")] InvalidRoute, @@ -379,7 +379,6 @@ impl RouteManagerImpl { while let Some(route) = route_request .try_next() .await - .map_err(failure::Fail::compat) .map_err(Error::NetlinkError)? { if route.header.destination_prefix_length == 0 { @@ -394,12 +393,7 @@ impl RouteManagerImpl { async fn initialize_link_map(handle: &rtnetlink::Handle) -> Result<BTreeMap<u32, String>> { let mut link_map = BTreeMap::new(); let mut link_request = handle.link().get().execute(); - while let Some(link) = link_request - .try_next() - .await - .map_err(failure::Fail::compat) - .map_err(Error::NetlinkError)? - { + while let Some(link) = link_request.try_next().await.map_err(Error::NetlinkError)? { if let Some((idx, link_name)) = Self::map_iface_name_to_idx(link) { link_map.insert(idx, link_name); } @@ -536,7 +530,7 @@ impl RouteManagerImpl { Route::new(best_node, required_route.destination).table(required_route.table_id); if let Err(e) = self.delete_route(&route).await { if let Error::NetlinkError(err) = &e { - if let rtnetlink::ErrorKind::NetlinkError(msg) = err.get_ref().kind() { + if let rtnetlink::Error::NetlinkError(msg) = err { // -3 means that the route doesn't exist anymore anyway if msg.code == -3 { continue; @@ -551,7 +545,7 @@ impl RouteManagerImpl { for route in self.added_routes.drain().collect::<Vec<_>>().iter() { if let Err(e) = self.delete_route(&route).await { if let Error::NetlinkError(err) = &e { - if let rtnetlink::ErrorKind::NetlinkError(msg) = err.get_ref().kind() { + if let rtnetlink::Error::NetlinkError(msg) = err { // -3 means that the route doesn't exist anymore anyway if msg.code == -3 { continue; @@ -785,7 +779,6 @@ impl RouteManagerImpl { .del(route_message) .execute() .await - .map_err(failure::Fail::compat) .map_err(Error::NetlinkError) } @@ -849,17 +842,11 @@ impl RouteManagerImpl { let mut req = NetlinkMessage::from(RtnlMessage::NewRoute(add_message)); req.header.flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_CREATE | NLM_F_REPLACE; - let mut response = self - .handle - .request(req) - .map_err(failure::Fail::compat) - .map_err(Error::NetlinkError)?; + let mut response = self.handle.request(req).map_err(Error::NetlinkError)?; while let Some(message) = response.next().await { if let NetlinkPayload::Error(err) = message.payload { - let compat_err = - failure::Fail::compat(rtnetlink::ErrorKind::NetlinkError(err).into()); - return Err(Error::NetlinkError(compat_err)); + return Err(Error::NetlinkError(rtnetlink::Error::NetlinkError(err))); } } self.added_routes.insert(route.clone()); diff --git a/talpid-core/src/routing/unix.rs b/talpid-core/src/routing/unix.rs index 4fd7da37d1..503e69bc35 100644 --- a/talpid-core/src/routing/unix.rs +++ b/talpid-core/src/routing/unix.rs @@ -196,7 +196,7 @@ impl RouteManager { /// Exposes runtime handle #[cfg(target_os = "linux")] - pub fn runtime_handle(&self) -> tokio02::runtime::Handle { + pub fn runtime_handle(&self) -> tokio::runtime::Handle { self.runtime.handle().clone() } |
