From 4de0fb7640ff2ec6b1de901b2371e342ddd5b42d Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Wed, 26 Feb 2025 17:26:10 +1100 Subject: [PATCH] chore(connlib): improve `wire::dev` logging (#8272) This will log more details about the packet, such as SYN, RST and FIN flags for TCP. --- rust/connlib/tunnel/src/device_channel.rs | 4 ++-- rust/ip-packet/src/lib.rs | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/rust/connlib/tunnel/src/device_channel.rs b/rust/connlib/tunnel/src/device_channel.rs index b6c2ecf84..9036e990a 100644 --- a/rust/connlib/tunnel/src/device_channel.rs +++ b/rust/connlib/tunnel/src/device_channel.rs @@ -55,7 +55,7 @@ impl Device { tracing::warn!("Packet matches heuristics of FZ-internal p2p control protocol"); } - tracing::trace!(target: "wire::dev::recv", dst = %packet.destination(), src = %packet.source(), bytes = %packet.packet().len()); + tracing::trace!(target: "wire::dev::recv", ?packet); } Poll::Ready(n) @@ -77,7 +77,7 @@ impl Device { } } - tracing::trace!(target: "wire::dev::send", dst = %packet.destination(), src = %packet.source(), bytes = %packet.packet().len()); + tracing::trace!(target: "wire::dev::send", ?packet); debug_assert!( !packet.is_fz_p2p_control(), diff --git a/rust/ip-packet/src/lib.rs b/rust/ip-packet/src/lib.rs index 6c13ff1e6..dc109fe4c 100644 --- a/rust/ip-packet/src/lib.rs +++ b/rust/ip-packet/src/lib.rs @@ -168,6 +168,14 @@ impl std::fmt::Debug for IpPacket { if tcp.syn() { dbg.field("syn", &true); } + + if tcp.rst() { + dbg.field("rst", &true); + } + + if tcp.fin() { + dbg.field("fin", &true); + } } if let Some(udp) = self.as_udp() {