Skip to content

Commit

Permalink
convert to clap 4 (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitris authored Oct 27, 2022
1 parent a792c34 commit 4bd88cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tcbpftest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ aya = { version = ">=0.11", features=["async_tokio"] }
tcbpftest-common = { path = "../tcbpftest-common", features=["userspace"] }
anyhow = "1.0.42"
bytes = "1"
clap = { version = "3"}
ctrlc = "3.2"
log = "0.4"
simplelog = "0.12"
tokio = { version = "1.18", features = ["macros", "rt", "rt-multi-thread", "net", "signal"] }
clap = { version = "4.0.18", features = ["derive"] }

[[bin]]
name = "tcbpftest"
Expand Down
12 changes: 6 additions & 6 deletions tcbpftest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ use tokio::{signal, task};
use tcbpftest_common::PacketLog;

#[derive(Debug, Parser)]
struct Opt {
#[clap(short, long, default_value = "eth0")]
struct Args {
#[arg(short, long, default_value = "eth0")]
iface: String,
}

#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
let opt = Opt::from_args();
let args = Args::parse();

TermLogger::init(
LevelFilter::Debug,
Expand All @@ -43,11 +43,11 @@ async fn main() -> Result<(), anyhow::Error> {
))?;
// error adding clsact to the interface if it is already added is harmless
// the full cleanup can be done with 'sudo tc qdisc del dev eth0 clsact'.
let _ = tc::qdisc_add_clsact(&opt.iface);
let _ = tc::qdisc_add_clsact(&args.iface);
let program: &mut SchedClassifier = bpf.program_mut("tcbpftest").unwrap().try_into()?;
program.load()?;
// program.attach(&opt.iface, TcAttachType::Egress)?;
program.attach(&opt.iface, TcAttachType::Ingress)?;
// program.attach(&args.iface, TcAttachType::Egress)?;
program.attach(&args.iface, TcAttachType::Ingress)?;

let mut perf_array = AsyncPerfEventArray::try_from(bpf.map_mut("EVENTS")?)?;
for cpu_id in online_cpus()? {
Expand Down

0 comments on commit 4bd88cd

Please sign in to comment.