Hasty Briefsbeta

The Life of a Packet in the Linux kernel: From write() to recv()

5 days ago
  • #Linux Networking
  • #Kernel
  • #Packet Routing
  • The article explains the journey of a packet in the Linux kernel from `write()` to `recv()`.
  • It covers the steps involved in transmitting a packet: TCP segmentation, IP routing, ARP for MAC address resolution, queuing (qdisc), and NIC handling.
  • On the receiving side, it details how the NIC hands data to the kernel via NAPI, IP checks, TCP reassembly, and waking the application.
  • Special cases like loopback, bridging vs routing, NAT hairpin, and IPv6 differences are highlighted.
  • Practical commands for troubleshooting and understanding network behavior are provided.
  • Common issues like ARP/neighbor problems, MTU/PMTU black holes, and bufferbloat are discussed.
  • The article also mentions kernel call paths for both transmit and receive operations.
  • Key concepts like socket, MTU/MSS, qdisc, NAPI, and DMA are explained.
  • A checklist summarizing essential networking concepts is included for quick reference.