From b6342719b6269f0b7b6e0f675a2c6c666f053ab5 Mon Sep 17 00:00:00 2001 From: FujiApple Date: Sat, 20 Jul 2024 20:09:40 +0800 Subject: [PATCH] fix(core): do not assume DU packets are from the target hop (#1225) --- crates/trippy-core/src/strategy.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/trippy-core/src/strategy.rs b/crates/trippy-core/src/strategy.rs index bd66d571..12b9bc1b 100644 --- a/crates/trippy-core/src/strategy.rs +++ b/crates/trippy-core/src/strategy.rs @@ -160,8 +160,9 @@ impl)> Strategy { } 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)) => { @@ -747,6 +748,7 @@ mod state { sequence: Sequence, host: IpAddr, received: SystemTime, + is_target: bool, icmp_code: IcmpPacketCode, extensions: Option, ) { @@ -755,7 +757,7 @@ mod state { IcmpPacketType::Unreachable(icmp_code), host, received, - true, + is_target, extensions, ); }