Skip to content

Commit

Permalink
Update nix dependency to 0.27
Browse files Browse the repository at this point in the history
Update the nix dependency that we depend on to 0.27, to minimize the
chance of copies of multiple versions being pulled in during the build.

Signed-off-by: Daniel Müller <deso@posteo.net>
  • Loading branch information
d-e-s-o authored and danielocfb committed Nov 20, 2023
1 parent 381f756 commit ef3e33b
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 15 deletions.
20 changes: 15 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/bpf_query/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"

[dependencies]
libbpf-rs = { path = "../../libbpf-rs" }
nix = { version = "0.26", default-features = false, features = ["net", "user"] }
nix = { version = "0.27", default-features = false, features = ["net", "user"] }
clap = { version = "4.0.32", default-features = false, features = ["std", "derive", "help", "usage"] }

[target.'cfg(target_arch = "x86_64")'.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion examples/tc_port_whitelist/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ anyhow = "1.0"
libbpf-rs = { path = "../../libbpf-rs" }
libc = "0.2"
plain = "0.2"
nix = { version = "0.26", default-features = false, features = ["net", "user"] }
nix = { version = "0.27", default-features = false, features = ["net", "user"] }
clap = { version = "4.0.32", default-features = false, features = ["std", "derive", "help", "usage"] }

[build-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion examples/tproxy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ anyhow = "1.0"
clap = { version = "4.0.32", default-features = false, features = ["std", "derive", "help", "usage"] }
ctrlc = "3.2"
libbpf-rs = { path = "../../libbpf-rs" }
nix = { version = "0.26", default-features = false, features = ["net", "user"] }
nix = { version = "0.27", default-features = false, features = ["net", "user"] }

[build-dependencies]
libbpf-cargo = { path = "../../libbpf-cargo" }
12 changes: 6 additions & 6 deletions examples/tproxy/src/bin/proxy.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::net::TcpListener;
use std::net::TcpStream;
use std::os::unix::io::FromRawFd;
use std::os::unix::io::AsRawFd as _;
use std::str::FromStr;

use anyhow::Context;
Expand Down Expand Up @@ -56,17 +56,17 @@ fn main() -> Result<()> {
.context("Failed to create listener socket")?;

// Set some sockopts
setsockopt(fd, ReuseAddr, &true).context("Failed to set SO_REUSEADDR")?;
setsockopt(fd, IpTransparent, &true).context("Failed to set IP_TRANSPARENT")?;
setsockopt(&fd, ReuseAddr, &true).context("Failed to set SO_REUSEADDR")?;
setsockopt(&fd, IpTransparent, &true).context("Failed to set IP_TRANSPARENT")?;

// Bind to addr
let addr = format!("{}:{}", opts.addr, opts.port);
let addr = SockaddrIn::from_str(&addr).context("Failed to parse socketaddr")?;
bind(fd, &addr).context("Failed to bind listener")?;
bind(fd.as_raw_fd(), &addr).context("Failed to bind listener")?;

// Start listening
listen(fd, 128).context("Failed to listen")?;
let listener = unsafe { TcpListener::from_raw_fd(fd) };
listen(&fd, 128).context("Failed to listen")?;
let listener = TcpListener::from(fd);

for client in listener.incoming() {
let client = client.context("Failed to connect to client")?;
Expand Down
2 changes: 1 addition & 1 deletion libbpf-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ bitflags = "2.0"
lazy_static = "1.4"
libbpf-sys = { version = "1.0.3" }
libc = "0.2"
nix = { version = "0.26", default-features = false, features = ["net", "user"] }
nix = { version = "0.27", default-features = false, features = ["net", "user"] }
num_enum = "0.5"
strum_macros = "0.24"
thiserror = "1.0.10"
Expand Down

0 comments on commit ef3e33b

Please sign in to comment.