Skip to content

Commit

Permalink
fix linux
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Apr 26, 2024
1 parent e9aa5d9 commit 416fc57
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions iroh-net/src/net/interfaces/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -133,8 +133,7 @@ async fn default_route_netlink_family(
family: rtnetlink::IpVersion,
) -> Result<Option<(String, u32)>> {
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;
Expand All @@ -159,10 +158,10 @@ async fn default_route_netlink_family(
async fn iface_by_index(handle: &rtnetlink::Handle, index: u32) -> Result<String> {
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);
Expand Down

0 comments on commit 416fc57

Please sign in to comment.