Shuo Chen's notes on Linux TCP/IP stack

Source of this site: https://github.com/chenshuo/tcpip-study

The TCP state machine has three inputs: Sockets API, Timers, and Data arrives.

TCP

Overview of packet flow:

A closer look at Linux networking datapath callgraph:

Callgraph

TCP/IP Reference

TCP/IP Illustrated (vol. 1): The Protocols, 2nd ed. by Kevin R. Fall and W. Richard Stevens, 2011-11.

  • RFC793 Transmission Control Protocol, Jon Postel, 1981-09.
  • RFC813 Window and Acknowledgement Strategy in TCP, David D. Clark, 1982-07.
  • RFC1122 Requirements for Internet Hosts --- Communication Layers, 1989-10
  • RFC5681 TCP Congestion Control, 2009-09
  • RFC6093 On the Implementation of the TCP Urgent Mechanism, 2011-01, which recommends against the use of urgent mechanism.
  • RFC6582 The NewReno Modification to TCP's Fast Recovery Algorithm, 2012-04
  • RFC7323 TCP Extensions for High Performance, obsoletes RFC1323
  • RFC7413 TCP Fast Open
  • RFC7414 TCP Roadmap
  • RFC8289 Controlled Delay Active Queue Management
  • RFC8312 CC-CUBIC, Linux's default congestion control algorithm since 2.6.19, replaced BIC (default from 2.6.8 till 2.6.18.x). FreeBSD will use CUBIC as the new default, replacing NewReno.
  • RFC8985 RACK-TLP Loss Detection Algorithm for TCP
  • RFC9293 Transmission Control Protocol (TCP), obsoletes RFC793 after 40+ yrs, 2022-08.
  • Many others in 'Links' page.

TCP/IP Implementations

AFAIK, there are four independent mainstream TCP/IP stacks: BSD, Linux, Windows, and Solaris (Mentat TCP and archived page. I guess BSD stack is also used on macOS and iOS, Android uses Linux stack. So I guess most of traffic on Internet happens between the first three TCP/IP stacks.

Tools

  • packetdrill is a unittest for entire TCP/IP stack.
  • neper is a performance testing tool to generate workloads.

Recent changes

Recent changes that I am aware of.