Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc changes #490

Merged
merged 6 commits into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ const MIN_GRACE_DURATION_MS: Duration = Duration::from_millis(10);
const MAX_GRACE_DURATION_MS: Duration = Duration::from_millis(1000);

/// The minimum packet size we allow.
pub const MIN_PACKET_SIZE: u16 = 28;
const MIN_PACKET_SIZE: u16 = 28;

/// The maximum packet size we allow.
pub const MAX_PACKET_SIZE: u16 = 1024;
const MAX_PACKET_SIZE: u16 = 1024;

/// The tool mode.
#[derive(Debug, Copy, Clone, ValueEnum)]
Expand Down Expand Up @@ -315,7 +315,7 @@ pub struct Args {
pub print_tui_binding_commands: bool,

/// The number of report cycles to run
#[clap(short = 'c', long, default_value_t = 10, display_order = 36)]
#[clap(short = 'C', long, default_value_t = 10, display_order = 36)]
pub report_cycles: usize,
}

Expand Down
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
clippy::cast_possible_truncation,
clippy::redundant_pub_crate,
clippy::struct_excessive_bools,
clippy::cognitive_complexity
clippy::cognitive_complexity,
clippy::option_option
)]
#![forbid(unsafe_code)]
use crate::backend::Trace;
Expand Down
3 changes: 1 addition & 2 deletions src/tracing/net/ipv4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ fn make_echo_request_icmp_packet(
payload_size: usize,
payload_pattern: PayloadPattern,
) -> TraceResult<EchoRequestPacket<'_>> {
let mut payload_buf = [0_u8; MAX_ICMP_PAYLOAD_BUF];
payload_buf.iter_mut().for_each(|x| *x = payload_pattern.0);
let payload_buf = [payload_pattern.0; MAX_ICMP_PAYLOAD_BUF];
let packet_size = IcmpPacket::minimum_packet_size() + payload_size;
let mut icmp = EchoRequestPacket::new(&mut icmp_buf[..packet_size]).req()?;
icmp.set_icmp_type(IcmpType::EchoRequest);
Expand Down
4 changes: 1 addition & 3 deletions src/tracing/net/ipv6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ pub fn dispatch_tcp_probe(
probe: Probe,
src_addr: Ipv6Addr,
dest_addr: Ipv6Addr,
// port_direction: PortDirection,
) -> TraceResult<Socket> {
fn process_result(addr: SocketAddr, res: std::io::Result<()>) -> TraceResult<()> {
match res {
Expand Down Expand Up @@ -224,8 +223,7 @@ fn make_echo_request_icmp_packet(
payload_size: usize,
payload_pattern: PayloadPattern,
) -> TraceResult<EchoRequestPacket<'_>> {
let mut payload_buf = [0_u8; MAX_ICMP_PAYLOAD_BUF];
payload_buf.iter_mut().for_each(|x| *x = payload_pattern.0);
let payload_buf = [payload_pattern.0; MAX_ICMP_PAYLOAD_BUF];
let packet_size = IcmpPacket::minimum_packet_size() + payload_size;
let mut icmp = EchoRequestPacket::new(&mut icmp_buf[..packet_size]).req()?;
icmp.set_icmp_type(IcmpType::EchoRequest);
Expand Down