From 23adbbbc37ddb1e423df353b0be15370eccc1b3d Mon Sep 17 00:00:00 2001 From: David Craven Date: Wed, 15 Dec 2021 10:16:11 +0100 Subject: [PATCH] Fix android. (#11) * Fix android. * Fix clippy. --- .github/workflows/ci.yml | 2 +- Cargo.toml | 8 ++++---- src/unix/linux.rs | 3 --- src/unix/linux/rtnetlink.rs | 1 - src/windows.rs | 1 + 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0cb188d..48e1277 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -on: [push, pull_request] +on: [pull_request] name: if-watch diff --git a/Cargo.toml b/Cargo.toml index efc9691..a36bfeb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "if-watch" -version = "0.2.2" +version = "0.3.0" authors = ["David Craven ", "Parity Technologies Limited "] -edition = "2018" +edition = "2021" keywords = ["asynchronous", "routing"] license = "MIT OR Apache-2.0" description = "crossplatform asynchronous network watcher" @@ -18,11 +18,11 @@ log = "0.4.14" async-io = "1.3.1" [target.'cfg(not(target_os = "linux"))'.dependencies] -if-addrs = "0.6.5" +if-addrs = "0.7.0" [target.'cfg(windows)'.dependencies] futures = { version = "0.3.13", default-features = false } winapi = { version = "0.3.9", features = ["netioapi", "ntdef", "winerror", "ws2def"] } [dev-dependencies] -env_logger = "0.8.3" +env_logger = "0.9.0" diff --git a/src/unix/linux.rs b/src/unix/linux.rs index c713586..ad15135 100644 --- a/src/unix/linux.rs +++ b/src/unix/linux.rs @@ -29,7 +29,6 @@ pub struct NetlinkSocket { fd: Async, address: sockaddr_nl, seqnum: u32, - pid: u32, } const RTMGRP_IPV4_IFADDR: u32 = 0x10; @@ -53,14 +52,12 @@ impl NetlinkSocket { let mut size = size_of!(sockaddr_nl) as u32; errno!(libc::bind(fd.as_raw_fd(), ptr as *mut _, size))?; errno!(libc::getsockname(fd.as_raw_fd(), ptr as *mut _, &mut size))?; - let pid = address.nl_pid; address.nl_pid = 0; address.nl_groups = 0; Ok(Self { fd, address, seqnum: 0, - pid, }) } } diff --git a/src/unix/linux/rtnetlink.rs b/src/unix/linux/rtnetlink.rs index 4f4acd1..eca52e3 100644 --- a/src/unix/linux/rtnetlink.rs +++ b/src/unix/linux/rtnetlink.rs @@ -75,7 +75,6 @@ impl Iterator for RtaIterator<'_> { type Item = RtaMessage; fn next(&mut self) -> Option { - use core::convert::TryInto; let (attr, buf): (rtattr, _) = self.0.read()?; Some(match attr.rta_type { libc::RTA_DST => match buf.try_into().ok() { diff --git a/src/windows.rs b/src/windows.rs index 36f4b9f..4623cb9 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -27,6 +27,7 @@ use winapi::shared::{ pub struct IfWatcher { addrs: HashSet, queue: VecDeque, + #[allow(unused)] notif: RouteChangeNotification, waker: Arc, resync: Arc,