From 416fc57f1db86686f1b49286ac3a19d548d3a96a Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Fri, 26 Apr 2024 09:35:31 +0200 Subject: [PATCH] fix linux --- iroh-net/src/net/interfaces/linux.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/iroh-net/src/net/interfaces/linux.rs b/iroh-net/src/net/interfaces/linux.rs index 8bde4be1a3..de15895d15 100644 --- a/iroh-net/src/net/interfaces/linux.rs +++ b/iroh-net/src/net/interfaces/linux.rs @@ -2,7 +2,7 @@ use anyhow::{anyhow, Result}; #[cfg(not(target_os = "android"))] -use futures_lite::StreamExt; +use futures_util::TryStreamExt; use tokio::fs::File; use tokio::io::{AsyncBufReadExt, BufReader}; @@ -133,8 +133,7 @@ async fn default_route_netlink_family( family: rtnetlink::IpVersion, ) -> Result> { let mut routes = handle.route().get(family).execute(); - while let Some(route) = routes.next().await { - let route = route?; + while let Some(route) = routes.try_next().await? { if route.gateway().is_none() { // A default route has a gateway. continue; @@ -159,10 +158,10 @@ async fn default_route_netlink_family( async fn iface_by_index(handle: &rtnetlink::Handle, index: u32) -> Result { let mut links = handle.link().get().match_index(index).execute(); let msg = links - .next() - .await - .ok_or_else(|| anyhow!("No netlink response"))? - .await?; + .try_next() + .await? + .ok_or_else(|| anyhow!("No netlink response"))?; + for nla in msg.nlas { if let netlink_packet_route::link::nlas::Nla::IfName(name) = nla { return Ok(name);