dis-works / diswall-rs

Distributed firewall
https://diswall.stream
GNU General Public License v3.0
36 stars 9 forks source link

Please do not use the unmaintained crate netstat2 #6

Open yurivict opened 10 months ago

yurivict commented 10 months ago

netstat2 is introduced between releases 0.4.3 and 0.5.0.

This broke the build on FreeBSD 14:

error[E0425]: cannot find function `iterate_sockets_info` in this scope
  --> /usr/ports/security/diswall/work/diswall-rs-0.5.0/cargo-crates/netstat2-0.9.1/src/integrations/shared_api.rs:11:5
   |
11 |     iterate_sockets_info(af_flags, proto_flags)?.collect()
   |     ^^^^^^^^^^^^^^^^^^^^ not found in this scope

For more information about this error, try `rustc --explain E0425`.
error: could not compile `netstat2` (lib) due to previous error

Caused by:
  process didn't exit successfully: `CARGO=/usr/local/bin/cargo CARGO_CRATE_NAME=netstat2 CARGO_MANIFEST_DIR=/usr/ports/security/diswall/work/diswall-rs-0.5.0/cargo-crates/netstat2-0.9.1 CARGO_PKG_AUTHORS='Ohad Ravid <ohad.rv@gmail.com>:ivxvm <ivxvm@protonmail.com>' CARGO_PKG_DESCRIPTION='Cross-platform library to retrieve network sockets information.
  ' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=netstat2 CARGO_PKG_README=README.md CARGO_PKG_REPOSITORY='https://github.com/ohadravid/netstat2-rs' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.9.1 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=9 CARGO_PKG_VERSION_PATCH=1 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/usr/ports/security/diswall/work/target/release/deps:/usr/local/lib' /usr/local/bin/rustc --crate-name netstat2 --edition=2018 /usr/ports/security/diswall/work/diswall-rs-0.5.0/cargo-crates/netstat2-0.9.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=189 --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C panic=abort -C linker-plugin-lto -C codegen-units=1 -C metadata=152b95e8fb8fa64d -C extra-filename=-152b95e8fb8fa64d --out-dir /usr/ports/security/diswall/work/target/x86_64-unknown-freebsd/release/deps --target x86_64-unknown-freebsd -C linker=cc -C strip=symbols -L dependency=/usr/ports/security/diswall/work/target/x86_64-unknown-freebsd/release/deps -L dependency=/usr/ports/security/diswall/work/target/release/deps --extern bitflags=/usr/ports/security/diswall/work/target/x86_64-unknown-freebsd/release/deps/libbitflags-9954ddbc9982034c.rmeta --extern libc=/usr/ports/security/diswall/work/target/x86_64-unknown-freebsd/release/deps/liblibc-966d3fed9024688e.rmeta --extern thiserror=/usr/ports/security/diswall/work/target/x86_64-unknown-freebsd/release/deps/libthiserror-b011dea5aff71f0b.rmeta --cap-lints warn -C link-arg=-fstack-protector-strong` (exit status: 1)

netstat2 is unmaintained. Bugs like this are unlikely to never be fixed.

Could you please remove netstat2 and use some other crate that is maintained?

Thank you, Yuri

yurivict commented 8 months ago

@Revertron

This issue makes diswall broken on FreeBSD. Do you think that netsat2 can be replaced with a better maintained library?

Revertron commented 8 months ago

Thanks for the report, I'll try to find something else.

dadodasyra commented 8 months ago

There's no alternatives..

Revertron commented 8 months ago

@yurivict I've added some workaround for FreeBSD, can you check how it compiles and works?

yurivict commented 8 months ago

Hi @Revertron .

I just tried the latest revision, but it breaks with the same error message.

Tanks, Yuri

Revertron commented 8 months ago

@yurivict I've updated and tested. It should work!