diff --git a/README.md b/README.md index 4ba34f83..d7311c32 100644 --- a/README.md +++ b/README.md @@ -159,6 +159,10 @@ implement fault injection, available through command-line options: A good starting value for `--drop-chance` and `--corrupt-chance` is 15%. A good starting value for `--?x-rate-limit` is 4 and `--shaping-interval` is 50 ms. +Note that packets dropped by the fault injector still get traced; +the `rx: randomly dropping a packet` message indicates that the packet *above* it got dropped, +and the `tx: randomly dropping a packet` message indicates that the packet *below* it was. + ### examples/tcpdump.rs _examples/tcpdump.rs_ is a tiny clone of the _tcpdump_ utility. diff --git a/examples/utils.rs b/examples/utils.rs index bcb4b218..9617e9c4 100644 --- a/examples/utils.rs +++ b/examples/utils.rs @@ -36,7 +36,7 @@ pub fn setup_logging() { } pub fn setup_device(more_args: &[&str]) - -> (Tracer, EthernetFrame<&'static [u8]>>, + -> (FaultInjector>>, Vec) { let mut opts = getopts::Options::new(); opts.optopt("", "drop-chance", "Chance of dropping a packet (%)", "CHANCE"); @@ -77,6 +77,7 @@ pub fn setup_device(more_args: &[&str]) } let device = TapInterface::new(&matches.free[0]).unwrap(); + let device = Tracer::<_, EthernetFrame<&'static [u8]>>::new(device, trace_writer); let mut device = FaultInjector::new(device, seed); device.set_drop_chance(drop_chance); device.set_corrupt_chance(corrupt_chance); @@ -84,7 +85,6 @@ pub fn setup_device(more_args: &[&str]) device.set_max_tx_rate(tx_rate_limit); device.set_max_rx_rate(rx_rate_limit); device.set_bucket_interval(Duration::from_millis(shaping_interval as u64)); - let device = Tracer::<_, EthernetFrame<&'static [u8]>>::new(device, trace_writer); (device, matches.free[1..].to_owned()) }