Skip to content

Comments

Fix netstat build error#803

Merged
hulto merged 9 commits intomainfrom
fix-netstat-build
Nov 2, 2024
Merged

Fix netstat build error#803
hulto merged 9 commits intomainfrom
fix-netstat-build

Conversation

@hulto
Copy link
Collaborator

@hulto hulto commented Oct 31, 2024

What type of PR is this?

/kind bug

What this PR does / why we need it:

Fixes libc compile error by replacing deprecated library netstat2 with listeners

Which issue(s) this PR fixes:

Fixes #

@hulto
Copy link
Collaborator Author

hulto commented Oct 31, 2024

GLIBC version:

ldd (Ubuntu GLIBC 2.35-0ubuntu3.8) 2.35

@hulto hulto changed the title Check glibc version Fix netstat build error Oct 31, 2024
@hulto
Copy link
Collaborator Author

hulto commented Oct 31, 2024

Able to reproduce the error locally.
Does seem to be an issue with new versions of ldd.

docker run --rm -it ubuntu:latest@sha256:ca2b0f26964cf2e80ba3e084d5983dab293fdb87485dc6445f3f7bbfc89d7459 bash
root@838d749f2375:/realm/implants# ldd --version
ldd (Ubuntu GLIBC 2.35-0ubuntu3.6) 2.35

# Install tools and rust
apt update && apt install -y curl git vim
curl --tlsv1.2 https://sh.rustup.rs -sSf | bash -s -- -y --no-modify-path --profile minimal 2>&1
. "$HOME/.cargo/env" 
rustup update
git clone https://github.com/spellshift/realm.git
cd realm/implants/
apt install -y make

# Bulid
cargo build

   Compiling netstat2 v0.9.1
error[E0609]: no field `state` on type `&libc::tcp_info`
   --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/netstat2-0.9.1/src/integrations/linux/netlink_iterator.rs:193:40
    |
193 |             return TcpState::from(tcpi.state);
    |                                        ^^^^^ unknown field
    |
    = note: available fields are: `tcpi_state`, `tcpi_ca_state`, `tcpi_retransmits`, `tcpi_probes`, `tcpi_backoff` ... and 26 others

For more information about this error, try `rustc --explain E0609`.
error: could not compile `netstat2` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

@hulto
Copy link
Collaborator Author

hulto commented Oct 31, 2024

The github action image: ubuntu-2004 has to new of a version of ldd
ldd (Ubuntu GLIBC 2.31-0ubuntu9.16) 2.31

https://github.com/spellshift/realm/actions/runs/11604084567/job/32312249420

@hulto
Copy link
Collaborator Author

hulto commented Oct 31, 2024

I think we should remove netstat2 as a dependency and replace it with something else or implement our own.
Does not seem worthwhile to quick fix the CI by pinning an older version of ldd

Copy link
Collaborator

@jabbate19 jabbate19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@hulto hulto merged commit fc11bf9 into main Nov 2, 2024
@hulto hulto deleted the fix-netstat-build branch November 2, 2024 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants