Skip to content

Commit

Permalink
fix(core): do not assume DU packets are from the target hop (#1225)
Browse files Browse the repository at this point in the history
  • Loading branch information
fujiapple852 committed Jul 20, 2024
1 parent c5b9de0 commit 3c92360
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/trippy-core/src/strategy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,9 @@ impl<F: Fn(&Round<'_>)> Strategy<F> {
}
Some(Response::DestinationUnreachable(data, icmp_code, extensions)) => {
let (trace_id, sequence, received, host) = self.extract(&data);
let is_target = host == self.config.target_addr;
if self.check_trace_id(trace_id) && st.in_round(sequence) && self.validate(&data) {
st.complete_probe_unreachable(sequence, host, received, icmp_code, extensions);
st.complete_probe_unreachable(sequence, host, received, is_target, icmp_code, extensions);
}
}
Some(Response::EchoReply(data, icmp_code)) => {
Expand Down Expand Up @@ -747,6 +748,7 @@ mod state {
sequence: Sequence,
host: IpAddr,
received: SystemTime,
is_target: bool,
icmp_code: IcmpPacketCode,
extensions: Option<Extensions>,
) {
Expand All @@ -755,7 +757,7 @@ mod state {
IcmpPacketType::Unreachable(icmp_code),
host,
received,
true,
is_target,
extensions,
);
}
Expand Down

0 comments on commit 3c92360

Please sign in to comment.