Added Windows support for the bind shell
Brings in support from winpcap as npcap has a restrictive license
This commit is contained in:
@@ -17,14 +17,16 @@ use fs_extra::dir::{copy, CopyOptions};
|
||||
|
||||
fn main() {
|
||||
if std::env::var("CARGO_CFG_TARGET_OS").unwrap() == "windows" {
|
||||
println!("cargo:rustc-lib-lib=pcap");
|
||||
println!("cargo:rustc-link-search=native={}", std::env::var("SPARSE_BUILD_WINPCAP").unwrap());
|
||||
println!("cargo:rustc-link-search=native={}/x64", std::env::var("SPARSE_BUILD_WINPCAP").unwrap());
|
||||
println!("cargo:rustc-link-lib=wpcap");
|
||||
} else {
|
||||
let libpcap_src = format!("{}/pcap_src", std::env::var("OUT_DIR").unwrap());
|
||||
|
||||
let mut options = CopyOptions::new();
|
||||
options.copy_inside = true;
|
||||
options.skip_exist = true;
|
||||
copy(std::env!("SPARSE_BUILD_LIBPCAP"), &libpcap_src, &options).expect("could not copy libpcap source code to build");
|
||||
copy(std::env::var("SPARSE_BUILD_LIBPCAP").unwrap(), &libpcap_src, &options).expect("could not copy libpcap source code to build");
|
||||
|
||||
let dst = cmake::Config::new(&libpcap_src)
|
||||
.define("BUILD_SHARED_LIBS", "OFF")
|
||||
|
||||
@@ -228,7 +228,7 @@ impl<T: Disabled> Interface<T> {
|
||||
}
|
||||
|
||||
pub fn activate(mut self) -> error::Result<Interface<DevActivated>> {
|
||||
if unsafe { ffi::pcap_activate(self.dev) } != 0 {
|
||||
if unsafe { dbg!(ffi::pcap_activate(self.dev)) } != 0 {
|
||||
Err(unsafe { ffi::pcap_geterr(self.dev) })?;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user