Skip to content

Commit

Permalink
Fix android. (#11)
Browse files Browse the repository at this point in the history
* Fix android.

* Fix clippy.
  • Loading branch information
dvc94ch authored Dec 15, 2021
1 parent 4d0bb12 commit 23adbbb
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
on: [push, pull_request]
on: [pull_request]

name: if-watch

Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "if-watch"
version = "0.2.2"
version = "0.3.0"
authors = ["David Craven <david@craven.ch>", "Parity Technologies Limited <admin@parity.io>"]
edition = "2018"
edition = "2021"
keywords = ["asynchronous", "routing"]
license = "MIT OR Apache-2.0"
description = "crossplatform asynchronous network watcher"
Expand All @@ -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"
3 changes: 0 additions & 3 deletions src/unix/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ pub struct NetlinkSocket {
fd: Async<Fd>,
address: sockaddr_nl,
seqnum: u32,
pid: u32,
}

const RTMGRP_IPV4_IFADDR: u32 = 0x10;
Expand All @@ -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,
})
}
}
Expand Down
1 change: 0 additions & 1 deletion src/unix/linux/rtnetlink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ impl Iterator for RtaIterator<'_> {
type Item = RtaMessage;

fn next(&mut self) -> Option<RtaMessage> {
use core::convert::TryInto;
let (attr, buf): (rtattr, _) = self.0.read()?;
Some(match attr.rta_type {
libc::RTA_DST => match buf.try_into().ok() {
Expand Down
1 change: 1 addition & 0 deletions src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use winapi::shared::{
pub struct IfWatcher {
addrs: HashSet<IpNet>,
queue: VecDeque<IfEvent>,
#[allow(unused)]
notif: RouteChangeNotification,
waker: Arc<AtomicWaker>,
resync: Arc<AtomicBool>,
Expand Down

0 comments on commit 23adbbb

Please sign in to comment.