From 52efb280ee6603dd46be3afe7e795e45d29f7789 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 28 Apr 2025 20:45:15 +1000 Subject: [PATCH] chore(ip-packet): print length of payload (#8913) This is useful when debugging things. --- rust/ip-packet/src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rust/ip-packet/src/lib.rs b/rust/ip-packet/src/lib.rs index 42515dc0d..b2c8cc4f6 100644 --- a/rust/ip-packet/src/lib.rs +++ b/rust/ip-packet/src/lib.rs @@ -159,7 +159,8 @@ impl std::fmt::Debug for IpPacket { if let Some(tcp) = self.as_tcp() { dbg.field("src_port", &tcp.source_port()) .field("dst_port", &tcp.destination_port()) - .field("seq", &tcp.sequence_number()); + .field("seq", &tcp.sequence_number()) + .field("len", &tcp.payload().len()); if tcp.syn() { dbg.field("syn", &true); @@ -176,7 +177,8 @@ impl std::fmt::Debug for IpPacket { if let Some(udp) = self.as_udp() { dbg.field("src_port", &udp.source_port()) - .field("dst_port", &udp.destination_port()); + .field("dst_port", &udp.destination_port()) + .field("len", &udp.payload().len()); } match self.ecn() {