Track packets across the Linux networking stack to reconstruct their journey
Retis tracks packets as they flow through the Linux networking stack, allowing you to reconstruct their complete journey. This is essential for understanding how packets are processed, modified, and forwarded.
Packet tracking is not a built-in feature of the Linux kernel. Retis implements tracking mechanisms that work across most scenarios, though they cannot be 100% foolproof in all edge cases.
The Retis core generates unique identifiers by tracking the data part of socket buffers.The tracking identifier includes:
The socket buffer data pointer
The socket buffer structure address
This allows tracking of:
Original packets
Cloned packets (shallow copies that share data)
Modified packets (e.g., after NAT transformation)
The core tracking logic is used by the filtering system to continue tracking packets even after they’re modified. For implementation details, see the source code.
Here’s an example showing a UDP packet being dropped by Netfilter:
$ retis collect --allow-system-changes -p ip_local_deliver \ --nft-verdicts drop -f 'udp port 8080' -o --print$ retis sort136852156905 (3) [swapper/3] 0 [k] ip_local_deliver #1fdd03636dffff889641716940 (skb ffff889642506300) n 0 172.16.42.1.39677 > 172.16.42.2.8080 tos 0x0 ttl 64 id 17803 off 0 [DF] len 31 proto UDP (17) len 3 ns 0x1/4026531833 if 2 (eth0) rxif 2 ct_state NEW status 0x100 udp orig [172.16.42.1.39677 > 172.16.42.2.8080] reply [172.16.42.2.8080 > 172.16.42.1.39677] zone 0 mark 0 ↳ 136852318052 (3) [swapper/3] 0 [k] __nft_trace_packet #1fdd03636dffff889641716940 (skb ffff889642506300) n 1 172.16.42.1.39677 > 172.16.42.2.8080 tos 0x0 ttl 64 id 17803 off 0 [DF] len 31 proto UDP (17) len 3 ns 0x1/4026531833 if 2 (eth0) rxif 2 table firewalld (4) chain filter_INPUT_POLICIES (124) handle 284 drop ct_state NEW status 0x100 udp orig [172.16.42.1.39677 > 172.16.42.2.8080] reply [172.16.42.2.8080 > 172.16.42.1.39677] zone 0 mark 0 ↳ 136852333279 (3) [swapper/3] 0 [tp] skb:kfree_skb #1fdd03636dffff889641716940 (skb ffff889642506300) n 2 drop (reason NETFILTER_DROP) 172.16.42.1.39677 > 172.16.42.2.8080 tos 0x0 ttl 64 id 17803 off 0 [DF] len 31 proto UDP (17) len 3 ns 0x1/4026531833 if 2 (eth0) rxif 2 ct_state NEW status 0x100 udp orig [172.16.42.1.39677 > 172.16.42.2.8080] reply [172.16.42.2.8080 > 172.16.42.1.39677] zone 0 mark 0