diff --git a/Cargo.lock b/Cargo.lock index d2c7b932a..e43078c5a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -786,6 +786,14 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "pcap" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "percent-encoding" version = "2.1.0" @@ -895,6 +903,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ipnetwork 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "pcap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "pnet_base_bandwhich_fork 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)", "pnet_sys_bandwhich_fork 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1914,6 +1923,7 @@ dependencies = [ "checksum packet-builder 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c3a4c42f976f5e39b18002d165d238fadb0a897e1252cf96e39109f515e85aa8" "checksum parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" "checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" +"checksum pcap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f912b9e56d1d4851a5175c118fc6503c9f69a8fe1a0649a51aff20b92c757491" "checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" "checksum pest 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e4fb201c5c22a55d8b24fef95f78be52738e5e1361129be1b5e862ecdb6894a" "checksum pest_derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" diff --git a/Cargo.toml b/Cargo.toml index d892f1b8d..61d1cbb32 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,6 @@ license = "MIT" exclude = ["src/tests/*", "demo.gif"] [dependencies] -pnet_bandwhich_fork = "0.23.1" ipnetwork = "0.15.0" tui = "0.5" termion = "1.5" @@ -32,6 +31,10 @@ tokio = { version = "0.2", features = ["rt-core", "sync"] } trust-dns-resolver = "0.18.1" async-trait = "0.1.21" +[dependencies.pnet_bandwhich_fork] +version = "0.23.1" +features = ["pcap"] + [target.'cfg(target_os="linux")'.dependencies] procfs = "0.7.4" diff --git a/src/os/shared.rs b/src/os/shared.rs index 64d26d524..77cda99ff 100644 --- a/src/os/shared.rs +++ b/src/os/shared.rs @@ -1,6 +1,7 @@ +use ::pnet_bandwhich_fork::datalink::pcap::Config; use ::pnet_bandwhich_fork::datalink::Channel::Ethernet; use ::pnet_bandwhich_fork::datalink::DataLinkReceiver; -use ::pnet_bandwhich_fork::datalink::{self, Config, NetworkInterface}; +use ::pnet_bandwhich_fork::datalink::{self, NetworkInterface}; use ::std::io::{self, stdin, ErrorKind, Write}; use ::termion::event::Event; use ::termion::input::TermRead; @@ -38,7 +39,7 @@ fn get_datalink_channel( let mut config = Config::default(); config.read_timeout = Some(time::Duration::new(1, 0)); - match datalink::channel(interface, config) { + match datalink::pcap::channel(interface, config) { Ok(Ethernet(_tx, rx)) => Ok(rx), Ok(_) => Err(GetInterfaceErrorKind::OtherError(format!( "{}: Unsupported interface type",