Friday, July 3, 2020

Linux: Track a packet through the system

Problem statement: You want to debug and track a single packet through the entire system and understand delays etc?
Solution: This is a simple trick that can help in the debugging.
  1. Insert a sequence number in the skb so that it is accessible from all layers.
  2. Print timestamp for this one across all layers.
  3. Using this to track and print packets irrespective of protocol headers and sequences inside.
This way the packet can now be tracked through the entire system.